public final class DBCassandraAstyanaxImpl extends Object implements DatabookStore
| Modifier and Type | Field and Description |
|---|---|
static String |
APP_TIMELINE_FEEDS |
protected static com.netflix.astyanax.model.ColumnFamily<String,String> |
cf_EmailInvites |
protected static com.netflix.astyanax.model.ColumnFamily<String,String> |
cf_HashtagTimeline |
protected static com.netflix.astyanax.model.ColumnFamily<String,String> |
cf_UserNotificationsPreferences |
static String |
COMMENTS |
static String |
CONNECTIONS
Column Family names
|
static String |
EMAIL_INVITES |
static String |
FEEDS |
static String |
HASHTAGGED_FEEDS |
static String |
HASHTAGS_COUNTER |
static String |
INVITES |
static String |
LIKES |
static String |
NOTIFICATIONS |
static String |
PENDING_CONNECTIONS_CF_NAME |
static String |
USER_LIKED_FEEDS |
static String |
USER_MESSAGES_NOTIFICATIONS |
static String |
USER_NOTIFICATIONS |
static String |
USER_NOTIFICATIONS_PREFERENCES |
static String |
USER_TIMELINE_FEEDS |
static String |
VRE_INVITES |
static String |
VRE_TIMELINE_FEEDS |
| Modifier | Constructor and Description |
|---|---|
|
DBCassandraAstyanaxImpl()
public constructor, no dropping schema is allowed
|
protected |
DBCassandraAstyanaxImpl(boolean dropSchema)
use this constructor carefully from test classes
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addComment(Comment comment)
add a comment to a feed
|
boolean |
approveFriendship(String from,
String to)
userid from approves a friendship to userid to
|
boolean |
checkUnreadMessagesNotifications(String userid) |
boolean |
checkUnreadNotifications(String userid) |
void |
closeConnection()
close the connection to the underlying database
|
boolean |
deleteComment(String commentid,
String feedid)
delete a comment
|
boolean |
deleteFeed(String feedId)
delete a Feed from the store
|
boolean |
deleteHashTags(String feedid,
String vreid,
List<String> hashtags) |
boolean |
denyFriendship(String from,
String to)
userid from denies a friendship to userid to
|
boolean |
editComment(Comment comment2Edit)
edit a comment
|
List<Comment> |
getAllCommentByFeed(String feedid) |
List<Feed> |
getAllFeedsByApp(String appid) |
List<Feed> |
getAllFeedsByUser(String userid) |
List<Feed> |
getAllFeedsByVRE(String vreid) |
List<String> |
getAllLikedFeedIdsByUser(String userid) |
List<Feed> |
getAllLikedFeedsByUser(String userid,
int limit) |
List<Like> |
getAllLikesByFeed(String feedid) |
List<Notification> |
getAllNotificationByUser(String userid,
int limit) |
List<Feed> |
getAllPortalPrivacyLevelFeeds()
return all the feeds whose Level is PORTAL
|
protected CassandraClusterConnection |
getConnection() |
List<String> |
getFriends(String userid) |
List<Invite> |
getInvitedEmailsByVRE(String vreid,
InviteStatus... status)
Use to get the list of invites per VRE
|
List<String> |
getPendingFriendRequests(String userid) |
List<Notification> |
getRangeNotificationsByUser(String userid,
int from,
int quantity) |
List<Feed> |
getRecentFeedsByUser(String userid,
int quantity)
return the most recent feeds for this user up to quantity param
|
List<Feed> |
getRecentFeedsByVRE(String vreid,
int quantity)
return the most recent feeds for this vre up to quantity param
|
RangeFeeds |
getRecentFeedsByVREAndRange(String vreid,
int from,
int quantity)
return the most recent feeds 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
|
List<Notification> |
getUnreadNotificationMessagesByUser(String userid)
return the not yet read notification messages
|
List<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 type
|
Map<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 VRE
|
String |
isExistingInvite(String vreid,
String email) |
boolean |
like(Like like)
add a like to a feed
|
Feed |
readFeed(String feedid)
read a feed from a given id
|
Invite |
readInvite(String inviteid)
read an invite from a given id
|
Notification |
readNotification(String notificationid)
read a notification from a given id
|
boolean |
requestFriendship(String from,
String to)
userid from requests a friendship to userid to
|
boolean |
saveAppFeed(Feed feed)
save a Feed instance in the store
|
boolean |
saveFeedToVRETimeline(String feedKey,
String vreid)
save a Feed in the VRES TimeLine in the store
|
boolean |
saveHashTags(String feedid,
String vreid,
List<String> hashtags) |
InviteOperationResult |
saveInvite(Invite invite)
Save the invite for a given email into a given vre
|
boolean |
saveNotification(Notification n)
save a Notification instance in the store
|
boolean |
saveUserFeed(Feed feed)
save a Feed instance in the store
|
boolean |
setAllNotificationReadByUser(String userid)
This is a fast way to set all notification to read quickly
|
boolean |
setInviteStatus(String vreid,
String email,
InviteStatus status)
set the status of an invite, see
InviteStatus |
boolean |
setNotificationRead(String notificationidToSet)
set an existing Notification instance in the to read
|
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)
|
boolean |
unlike(String userid,
String likeid,
String feedid)
unlike a feed
|
public static final String CONNECTIONS
public static final String PENDING_CONNECTIONS_CF_NAME
public static final String NOTIFICATIONS
public static final String FEEDS
public static final String COMMENTS
public static final String LIKES
public static final String INVITES
public static final String VRE_TIMELINE_FEEDS
public static final String USER_TIMELINE_FEEDS
public static final String APP_TIMELINE_FEEDS
public static final String USER_LIKED_FEEDS
public static final String USER_NOTIFICATIONS
public static final String USER_MESSAGES_NOTIFICATIONS
public static final String USER_NOTIFICATIONS_PREFERENCES
public static final String HASHTAGS_COUNTER
public static final String HASHTAGGED_FEEDS
public static final String VRE_INVITES
public static final String EMAIL_INVITES
protected static com.netflix.astyanax.model.ColumnFamily<String,String> cf_UserNotificationsPreferences
protected static com.netflix.astyanax.model.ColumnFamily<String,String> cf_HashtagTimeline
protected DBCassandraAstyanaxImpl(boolean dropSchema)
dropSchema - set true if you want do drop the current and set up new onepublic DBCassandraAstyanaxImpl()
protected CassandraClusterConnection getConnection()
public boolean requestFriendship(String from, String to)
requestFriendship in interface DatabookStorepublic boolean approveFriendship(String from, String to)
approveFriendship in interface DatabookStorepublic boolean denyFriendship(String from, String to)
denyFriendship in interface DatabookStorepublic List<String> getFriends(String userid)
getFriends in interface DatabookStoreuserid - the user id you want to know friendspublic List<String> getPendingFriendRequests(String userid)
getPendingFriendRequests in interface DatabookStoreuserid - the user id you want to know the pending friend requestspublic boolean saveUserFeed(Feed feed)
saveUserFeed in interface DatabookStorepublic boolean saveAppFeed(Feed feed)
saveAppFeed in interface DatabookStorepublic boolean saveFeedToVRETimeline(String feedKey, String vreid) throws FeedIDNotFoundException
saveFeedToVRETimeline in interface DatabookStorefeedKey - feedKeyvreid - vre identifierFeedIDNotFoundExceptionpublic Feed readFeed(String feedid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, FeedIDNotFoundException, ColumnNameNotFoundException
readFeed in interface DatabookStorePrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundExceptionpublic boolean deleteFeed(String feedId) throws FeedIDNotFoundException, PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException
deleteFeed in interface DatabookStoreFeedIDNotFoundExceptionPrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionpublic List<Feed> getAllFeedsByUser(String userid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
getAllFeedsByUser in interface DatabookStoreuserid - user identifier
return all the feeds belonging to the useridPrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundExceptionpublic List<Feed> getAllFeedsByApp(String appid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
getAllFeedsByApp in interface DatabookStoreappid - application identifier
return all the feeds belonging to the appidPrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundExceptionpublic List<Feed> getAllPortalPrivacyLevelFeeds() throws FeedTypeNotFoundException, ColumnNameNotFoundException, PrivacyLevelTypeNotFoundException
getAllPortalPrivacyLevelFeeds in interface DatabookStoreColumnNameNotFoundExceptionPrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionpublic List<Feed> getRecentFeedsByUser(String userid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
getRecentFeedsByUser in interface DatabookStoreuserid - user identifierquantity - the number of most recent feeds for this userPrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundExceptionpublic List<Feed> getAllFeedsByVRE(String vreid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
getAllFeedsByVRE in interface DatabookStorevreid - vre identifier
return all the feeds belonging to the useridPrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundExceptionpublic List<Feed> getRecentFeedsByVRE(String vreid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
getRecentFeedsByVRE in interface DatabookStorevreid - VRES identifierquantity - the number of most recent feeds for this vrePrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionFeedIDNotFoundExceptionpublic RangeFeeds getRecentFeedsByVREAndRange(String vreid, int from, int quantity) throws IllegalArgumentException, PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
getRecentFeedsByVREAndRange in interface DatabookStorevreid - 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" paramPrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionIllegalArgumentExceptionFeedIDNotFoundExceptionpublic boolean saveNotification(Notification n)
saveNotification in interface DatabookStorepublic Notification readNotification(String notificationid) throws NotificationIDNotFoundException, NotificationTypeNotFoundException, ColumnNameNotFoundException
readNotification in interface DatabookStoreNotificationIDNotFoundExceptionNotificationTypeNotFoundExceptionColumnNameNotFoundExceptionpublic boolean setNotificationRead(String notificationidToSet) throws NotificationIDNotFoundException, NotificationTypeNotFoundException, ColumnNameNotFoundException
setNotificationRead in interface DatabookStoreNotificationIDNotFoundExceptionNotificationTypeNotFoundExceptionColumnNameNotFoundExceptionpublic List<Notification> getAllNotificationByUser(String userid, int limit) throws NotificationTypeNotFoundException, ColumnNameNotFoundException
getAllNotificationByUser in interface DatabookStoreuserid - 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 everythingNotificationTypeNotFoundExceptionColumnNameNotFoundExceptionpublic List<Notification> getUnreadNotificationsByUser(String userid) throws NotificationTypeNotFoundException, ColumnNameNotFoundException, NotificationIDNotFoundException
getUnreadNotificationsByUser in interface DatabookStoreuserid - user identifierNotificationTypeNotFoundExceptionColumnNameNotFoundExceptionNotificationIDNotFoundExceptionpublic List<Notification> getRangeNotificationsByUser(String userid, int from, int quantity) throws NotificationTypeNotFoundException, ColumnNameNotFoundException, NotificationIDNotFoundException
getRangeNotificationsByUser in interface DatabookStoreuserid - user identifierfrom - the range start has to be greater than 0quantity - the number of most recent notifications for this user starting from "from" paramNotificationTypeNotFoundExceptionColumnNameNotFoundExceptionNotificationIDNotFoundExceptionpublic boolean setAllNotificationReadByUser(String userid) throws NotificationTypeNotFoundException, ColumnNameNotFoundException
setAllNotificationReadByUser in interface DatabookStoreNotificationTypeNotFoundExceptionColumnNameNotFoundExceptionpublic List<Notification> getUnreadNotificationMessagesByUser(String userid) throws NotificationTypeNotFoundException, ColumnNameNotFoundException, NotificationIDNotFoundException
getUnreadNotificationMessagesByUser in interface DatabookStoreuserid - user identifierNotificationTypeNotFoundExceptionColumnNameNotFoundExceptionNotificationIDNotFoundExceptionpublic boolean checkUnreadNotifications(String userid) throws NotificationTypeNotFoundException, ColumnNameNotFoundException
checkUnreadNotifications in interface DatabookStoreuserid - user identifierNotificationTypeNotFoundExceptionColumnNameNotFoundExceptionpublic boolean checkUnreadMessagesNotifications(String userid) throws NotificationIDNotFoundException, NotificationTypeNotFoundException, ColumnNameNotFoundException
checkUnreadMessagesNotifications in interface DatabookStoreuserid - user identifierNotificationIDNotFoundExceptionNotificationTypeNotFoundException - self explainingColumnNameNotFoundExceptionpublic List<NotificationChannelType> getUserNotificationChannels(String userid, NotificationType notificationType) throws NotificationChannelTypeNotFoundException, NotificationTypeNotFoundException
getUserNotificationChannels in interface DatabookStoreuserid - user identifiernotificationType - the type of the notificationNotificationChannelTypeNotFoundExceptionNotificationTypeNotFoundExceptionpublic boolean setUserNotificationPreferences(String userid, Map<NotificationType,NotificationChannelType[]> enabledChannels)
setUserNotificationPreferences in interface DatabookStoreuserid - 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 offpublic Map<NotificationType,NotificationChannelType[]> getUserNotificationPreferences(String userid) throws NotificationTypeNotFoundException, NotificationChannelTypeNotFoundException
getUserNotificationPreferences in interface DatabookStoreuserid - user identifierNotificationTypeNotFoundException - self explainingNotificationChannelTypeNotFoundException - self explainingpublic boolean addComment(Comment comment) throws FeedIDNotFoundException
addComment in interface DatabookStorecomment - the Comment instance to addFeedIDNotFoundExceptionpublic List<Comment> getAllCommentByFeed(String feedid)
getAllCommentByFeed in interface DatabookStorefeedid - feed identifier
return all the comments belonging to the feedidpublic boolean editComment(Comment comment2Edit) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, CommentIDNotFoundException, FeedIDNotFoundException
editComment in interface DatabookStorePrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionCommentIDNotFoundExceptionFeedIDNotFoundExceptionpublic boolean deleteComment(String commentid, String feedid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, CommentIDNotFoundException, FeedIDNotFoundException
deleteComment in interface DatabookStorecommentid - the comment identifier to deletePrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionCommentIDNotFoundExceptionFeedIDNotFoundExceptionpublic boolean like(Like like) throws FeedIDNotFoundException
like in interface DatabookStoreFeedIDNotFoundExceptionpublic boolean unlike(String userid, String likeid, String feedid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, LikeIDNotFoundException, FeedIDNotFoundException
unlike in interface DatabookStoreuserid - user identifierlikeid - the like identifier to deletefeedid - the feedid to which the comment is associatedPrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundExceptionColumnNameNotFoundExceptionLikeIDNotFoundExceptionFeedIDNotFoundExceptionpublic List<String> getAllLikedFeedIdsByUser(String userid)
getAllLikedFeedIdsByUser in interface DatabookStoreuserid - user identifier
return all the feedids a user has likedpublic List<Feed> getAllLikedFeedsByUser(String userid, int limit) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException
getAllLikedFeedsByUser in interface DatabookStoreuserid - user identifierlimit - set 0 to get everything, an int to get the most recent -limit- liked feedsPrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundException - .ColumnNameNotFoundException - .FeedIDNotFoundException - .public List<Like> getAllLikesByFeed(String feedid)
getAllLikesByFeed in interface DatabookStorefeedid - feed identifier
return all the likes belonging to the feedidpublic boolean saveHashTags(String feedid, String vreid, List<String> hashtags) throws FeedIDNotFoundException
saveHashTags in interface DatabookStorefeedid - the feedid to which the hashtag is associatedvreid - VRE identifierhashtags - the hashtag including the '#'FeedIDNotFoundExceptionpublic boolean deleteHashTags(String feedid, String vreid, List<String> hashtags) throws FeedIDNotFoundException
deleteHashTags in interface DatabookStorefeedid - the feedid to which the hashtag is associatedvreid - VRE identifierhashtags - the hashtag including the '#'FeedIDNotFoundExceptionpublic Map<String,Integer> getVREHashtagsWithOccurrence(String vreid)
getVREHashtagsWithOccurrence in interface DatabookStorevreid - vre identifier (scope)public List<Feed> getVREFeedsByHashtag(String vreid, String hashtag) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, FeedIDNotFoundException, ColumnNameNotFoundException
getVREFeedsByHashtag in interface DatabookStorevreid - VRE identifierhashtag - the hashtag to look for including the '#', it is case sensitivePrivacyLevelTypeNotFoundExceptionFeedTypeNotFoundException - .FeedIDNotFoundException - .ColumnNameNotFoundException - .public String isExistingInvite(String vreid, String email)
isExistingInvite in interface DatabookStorevreid - the environment where you want to check the inviteemail - the email of the invite to check in the environmnetpublic InviteOperationResult saveInvite(Invite invite) throws javax.mail.internet.AddressException
saveInvite in interface DatabookStoreinvite - the invite object instanc to saveInviteOperationResult SUCCESS, FAILED or ALREADY_INVITED (if an invite is sent to en existing email in the same environment more than once)javax.mail.internet.AddressExceptionpublic Invite readInvite(String inviteid) throws InviteIDNotFoundException, InviteStatusNotFoundException
readInvite in interface DatabookStoreInviteIDNotFoundExceptionInviteStatusNotFoundExceptionpublic boolean setInviteStatus(String vreid, String email, InviteStatus status) throws InviteIDNotFoundException, InviteStatusNotFoundException
InviteStatussetInviteStatus in interface DatabookStoreInviteStatusNotFoundExceptionInviteIDNotFoundExceptionpublic List<Invite> getInvitedEmailsByVRE(String vreid, InviteStatus... status) throws InviteIDNotFoundException, InviteStatusNotFoundException
getInvitedEmailsByVRE in interface DatabookStorevreid - the vre idstatus - optional, if you want to restict on the status, e.g. all pending invitesInviteIDNotFoundExceptionInviteStatusNotFoundExceptionpublic void closeConnection()
closeConnection in interface DatabookStoreCopyright © 2015. All Rights Reserved.