Package org.gcube.portal.databook.server
Class DBCassandraAstyanaxImpl
java.lang.Object
org.gcube.portal.databook.server.DBCassandraAstyanaxImpl
- All Implemented Interfaces:
DatabookStore
- Author:
- Massimiliano Assante ISTI-CNR, Costantino Perciante ISTI-CNR, Ahmed Ibrahim ISTI-CNR This class is used for querying and adding data to Cassandra via Datastax High Level API
-
Constructor Summary
ConstructorsModifierConstructorDescriptionpublic 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
Modifier and TypeMethodDescriptionbooleanaddComment(Comment comment) add a comment to a feedbooleanapproveFriendship(String from, String to) Approves a friendship request from one user to another.booleanbooleancheckUnreadNotifications(String userid) voidclose 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) Denies a friendship request from one user to another.booleaneditComment(Comment comment2Edit) edit a commentgetAllCommentByFeed(String feedid) Deprecated.getAllCommentByPost(String postid) getAllFeedsByApp(String appid) getAllFeedsByUser(String userid) Deprecated.getAllFeedsByVRE(String vreid) Deprecated.getAllLikedFeedIdsByUser(String userid) Deprecated.getAllLikedFeedsByUser(String userid, int limit) getAllLikedPostIdsByUser(String userid) getAllLikedPostsByUser(String userid, int limit) getAllLikesByFeed(String feedid) Deprecated.getAllLikesByPost(String postid) getAllNotificationByUser(String userid, int limit) Deprecated.return all the feeds whose Level is PORTALgetAllPostsByApp(String appid) getAllPostsByUser(String userid) getAllPostsByVRE(String vreid) Returns all posts for a specified VRE.Retrieve all the ids of the vregetAttachmentsByFeedId(String feedId) protected CassandraClusterConnectiongetFriends(String userid) Gets the list of friends for a specified user.getInvitedEmailsByVRE(String vreid, InviteStatus... status) Use to get the list of invites per VREgetPendingFriendRequests(String userid) Gets the list of pending friend requests for a specified user.getRangeNotificationsByUser(String userid, int from, int quantity) getRecentCommentedFeedsByUserAndDate(String userid, long timeInMillis) Deprecated.getRecentCommentedPostsByUserAndDate(String userid, long timeInMillis) getRecentCommentsByUserAndDate(String userid, long timeInMillis) getRecentFeedsByUser(String userid, int quantity) Deprecated.getRecentFeedsByUserAndDate(String userid, long timeInMillis) Deprecated.getRecentFeedsByVRE(String vreid, int quantity) Deprecated.getRecentFeedsByVREAndRange(String vreid, int from, int quantity) Returns the most recent posts for this VRE up to the specified quantity and the last index of the posts in the timeline.getRecentLikedFeedsByUserAndDate(String userid, long timeInMillis) getRecentLikedPostsByUserAndDate(String userid, long timeInMillis) getRecentPostsByUser(String userid, int quantity) return the most recent feeds for this user up to quantity paramgetRecentPostsByUserAndDate(String userid, long timeInMillis) getRecentPostsByVRE(String vreid, int quantity) Returns the most recent posts for a VRE, up to the specified quantity.getRecentPostsByVREAndRange(String vreid, int from, int quantity) Returns the most recent posts for a VRE within a specified range, and provides the last index of posts in the timeline for pagination purposes.getUnreadNotificationsByUser(String userid) Returns all unread notifications for a user (excluding message notifications).getUserNotificationChannels(String userid, NotificationType notificationType) Returns the notification channels a user has chosen for a given notification type.getUserNotificationPreferences(String userid) Gets the notification preferences map (enable or disable the channels to be used for notifying the user).getVREFeedsByHashtag(String vreid, String hashtag) get a map of VRE hashtags where the key is the hashtag and the value is the occurrence of the hashtag in the VRE.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.getVREPostsByHashtag(String vreid, String hashtag) Returns all posts in a VRE that contain a specific hashtag.isExistingInvite(String vreid, String email) booleanadd a like to a feedreadCommentById(String commentId) Deprecated.readInvite(String inviteid) read an invite from a given idreadNotification(String notificationid) Reads a notification from a given ID.read a feed from a given idbooleanrequestFriendship(String from, String to) Requests a friendship from one user to another.booleansaveAppFeed(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 postbooleansaveAttachmentEntry(String feedId, Attachment toSave) save an attachmentbooleansaveFeedToVRETimeline(String feedKey, String vreid) Deprecated.booleansaveHashTags(String feedid, String vreid, List<String> hashtags) booleansaveHashTagsComment(String commentId, String vreid, List<String> hashtags) saveInvite(Invite invite) Save the invite for a given email into a given vrebooleansave 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 a feed
-
Constructor Details
-
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 constructor, no dropping schema is allowed, infrastructureName is given.
-
-
Method Details
-
getConnection
-
requestFriendship
Requests a friendship from one user to another.- Specified by:
requestFriendshipin interfaceDatabookStore- Parameters:
from- The user ID requesting the friendship.to- The user ID receiving the friendship request.- Returns:
- true if the operation was successful.
-
approveFriendship
Approves a friendship request from one user to another.- Specified by:
approveFriendshipin interfaceDatabookStore- Parameters:
from- The user ID approving the friendship.to- The user ID being approved.- Returns:
- true if the operation was successful.
-
denyFriendship
Denies a friendship request from one user to another.- Specified by:
denyFriendshipin interfaceDatabookStore- Parameters:
from- The user ID denying the friendship.to- The user ID being denied.- Returns:
- true if the operation was successful.
-
getFriends
Gets the list of friends for a specified user.- Specified by:
getFriendsin interfaceDatabookStore- Parameters:
userid- The user ID to get friends for.- Returns:
- A
Listof user IDs representing the friends of the given user.
-
getPendingFriendRequests
Gets the list of pending friend requests for a specified user.- Specified by:
getPendingFriendRequestsin interfaceDatabookStore- Parameters:
userid- The user ID to get pending friend requests for.- Returns:
- A
Listof user IDs representing pending friend requests for the given user.
-
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
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, PrivacyLevelTypeNotFoundExceptionDeprecated.- Specified by:
getAllPortalPrivacyLevelFeedsin interfaceDatabookStore- Throws:
ColumnNameNotFoundExceptionPrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundException
-
getAllPortalPrivacyLevelPosts
public List<Post> getAllPortalPrivacyLevelPosts() throws FeedTypeNotFoundException, ColumnNameNotFoundException, PrivacyLevelTypeNotFoundExceptionDescription 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
Listof 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
Listof 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 Returns all posts for a specified VRE.- Specified by:
getAllPostsByVREin interfaceDatabookStore- Parameters:
vreid- The VRE identifier.- Returns:
- A
Listof all posts belonging to the specified VRE. - Throws:
PrivacyLevelTypeNotFoundException- If a privacy level is not recognized.FeedTypeNotFoundException- If a feed type is not recognized.ColumnNameNotFoundException- If a column name is not found.FeedIDNotFoundException- If a feed ID is not found.
-
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
Listof 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:DatabookStoreReturns the most recent posts for a VRE, up to the specified quantity.- Specified by:
getRecentPostsByVREin interfaceDatabookStore- Parameters:
vreid- The VRE identifier.quantity- The maximum number of most recent posts to return.- Returns:
- A
Listof most recent posts for this VRE. - Throws:
PrivacyLevelTypeNotFoundException- If a privacy level is not recognized.FeedTypeNotFoundException- If a feed type is not recognized.ColumnNameNotFoundException- If a column name is not found.FeedIDNotFoundException- If a feed ID is not found.
-
getRecentFeedsByVREAndRange
public RangeFeeds getRecentFeedsByVREAndRange(String vreid, int from, int quantity) throws IllegalArgumentException, PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException Returns the most recent posts for this VRE up to the specified quantity and the last index of the posts in the timeline. The lastReturnedFeedTimelineIndex is useful to know from where to start the range the next time you query, as there may be deletions.- Specified by:
getRecentFeedsByVREAndRangein interfaceDatabookStore- Parameters:
vreid- The VRE identifier.from- The range start (most recent posts for this VRE). Must be greater than 0.quantity- The number of most recent posts for this VRE starting from the "from" parameter.- Returns:
- A
RangeFeedscontaining the most recent posts for this VRE and the last index in the timeline. - Throws:
PrivacyLevelTypeNotFoundException- If a privacy level is not recognized.FeedTypeNotFoundException- If a feed type is not recognized.ColumnNameNotFoundException- If a column name is not found.FeedIDNotFoundException- If a feed ID is not found.IllegalArgumentException
-
getRecentPostsByVREAndRange
public RangePosts getRecentPostsByVREAndRange(String vreid, int from, int quantity) throws IllegalArgumentException, PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException Returns the most recent posts for a VRE within a specified range, and provides the last index of posts in the timeline for pagination purposes.- Specified by:
getRecentPostsByVREAndRangein interfaceDatabookStore- Parameters:
vreid- The VRE identifier.from- The starting index (0-based) for retrieving posts. Must be greater than 0.quantity- The maximum number of posts to retrieve starting from the "from" index.- Returns:
- A
RangePostscontaining the most recent posts for this VRE and pagination metadata. - Throws:
PrivacyLevelTypeNotFoundException- If a privacy level is not recognized.FeedTypeNotFoundException- If a feed type is not recognized.ColumnNameNotFoundException- If a column name is not found.FeedIDNotFoundException- If a feed ID is not found.IllegalArgumentException
-
readNotification
public Notification readNotification(String notificationid) throws NotificationIDNotFoundException, NotificationTypeNotFoundException, ColumnNameNotFoundException Reads a notification from a given ID.- Specified by:
readNotificationin interfaceDatabookStore- Parameters:
notificationid- The notification ID to read.- Returns:
- The
Notificationcorresponding to the given ID. - Throws:
NotificationIDNotFoundException- If a notification ID is not found.NotificationTypeNotFoundException- If a notification type is not recognized.ColumnNameNotFoundException- If a column name is not found.
-
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 Returns all unread notifications for a user (excluding message notifications).- Specified by:
getUnreadNotificationsByUserin interfaceDatabookStore- Parameters:
userid- The user identifier.- Returns:
- A
Listof unread notifications for this user. - Throws:
NotificationTypeNotFoundException- If a notification type is not recognized.ColumnNameNotFoundException- If a column name is not found.NotificationIDNotFoundException- If a notification ID is not found.
-
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:
NotificationTypeNotFoundException- If a notification type is not recognized.ColumnNameNotFoundException- If a column name is not found.
-
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:
NotificationIDNotFoundException- If a notification ID is not found.NotificationTypeNotFoundException- If a notification type is not recognized.ColumnNameNotFoundException- If a column name is not found.
-
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 Gets the notification preferences map (enable or disable the channels to be used for notifying the user). by default Workspace and Calendar Notifications are set to Portal check if the number of preferences found is the same of NotificationType.values().length, if different creates the missing entries- Specified by:
getUserNotificationPreferencesin interfaceDatabookStore- Parameters:
userid- The user identifier.- Returns:
- The map of
NotificationTypetoNotificationChannelType. - Throws:
NotificationTypeNotFoundException- If a notification type is not recognized.NotificationChannelTypeNotFoundException- If a notification channel type is not recognized.
-
readCommentById
- Specified by:
readCommentByIdin interfaceDatabookStore- Parameters:
commentId- comment unique identifier- Returns:
- the comment belonging to the commentId
- Throws:
CommentIDNotFoundException
-
getAllCommentByFeed
Deprecated.- Specified by:
getAllCommentByFeedin interfaceDatabookStore- Parameters:
feedid- feed identifier return all the comments belonging to the feedid
-
getAllCommentByPost
- 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
-
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
-
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.- Specified by:
getAllLikedFeedIdsByUserin interfaceDatabookStore- Parameters:
userid- user identifier return all the feedids a user has liked
-
getAllLikedPostIdsByUser
- 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.- Specified by:
getAllLikesByFeedin interfaceDatabookStore- Parameters:
feedid- postid identifier return all the likes belonging to the postid
-
getAllLikesByPost
- 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
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
Mapof hashtags associated with their occurrence.
-
getVREHashtagsWithOccurrenceFilteredByTime
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 this timestamp.- Returns:
- a
Mapof 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 Returns all posts in a VRE that contain a specific hashtag.- Specified by:
getVREPostsByHashtagin interfaceDatabookStore- Parameters:
vreid- The VRE identifier.hashtag- The hashtag to search for (including the '#'). Case-sensitive.- Returns:
- A
Listof posts containing the specified hashtag. - Throws:
PrivacyLevelTypeNotFoundException- If a privacy level is not recognized.FeedTypeNotFoundException- If a feed type is not recognized.FeedIDNotFoundException- If a feed ID is not found.ColumnNameNotFoundException- If a column name is not found.
-
isExistingInvite
- 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
-
readInvite
public Invite readInvite(String inviteid) throws InviteIDNotFoundException, InviteStatusNotFoundException read an invite from a given id- Specified by:
readInvitein interfaceDatabookStore- Throws:
InviteIDNotFoundExceptionInviteStatusNotFoundException
-
getAttachmentsByFeedId
- 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
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.
-