Package org.gcube.portal.databook.server
Class DBCassandraAstyanaxImpl
- java.lang.Object
-
- org.gcube.portal.databook.server.DBCassandraAstyanaxImpl
-
- All Implemented Interfaces:
DatabookStore
public final class DBCassandraAstyanaxImpl extends Object implements DatabookStore
- Author:
- Massimiliano Assante ISTI-CNR, Costantino Perciante ISTI-CNR This class is used for querying and adding data to Cassandra via Astyanax High Level API
-
-
Constructor Summary
Constructors Modifier Constructor Description DBCassandraAstyanaxImpl()public constructor, no dropping schema is allowedprotectedDBCassandraAstyanaxImpl(boolean dropSchema)use this constructor carefully from test classesDBCassandraAstyanaxImpl(String infrastructureName)public constructor, no dropping schema is allowed, infrastructureName is given.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanaddComment(Comment comment)add a comment to a feedbooleanapproveFriendship(String from, String to)userid from approves a friendship to userid tobooleancheckUnreadMessagesNotifications(String userid)booleancheckUnreadNotifications(String userid)voidcloseConnection()close the connection to the underlying databasebooleandeleteComment(String commentid, String feedid)deletes a commentbooleandeleteFeed(String feedId)Deprecated.booleandeleteHashTags(String feedid, String vreid, List<String> hashtags)booleandeleteHashTagsComment(String commentId, String vreid, List<String> hashtags)booleandeletePost(String postid)delete a Feed from the storebooleandenyFriendship(String from, String to)userid from denies a friendship to userid tobooleaneditComment(Comment comment2Edit)edit a commentList<Comment>getAllCommentByFeed(String feedid)Deprecated.List<Comment>getAllCommentByPost(String postid)List<Feed>getAllFeedsByApp(String appid)List<Feed>getAllFeedsByUser(String userid)Deprecated.List<Feed>getAllFeedsByVRE(String vreid)Deprecated.List<String>getAllLikedFeedIdsByUser(String userid)Deprecated.List<Feed>getAllLikedFeedsByUser(String userid, int limit)List<String>getAllLikedPostIdsByUser(String userid)List<Post>getAllLikedPostsByUser(String userid, int limit)List<Like>getAllLikesByFeed(String feedid)Deprecated.List<Like>getAllLikesByPost(String postid)List<Notification>getAllNotificationByUser(String userid, int limit)List<Feed>getAllPortalPrivacyLevelFeeds()Deprecated.List<Post>getAllPortalPrivacyLevelPosts()return all the feeds whose Level is PORTALList<Post>getAllPostsByApp(String appid)List<Post>getAllPostsByUser(String userid)List<Post>getAllPostsByVRE(String vreid)List<String>getAllVREIds()Retrieve all the ids of the vreList<Attachment>getAttachmentsByFeedId(String feedId)List<String>getFriends(String userid)List<Invite>getInvitedEmailsByVRE(String vreid, InviteStatus... status)Use to get the list of invites per VREList<String>getPendingFriendRequests(String userid)List<Notification>getRangeNotificationsByUser(String userid, int from, int quantity)List<Feed>getRecentCommentedFeedsByUserAndDate(String userid, long timeInMillis)Deprecated.List<Post>getRecentCommentedPostsByUserAndDate(String userid, long timeInMillis)List<Comment>getRecentCommentsByUserAndDate(String userid, long timeInMillis)List<Feed>getRecentFeedsByUser(String userid, int quantity)Deprecated.List<Feed>getRecentFeedsByUserAndDate(String userid, long timeInMillis)Deprecated.List<Feed>getRecentFeedsByVRE(String vreid, int quantity)Deprecated.RangeFeedsgetRecentFeedsByVREAndRange(String vreid, int from, int quantity)return the most recent posts for this vre up to quantity param and the last index of the feeds in the timeline lastReturnedFeedTimelineIndex is usuful to know from where to start the range the second time you ask because there are deletionsList<Feed>getRecentLikedFeedsByUserAndDate(String userid, long timeInMillis)List<Post>getRecentLikedPostsByUserAndDate(String userid, long timeInMillis)List<Post>getRecentPostsByUser(String userid, int quantity)return the most recent feeds for this user up to quantity paramList<Post>getRecentPostsByUserAndDate(String userid, long timeInMillis)List<Post>getRecentPostsByVRE(String vreid, int quantity)return the most recent posts for this vre up to quantity paramRangePostsgetRecentPostsByVREAndRange(String vreid, int from, int quantity)return the most recent posts for this vre up to quantity param and the last index of the posts in the timeline lastReturnedPostTimelineIndex is useful to know from where to start the range the next time you ask, because there are deletionsList<Notification>getUnreadNotificationsByUser(String userid)return the not yet read notifications (not including messages)List<NotificationChannelType>getUserNotificationChannels(String userid, NotificationType notificationType)return the channels a user chose for being notified for a given notification typeMap<NotificationType,NotificationChannelType[]>getUserNotificationPreferences(String userid)get the notification preferences map (enableor disable the channels to be used for notifying the user)List<Feed>getVREFeedsByHashtag(String vreid, String hashtag)Map<String,Integer>getVREHashtagsWithOccurrence(String vreid)get a map of vre hashtags where the key is the hashtag and the value is the occurrence of the hashtag in the VREMap<String,Integer>getVREHashtagsWithOccurrenceFilteredByTime(String vreid, long timestamp)get a map of vre hashtags where the key is the hashtag and the value is the occurrence of the hashtag in the VREList<Post>getVREPostsByHashtag(String vreid, String hashtag)StringisExistingInvite(String vreid, String email)booleanlike(Like like)add a like to a feedCommentreadCommentById(String commentId)FeedreadFeed(String feedid)Deprecated.InvitereadInvite(String inviteid)read an invite from a given idNotificationreadNotification(String notificationid)read a notification from a given idPostreadPost(String postid)read a feed from a given idbooleanrequestFriendship(String from, String to)userid from requests a friendship to userid tobooleansaveAppFeed(Feed post)Deprecated.booleansaveAppFeed(Feed feed, List<Attachment> attachments)Deprecated.booleansaveAppPost(Post post)save a Post instance in the storebooleansaveAppPost(Post post, List<Attachment> attachments)Save a Post instance in the store Use this if your app needs to attach more than one file to the postbooleansaveFeedToVRETimeline(String feedKey, String vreid)Deprecated.booleansaveHashTags(String feedid, String vreid, List<String> hashtags)booleansaveHashTagsComment(String commentId, String vreid, List<String> hashtags)InviteOperationResultsaveInvite(Invite invite)Save the invite for a given email into a given vrebooleansaveNotification(Notification n)save a Notification instance in the storebooleansavePostToVRETimeline(String postKey, String vreid)save a post in the VRES TimeLine in the storebooleansaveUserFeed(Feed post)Deprecated.booleansaveUserFeed(Feed feed, List<Attachment> attachments)Deprecated.booleansaveUserPost(Post post)save a Post instance in the storebooleansaveUserPost(Post post, List<Attachment> attachments)Save a Post instance in the store having more than one attachment Use this if you need to attach more than one file to the postbooleansetAllNotificationReadByUser(String userid)This is a fast way to set all notification to read quicklybooleansetInviteStatus(String vreid, String email, InviteStatus status)set the status of an invite, seeInviteStatusbooleansetNotificationRead(String notificationidToSet)set an existing Notification instance in the to readbooleansetUserNotificationPreferences(String userid, Map<NotificationType,NotificationChannelType[]> enabledChannels)set the notification preferences map (enable or disable the channels to be used for notifying the user)booleanunlike(String userid, String likeid, String feedid)unlike a feed
-
-
-
Constructor Detail
-
DBCassandraAstyanaxImpl
protected DBCassandraAstyanaxImpl(boolean dropSchema)
use this constructor carefully from test classes- Parameters:
dropSchema- set true if you want do drop the current and set up new one
-
DBCassandraAstyanaxImpl
public DBCassandraAstyanaxImpl()
public constructor, no dropping schema is allowed
-
DBCassandraAstyanaxImpl
public DBCassandraAstyanaxImpl(String infrastructureName)
public constructor, no dropping schema is allowed, infrastructureName is given.
-
-
Method Detail
-
requestFriendship
public boolean requestFriendship(String from, String to)
userid from requests a friendship to userid to- Specified by:
requestFriendshipin interfaceDatabookStore- Returns:
- true if everything went fine
-
approveFriendship
public boolean approveFriendship(String from, String to)
userid from approves a friendship to userid to- Specified by:
approveFriendshipin interfaceDatabookStore- Returns:
- true if everything went fine
-
denyFriendship
public boolean denyFriendship(String from, String to)
userid from denies a friendship to userid to- Specified by:
denyFriendshipin interfaceDatabookStore- Returns:
- true if everything went fine
-
getFriends
public List<String> getFriends(String userid)
- Specified by:
getFriendsin interfaceDatabookStore- Parameters:
userid- the user id you want to know friends- Returns:
- a List of userid representing the friends for the given userid
-
getPendingFriendRequests
public List<String> getPendingFriendRequests(String userid)
- Specified by:
getPendingFriendRequestsin interfaceDatabookStore- Parameters:
userid- the user id you want to know the pending friend requests- Returns:
- a List of userid representing the friends for the given userid
-
saveUserFeed
@Deprecated public boolean saveUserFeed(Feed post)
Deprecated.- Specified by:
saveUserFeedin interfaceDatabookStore- Returns:
- true if everything went fine
-
saveUserPost
public boolean saveUserPost(Post post)
save a Post instance in the store- Specified by:
saveUserPostin interfaceDatabookStore- Returns:
- true if everything went fine
-
saveUserFeed
@Deprecated public boolean saveUserFeed(Feed feed, List<Attachment> attachments)
Deprecated.Save a Feed instance in the store having more than one attachment Use this if you need to attach more than one file to the post- Specified by:
saveUserFeedin interfaceDatabookStoreattachments- a list of attachments starting from the second- Returns:
- true if everything went fine
-
saveUserPost
public boolean saveUserPost(Post post, List<Attachment> attachments)
Save a Post instance in the store having more than one attachment Use this if you need to attach more than one file to the post- Specified by:
saveUserPostin interfaceDatabookStoreattachments- a list of attachments starting from the second- Returns:
- true if everything went fine
-
saveAppFeed
@Deprecated public boolean saveAppFeed(Feed post)
Deprecated.- Specified by:
saveAppFeedin interfaceDatabookStore- Returns:
- true if everything went fine
-
saveAppPost
public boolean saveAppPost(Post post)
save a Post instance in the store- Specified by:
saveAppPostin interfaceDatabookStore- Returns:
- true if everything went fine
-
saveAppFeed
@Deprecated public boolean saveAppFeed(Feed feed, List<Attachment> attachments)
Deprecated.- Specified by:
saveAppFeedin interfaceDatabookStoreattachments- a list of attachments starting from the second- Returns:
- true if everything went fine
-
saveAppPost
public boolean saveAppPost(Post post, List<Attachment> attachments)
Save a Post instance in the store Use this if your app needs to attach more than one file to the post- Specified by:
saveAppPostin interfaceDatabookStoreattachments- a list of attachments starting from the second- Returns:
- true if everything went fine
-
saveFeedToVRETimeline
@Deprecated public boolean saveFeedToVRETimeline(String feedKey, String vreid) throws FeedIDNotFoundException
Deprecated.Save a post in the VRES TimeLine in the store- Specified by:
saveFeedToVRETimelinein interfaceDatabookStore- Parameters:
feedKey- feedKeyvreid- vre identifier- Throws:
FeedIDNotFoundException
-
savePostToVRETimeline
public boolean savePostToVRETimeline(String postKey, String vreid) throws FeedIDNotFoundException
save a post in the VRES TimeLine in the store- Specified by:
savePostToVRETimelinein interfaceDatabookStore- Parameters:
postKey- the post idvreid- vre identifier- Throws:
FeedIDNotFoundException
-
readFeed
@Deprecated public Feed readFeed(String feedid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, FeedIDNotFoundException, ColumnNameNotFoundException
Deprecated.- Specified by:
readFeedin interfaceDatabookStore- Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundException
-
readPost
public Post readPost(String postid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, FeedIDNotFoundException, ColumnNameNotFoundException
read a feed from a given id- Specified by:
readPostin interfaceDatabookStore- Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundException
-
getRecentFeedsByUserAndDate
@Deprecated public List<Feed> getRecentFeedsByUserAndDate(String userid, long timeInMillis) throws IllegalArgumentException
Deprecated.- Specified by:
getRecentFeedsByUserAndDatein interfaceDatabookStore- Parameters:
userid- user identifiertimeInMillis- time in milliseconds from which you want to start retrieve the feeds- Returns:
- the number of feeds in the range from: today to: timeInMillis
- Throws:
IllegalArgumentException
-
getRecentPostsByUserAndDate
public List<Post> getRecentPostsByUserAndDate(String userid, long timeInMillis) throws IllegalArgumentException
- Specified by:
getRecentPostsByUserAndDatein interfaceDatabookStore- Parameters:
userid- user identifiertimeInMillis- time in milliseconds from which you want to start retrieve the feeds- Returns:
- the number of feeds in the range from: today to: timeInMillis
- Throws:
IllegalArgumentException
-
deleteFeed
@Deprecated public boolean deleteFeed(String feedId) throws FeedIDNotFoundException, PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException
Deprecated.Delete a Feed from the store- Specified by:
deleteFeedin interfaceDatabookStore- Returns:
- true if everything went fine
- Throws:
FeedIDNotFoundExceptionPrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundException
-
deletePost
public boolean deletePost(String postid) throws FeedIDNotFoundException, PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException
delete a Feed from the store- Specified by:
deletePostin interfaceDatabookStore- Returns:
- true if everything went fine
- Throws:
FeedIDNotFoundExceptionPrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundException
-
getAllFeedsByUser
@Deprecated public List<Feed> getAllFeedsByUser(String userid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
Deprecated.- Specified by:
getAllFeedsByUserin interfaceDatabookStore- Parameters:
userid- user identifier return all the feeds belonging to the userid- Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundException
-
getAllPostsByUser
public List<Post> getAllPostsByUser(String userid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
- Specified by:
getAllPostsByUserin interfaceDatabookStore- Parameters:
userid- user identifier return all the feeds belonging to the userid- Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundException
-
getAllFeedsByApp
public List<Feed> getAllFeedsByApp(String appid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
- Specified by:
getAllFeedsByAppin interfaceDatabookStore- Parameters:
appid- application identifier return all the feeds belonging to the appid- Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundException
-
getAllPostsByApp
public List<Post> getAllPostsByApp(String appid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
- Specified by:
getAllPostsByAppin interfaceDatabookStore- Parameters:
appid- application identifier return all the feeds belonging to the appid- Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundException
-
getRecentCommentedFeedsByUserAndDate
@Deprecated public List<Feed> getRecentCommentedFeedsByUserAndDate(String userid, long timeInMillis) throws Exception
Deprecated.- Specified by:
getRecentCommentedFeedsByUserAndDatein interfaceDatabookStore- Parameters:
userid- the user identifier like andrea.rossitimeInMillis- the initial time in millis to be considered- Returns:
- a list of feeds commented by userid starting from timeInMillis
- Throws:
Exception
-
getRecentCommentedPostsByUserAndDate
public List<Post> getRecentCommentedPostsByUserAndDate(String userid, long timeInMillis) throws Exception
- Specified by:
getRecentCommentedPostsByUserAndDatein interfaceDatabookStore- Parameters:
userid- the user identifier like andrea.rossitimeInMillis- the initial time in millis to be considered- Returns:
- a list of feeds commented by userid starting from timeInMillis
- Throws:
Exception
-
getAllPortalPrivacyLevelFeeds
@Deprecated public List<Feed> getAllPortalPrivacyLevelFeeds() throws FeedTypeNotFoundException, ColumnNameNotFoundException, PrivacyLevelTypeNotFoundException
Deprecated.- Specified by:
getAllPortalPrivacyLevelFeedsin interfaceDatabookStore- Throws:
ColumnNameNotFoundExceptionPrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundException
-
getAllPortalPrivacyLevelPosts
public List<Post> getAllPortalPrivacyLevelPosts() throws FeedTypeNotFoundException, ColumnNameNotFoundException, PrivacyLevelTypeNotFoundException
Description copied from interface:DatabookStorereturn all the feeds whose Level is PORTAL- Specified by:
getAllPortalPrivacyLevelPostsin interfaceDatabookStore- Throws:
ColumnNameNotFoundExceptionPrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundException
-
getRecentFeedsByUser
@Deprecated public List<Feed> getRecentFeedsByUser(String userid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
Deprecated.return the most recent feeds for this user up to quantity param- Specified by:
getRecentFeedsByUserin interfaceDatabookStore- Parameters:
userid- user identifierquantity- the number of most recent feeds for this user- Returns:
- a
List of most recent feeds for this user - Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundException
-
getRecentPostsByUser
public List<Post> getRecentPostsByUser(String userid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
Description copied from interface:DatabookStorereturn the most recent feeds for this user up to quantity param- Specified by:
getRecentPostsByUserin interfaceDatabookStore- Parameters:
userid- user identifierquantity- the number of most recent feeds for this user- Returns:
- a
List of most recent feeds for this user - Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundException
-
getAllFeedsByVRE
@Deprecated public List<Feed> getAllFeedsByVRE(String vreid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
Deprecated.- Specified by:
getAllFeedsByVREin interfaceDatabookStore- Parameters:
vreid- vre identifier return all the feeds belonging to the userid- Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundException
-
getAllPostsByVRE
public List<Post> getAllPostsByVRE(String vreid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
- Specified by:
getAllPostsByVREin interfaceDatabookStore- Parameters:
vreid- vre identifier return all the feeds belonging to the userid- Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundException
-
getRecentFeedsByVRE
@Deprecated public List<Feed> getRecentFeedsByVRE(String vreid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
Deprecated.- Specified by:
getRecentFeedsByVREin interfaceDatabookStore- Parameters:
vreid- VRES identifierquantity- the number of most recent feeds for this vre- Returns:
- a
List of most recent feeds for this vre - Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundException
-
getRecentPostsByVRE
public List<Post> getRecentPostsByVRE(String vreid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
Description copied from interface:DatabookStorereturn the most recent posts for this vre up to quantity param- Specified by:
getRecentPostsByVREin interfaceDatabookStore- Parameters:
vreid- VRES identifierquantity- the number of most recent posts for this vre- Returns:
- a
List of most recent posts for this vre - Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundException
-
getRecentFeedsByVREAndRange
public RangeFeeds getRecentFeedsByVREAndRange(String vreid, int from, int quantity) throws IllegalArgumentException, PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
return the most recent posts for this vre up to quantity param and the last index of the feeds in the timeline lastReturnedFeedTimelineIndex is usuful to know from where to start the range the second time you ask because there are deletions- Specified by:
getRecentFeedsByVREAndRangein interfaceDatabookStore- Parameters:
vreid- VRES identifierfrom- the range start (most recent feeds for this vre) has to be greater than 0quantity- the number of most recent feeds for this vre starting from "from" param- Returns:
- a
lastReturnedFeedTimelineIndex containing of most recent feeds for this vre - Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionIllegalArgumentExceptionFeedIDNotFoundException
-
getRecentPostsByVREAndRange
public RangePosts getRecentPostsByVREAndRange(String vreid, int from, int quantity) throws IllegalArgumentException, PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
return the most recent posts for this vre up to quantity param and the last index of the posts in the timeline lastReturnedPostTimelineIndex is useful to know from where to start the range the next time you ask, because there are deletions- Specified by:
getRecentPostsByVREAndRangein interfaceDatabookStore- Parameters:
vreid- VRES identifierfrom- the range start (most recent feeds for this vre) has to be greater than 0quantity- the number of most recent feeds for this vre starting from "from" param- Returns:
- a
RangePosts containing of most recent feeds for this vre - Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionIllegalArgumentExceptionFeedIDNotFoundException
-
saveNotification
public boolean saveNotification(Notification n)
save a Notification instance in the store- Specified by:
saveNotificationin interfaceDatabookStore- Returns:
- true if everything went fine
-
readNotification
public Notification readNotification(String notificationid) throws NotificationIDNotFoundException, NotificationTypeNotFoundException, ColumnNameNotFoundException
read a notification from a given id- Specified by:
readNotificationin interfaceDatabookStore- Throws:
NotificationIDNotFoundExceptionNotificationTypeNotFoundExceptionColumnNameNotFoundException
-
setNotificationRead
public boolean setNotificationRead(String notificationidToSet) throws NotificationIDNotFoundException, NotificationTypeNotFoundException, ColumnNameNotFoundException
set an existing Notification instance in the to read- Specified by:
setNotificationReadin interfaceDatabookStore- Returns:
- true if everything went fine
- Throws:
NotificationIDNotFoundExceptionNotificationTypeNotFoundExceptionColumnNameNotFoundException
-
getAllNotificationByUser
public List<Notification> getAllNotificationByUser(String userid, int limit) throws NotificationTypeNotFoundException, ColumnNameNotFoundException
- Specified by:
getAllNotificationByUserin interfaceDatabookStore- Parameters:
userid- user identifierlimit- set 0 to get everything, an int to get the most recent -limit- notifications return all the notifications belonging to the userid up to limit, set 0 to get everything- Throws:
NotificationTypeNotFoundExceptionColumnNameNotFoundException
-
getUnreadNotificationsByUser
public List<Notification> getUnreadNotificationsByUser(String userid) throws NotificationTypeNotFoundException, ColumnNameNotFoundException, NotificationIDNotFoundException
return the not yet read notifications (not including messages)- Specified by:
getUnreadNotificationsByUserin interfaceDatabookStore- Parameters:
userid- user identifier- Returns:
- a
List of not yet read notifications for this user - Throws:
NotificationTypeNotFoundExceptionColumnNameNotFoundExceptionNotificationIDNotFoundException
-
getRangeNotificationsByUser
public List<Notification> getRangeNotificationsByUser(String userid, int from, int quantity) throws NotificationTypeNotFoundException, ColumnNameNotFoundException, NotificationIDNotFoundException
- Specified by:
getRangeNotificationsByUserin interfaceDatabookStore- Parameters:
userid- user identifierfrom- the range start has to be greater than 0quantity- the number of most recent notifications for this user starting from "from" param- Returns:
- all the notifications for the userid in the range requested
- Throws:
NotificationTypeNotFoundExceptionColumnNameNotFoundExceptionNotificationIDNotFoundException
-
setAllNotificationReadByUser
public boolean setAllNotificationReadByUser(String userid) throws NotificationTypeNotFoundException, ColumnNameNotFoundException
This is a fast way to set all notification to read quickly- Specified by:
setAllNotificationReadByUserin interfaceDatabookStore- Returns:
- true if everything went fine
- Throws:
NotificationTypeNotFoundExceptionColumnNameNotFoundException
-
checkUnreadNotifications
public boolean checkUnreadNotifications(String userid) throws NotificationTypeNotFoundException, ColumnNameNotFoundException
- Specified by:
checkUnreadNotificationsin interfaceDatabookStore- Parameters:
userid- user identifier- Returns:
- true if there are unread notifications (not including messages), false if they are all read
- Throws:
NotificationTypeNotFoundExceptionColumnNameNotFoundException
-
checkUnreadMessagesNotifications
public boolean checkUnreadMessagesNotifications(String userid) throws NotificationIDNotFoundException, NotificationTypeNotFoundException, ColumnNameNotFoundException
- Specified by:
checkUnreadMessagesNotificationsin interfaceDatabookStore- Parameters:
userid- user identifier- Returns:
- true if there are unread messages notifications (including messages), false if they are all read
- Throws:
NotificationIDNotFoundExceptionNotificationTypeNotFoundException- self explainingColumnNameNotFoundException
-
getUserNotificationChannels
public List<NotificationChannelType> getUserNotificationChannels(String userid, NotificationType notificationType) throws NotificationChannelTypeNotFoundException, NotificationTypeNotFoundException
return the channels a user chose for being notified for a given notification type- Specified by:
getUserNotificationChannelsin interfaceDatabookStore- Parameters:
userid- user identifiernotificationType- the type of the notification- Returns:
- a list of
NotificationChannelType that represents the channels this user wants to be notified - Throws:
NotificationChannelTypeNotFoundExceptionNotificationTypeNotFoundException
-
setUserNotificationPreferences
public boolean setUserNotificationPreferences(String userid, Map<NotificationType,NotificationChannelType[]> enabledChannels)
set the notification preferences map (enable or disable the channels to be used for notifying the user)- Specified by:
setUserNotificationPreferencesin interfaceDatabookStore- Parameters:
userid- user identifierenabledChannels- a map of the channels to which reach the user per notification, empty array or null values to set the key notification type off- Returns:
- true if everything was fine
-
getUserNotificationPreferences
public Map<NotificationType,NotificationChannelType[]> getUserNotificationPreferences(String userid) throws NotificationTypeNotFoundException, NotificationChannelTypeNotFoundException
get the notification preferences map (enableor disable the channels to be used for notifying the user) by default Workspace and Calendar Notifications are set to Portal- Specified by:
getUserNotificationPreferencesin interfaceDatabookStore- Parameters:
userid- user identifier- Returns:
- the map
- Throws:
NotificationTypeNotFoundException- self explainingNotificationChannelTypeNotFoundException- self explaining
-
addComment
public boolean addComment(Comment comment) throws FeedIDNotFoundException
add a comment to a feed- Specified by:
addCommentin interfaceDatabookStore- Parameters:
comment- the Comment instance to add- Throws:
FeedIDNotFoundException
-
readCommentById
public Comment readCommentById(String commentId) throws CommentIDNotFoundException
- Specified by:
readCommentByIdin interfaceDatabookStore- Parameters:
commentId- comment unique identifier- Returns:
- the comment belonging to the commentId
- Throws:
CommentIDNotFoundException
-
getAllCommentByFeed
@Deprecated public List<Comment> getAllCommentByFeed(String feedid)
Deprecated.- Specified by:
getAllCommentByFeedin interfaceDatabookStore- Parameters:
feedid- feed identifier return all the comments belonging to the feedid
-
getAllCommentByPost
public List<Comment> getAllCommentByPost(String postid)
- Specified by:
getAllCommentByPostin interfaceDatabookStore- Parameters:
postid- the post identifier return all the comments belonging to the postid
-
getRecentCommentsByUserAndDate
public List<Comment> getRecentCommentsByUserAndDate(String userid, long timeInMillis) throws Exception
- Specified by:
getRecentCommentsByUserAndDatein interfaceDatabookStore- Parameters:
userid- user identifiertimeInMillis- time in milliseconds from which you want to start retrieve the feeds- Returns:
- a list of comments (sorted starting from the most recent one) made by the user since timeInMillis up to now
- Throws:
Exception
-
editComment
public boolean editComment(Comment comment2Edit) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, CommentIDNotFoundException, FeedIDNotFoundException
edit a comment- Specified by:
editCommentin interfaceDatabookStore- Parameters:
comment2Edit- the comment to edit- Returns:
- true if success, false otherwise
- Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionCommentIDNotFoundExceptionFeedIDNotFoundException
-
deleteComment
public boolean deleteComment(String commentid, String feedid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, CommentIDNotFoundException, FeedIDNotFoundException
deletes a comment- Specified by:
deleteCommentin interfaceDatabookStore- Parameters:
commentid- the comment identifier to deletefeedid- the feedid to which the comment is associated- Returns:
- true if success, false otherwise
- Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionCommentIDNotFoundExceptionFeedIDNotFoundException
-
like
public boolean like(Like like) throws FeedIDNotFoundException
add a like to a feed- Specified by:
likein interfaceDatabookStore- Parameters:
like- instance- Throws:
FeedIDNotFoundException
-
unlike
public boolean unlike(String userid, String likeid, String feedid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, LikeIDNotFoundException, FeedIDNotFoundException
unlike a feed- Specified by:
unlikein interfaceDatabookStore- Parameters:
userid- user identifierlikeid- the like identifier to deletefeedid- the feedid to which the comment is associated- Returns:
- true if success, false otherwise
- Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionLikeIDNotFoundExceptionFeedIDNotFoundException
-
getAllLikedFeedIdsByUser
@Deprecated public List<String> getAllLikedFeedIdsByUser(String userid)
Deprecated.- Specified by:
getAllLikedFeedIdsByUserin interfaceDatabookStore- Parameters:
userid- user identifier return all the feedids a user has liked
-
getAllLikedPostIdsByUser
public List<String> getAllLikedPostIdsByUser(String userid)
- Specified by:
getAllLikedPostIdsByUserin interfaceDatabookStore- Parameters:
userid- user identifier return all the feedids a user has liked
-
getAllLikedFeedsByUser
public List<Feed> getAllLikedFeedsByUser(String userid, int limit) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
- Specified by:
getAllLikedFeedsByUserin interfaceDatabookStore- Parameters:
userid- user identifierlimit- set 0 to get everything, an int to get the most recent -limit- liked feeds- Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundException- .ColumnNameNotFoundException- .FeedIDNotFoundException- .
-
getAllLikedPostsByUser
public List<Post> getAllLikedPostsByUser(String userid, int limit) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
- Specified by:
getAllLikedPostsByUserin interfaceDatabookStore- Parameters:
userid- user identifierlimit- set 0 to get everything, an int to get the most recent -limit- liked posts- Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundException- .ColumnNameNotFoundException- .FeedIDNotFoundException- .
-
getRecentLikedFeedsByUserAndDate
public List<Feed> getRecentLikedFeedsByUserAndDate(String userid, long timeInMillis) throws IllegalArgumentException
- Specified by:
getRecentLikedFeedsByUserAndDatein interfaceDatabookStore- Parameters:
userid- user identifiertimeInMillis- time in milliseconds from which you want to start retrieve the feeds- Returns:
- the likes made to feeds in the range from: today to: timeInMillis
- Throws:
IllegalArgumentException
-
getRecentLikedPostsByUserAndDate
public List<Post> getRecentLikedPostsByUserAndDate(String userid, long timeInMillis) throws IllegalArgumentException
- Specified by:
getRecentLikedPostsByUserAndDatein interfaceDatabookStore- Parameters:
userid- user identifiertimeInMillis- time in milliseconds from which you want to start retrieve the feeds- Returns:
- the likes made to feeds in the range from: today to: timeInMillis
- Throws:
IllegalArgumentException
-
getAllLikesByFeed
@Deprecated public List<Like> getAllLikesByFeed(String feedid)
Deprecated.- Specified by:
getAllLikesByFeedin interfaceDatabookStore- Parameters:
feedid- postid identifier return all the likes belonging to the postid
-
getAllLikesByPost
public List<Like> getAllLikesByPost(String postid)
- Specified by:
getAllLikesByPostin interfaceDatabookStore- Parameters:
postid- postid identifier return all the likes belonging to the postid
-
saveHashTags
public boolean saveHashTags(String feedid, String vreid, List<String> hashtags) throws FeedIDNotFoundException
- Specified by:
saveHashTagsin interfaceDatabookStore- Parameters:
feedid- the postid to which the hashtag is associatedvreid- VRE identifierhashtags- the hashtag including the '#'- Returns:
- true if success, false otherwise
- Throws:
FeedIDNotFoundException
-
deleteHashTags
public boolean deleteHashTags(String feedid, String vreid, List<String> hashtags) throws FeedIDNotFoundException
- Specified by:
deleteHashTagsin interfaceDatabookStore- Parameters:
feedid- the postid to which the hashtag is associatedvreid- VRE identifierhashtags- the hashtag including the '#'- Returns:
- true if success, false otherwise
- Throws:
FeedIDNotFoundException
-
saveHashTagsComment
public boolean saveHashTagsComment(String commentId, String vreid, List<String> hashtags) throws CommentIDNotFoundException
- Specified by:
saveHashTagsCommentin interfaceDatabookStore- Parameters:
commentId- the commentId to which the hashtag is associatedvreid- VRE identifierhashtags- the hashtag including the '#'- Returns:
- true if success, false otherwise
- Throws:
CommentIDNotFoundException
-
deleteHashTagsComment
public boolean deleteHashTagsComment(String commentId, String vreid, List<String> hashtags) throws CommentIDNotFoundException
- Specified by:
deleteHashTagsCommentin interfaceDatabookStore- Parameters:
commentId- the commentId to which the hashtag is associatedvreid- VRE identifierhashtags- the hashtag including the '#'- Returns:
- true if success, false otherwise
- Throws:
CommentIDNotFoundException
-
getVREHashtagsWithOccurrence
public Map<String,Integer> getVREHashtagsWithOccurrence(String vreid)
get a map of vre hashtags where the key is the hashtag and the value is the occurrence of the hashtag in the VRE- Specified by:
getVREHashtagsWithOccurrencein interfaceDatabookStore- Parameters:
vreid- vre identifier (scope)- Returns:
- a HashMap
of vre Hashtags associated with their occurrence
-
getVREHashtagsWithOccurrenceFilteredByTime
public Map<String,Integer> getVREHashtagsWithOccurrenceFilteredByTime(String vreid, long timestamp)
get a map of vre hashtags where the key is the hashtag and the value is the occurrence of the hashtag in the VRE- Specified by:
getVREHashtagsWithOccurrenceFilteredByTimein interfaceDatabookStore- Parameters:
vreid- vre identifier (scope)timestamp- do not consider hashtags used before timestamp- Returns:
- a HashMap
of vre Hashtags associated with their occurrence
-
getVREFeedsByHashtag
public List<Feed> getVREFeedsByHashtag(String vreid, String hashtag) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, FeedIDNotFoundException, ColumnNameNotFoundException
- Specified by:
getVREFeedsByHashtagin interfaceDatabookStore- Parameters:
vreid- VRE identifierhashtag- the hashtag to look for including the '#', it is case sensitive- Returns:
- all the feeds having the hashtag passed as parameter
- Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundException- .FeedIDNotFoundException- .ColumnNameNotFoundException- .
-
getVREPostsByHashtag
public List<Post> getVREPostsByHashtag(String vreid, String hashtag) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, FeedIDNotFoundException, ColumnNameNotFoundException
- Specified by:
getVREPostsByHashtagin interfaceDatabookStore- Parameters:
vreid- VRE identifierhashtag- the hashtag to look for including the '#', it is case sensitive- Returns:
- all the feeds having the hashtag passed as parameter
- Throws:
PrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundException- .FeedIDNotFoundException- .ColumnNameNotFoundException- .
-
isExistingInvite
public String isExistingInvite(String vreid, String email)
- Specified by:
isExistingInvitein interfaceDatabookStore- Parameters:
vreid- the environment where you want to check the inviteemail- the email of the invite to check in the environmnet- Returns:
- the InviteId if present, null otherwise
-
saveInvite
public InviteOperationResult saveInvite(Invite invite) throws javax.mail.internet.AddressException
Save the invite for a given email into a given vre- Specified by:
saveInvitein interfaceDatabookStore- Parameters:
invite- the invite object instanc to save- Returns:
InviteOperationResultSUCCESS, FAILED or ALREADY_INVITED (if an invite is sent to en existing email in the same environment more than once)- Throws:
javax.mail.internet.AddressException
-
readInvite
public Invite readInvite(String inviteid) throws InviteIDNotFoundException, InviteStatusNotFoundException
read an invite from a given id- Specified by:
readInvitein interfaceDatabookStore- Throws:
InviteIDNotFoundExceptionInviteStatusNotFoundException
-
setInviteStatus
public boolean setInviteStatus(String vreid, String email, InviteStatus status) throws InviteIDNotFoundException, InviteStatusNotFoundException
set the status of an invite, seeInviteStatus- Specified by:
setInviteStatusin interfaceDatabookStore- Throws:
InviteStatusNotFoundExceptionInviteIDNotFoundException
-
getInvitedEmailsByVRE
public List<Invite> getInvitedEmailsByVRE(String vreid, InviteStatus... status) throws InviteIDNotFoundException, InviteStatusNotFoundException
Use to get the list of invites per VRE- Specified by:
getInvitedEmailsByVREin interfaceDatabookStore- Parameters:
vreid- the vre idstatus- optional, if you want to restict on the status, e.g. all pending invites- Returns:
- return the list of invites
- Throws:
InviteIDNotFoundExceptionInviteStatusNotFoundException
-
getAttachmentsByFeedId
public List<Attachment> getAttachmentsByFeedId(String feedId) throws FeedIDNotFoundException
- Specified by:
getAttachmentsByFeedIdin interfaceDatabookStore- Returns:
- the list of attachments of the feed feedId, starting from the second one (first attachment is included in Feed instance already)
- Throws:
FeedIDNotFoundException
-
closeConnection
public void closeConnection()
close the connection to the underlying database- Specified by:
closeConnectionin interfaceDatabookStore
-
getAllVREIds
public List<String> getAllVREIds()
Description copied from interface:DatabookStoreRetrieve all the ids of the vre- Specified by:
getAllVREIdsin interfaceDatabookStore- Returns:
- the set of ids of the vre available or empty list in case of errors.
-
-