DBCassandraAstyanaxImpl (gCube Social Networking Library 1.15.0-SNAPSHOT API)
Date: 2017-05-13

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

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `APP_TIMELINE_FEEDS`
    `static String` | `ATTACHMENTS`
    `protected static com.netflix.astyanax.model.ColumnFamily<String,String>` | `cf_Attachments`
    `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` | `FEED_ATTACHMENTS`
    `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_NOTIFICATIONS`
    `static String` | `USER_NOTIFICATIONS_PREFERENCES`
    `static String` | `USER_NOTIFICATIONS_UNREAD`
    `static String` | `USER_TIMELINE_FEEDS`
    `static String` | `VRE_INVITES`
    `static String` | `VRE_TIMELINE_FEEDS`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `DBCassandraAstyanaxImpl()` public constructor, no dropping schema is allowed
    `protected` | `DBCassandraAstyanaxImpl(boolean dropSchema)` use this constructor carefully from test classes
    `` | `DBCassandraAstyanaxImpl(String infrastructureName)` public constructor, no dropping schema is allowed, infrastructureName is given.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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
    `List<String>` | `getAllVREIds()` Retrieve all the ids of the vre
    `List<Attachment>` | `getAttachmentsByFeedId(String feedId)`
    `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>` | `getRecentCommentedFeedsByUserAndDate(String userid, long timeInMillis)`
    `List<Comment>` | `getRecentCommentsByUserAndDate(String userid, long timeInMillis)`
    `List<Feed>` | `getRecentFeedsByUser(String userid, int quantity)` return the most recent feeds for this user up to quantity param
    `List<Feed>` | `getRecentFeedsByUserAndDate(String userid, long timeInMillis)`
    `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<Feed>` | `getRecentLikedFeedsByUserAndDate(String userid, long timeInMillis)`
    `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
    `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
    `String` | `isExistingInvite(String vreid, String email)`
    `boolean` | `like(Like like)` add a like to a feed
    `Comment` | `readCommentById(String commentId)`
    `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 Post instance in the store
    `boolean` | `saveAppFeed(Feed feed, List<Attachment> attachments)` Save a feed instance in the store Use this if your app needs to attach more than one file to the post
    `boolean` | `saveFeedToVRETimeline(String feedKey, String vreid)` save a post 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` | `saveUserFeed(Feed feed, List<Attachment> attachments)` 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
    `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

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### CONNECTIONS

          public static final String CONNECTIONS

      Column Family names
      See Also:
        Constant Field Values

    - #### PENDING_CONNECTIONS_CF_NAME

          public static final String PENDING_CONNECTIONS_CF_NAME

      See Also:
        Constant Field Values

    - #### NOTIFICATIONS

          public static final String NOTIFICATIONS

      See Also:
        Constant Field Values

    - #### FEEDS

          public static final String FEEDS

      See Also:
        Constant Field Values

    - #### COMMENTS

          public static final String COMMENTS

      See Also:
        Constant Field Values

    - #### LIKES

          public static final String LIKES

      See Also:
        Constant Field Values

    - #### INVITES

          public static final String INVITES

      See Also:
        Constant Field Values

    - #### VRE_TIMELINE_FEEDS

          public static final String VRE_TIMELINE_FEEDS

      See Also:
        Constant Field Values

    - #### USER_TIMELINE_FEEDS

          public static final String USER_TIMELINE_FEEDS

      See Also:
        Constant Field Values

    - #### APP_TIMELINE_FEEDS

          public static final String APP_TIMELINE_FEEDS

      See Also:
        Constant Field Values

    - #### USER_LIKED_FEEDS

          public static final String USER_LIKED_FEEDS

      See Also:
        Constant Field Values

    - #### USER_NOTIFICATIONS

          public static final String USER_NOTIFICATIONS

      See Also:
        Constant Field Values

    - #### USER_NOTIFICATIONS_UNREAD

          public static final String USER_NOTIFICATIONS_UNREAD

      See Also:
        Constant Field Values

    - #### USER_NOTIFICATIONS_PREFERENCES

          public static final String USER_NOTIFICATIONS_PREFERENCES

      See Also:
        Constant Field Values

    - #### HASHTAGS_COUNTER

          public static final String HASHTAGS_COUNTER

      See Also:
        Constant Field Values

    - #### HASHTAGGED_FEEDS

          public static final String HASHTAGGED_FEEDS

      See Also:
        Constant Field Values

    - #### VRE_INVITES

          public static final String VRE_INVITES

      See Also:
        Constant Field Values

    - #### EMAIL_INVITES

          public static final String EMAIL_INVITES

      See Also:
        Constant Field Values

    - #### ATTACHMENTS

          public static final String ATTACHMENTS

      See Also:
        Constant Field Values

    - #### FEED_ATTACHMENTS

          public static final String FEED_ATTACHMENTS

      See Also:
        Constant Field Values

    - #### cf_UserNotificationsPreferences

          protected static com.netflix.astyanax.model.ColumnFamily<String,String> cf_UserNotificationsPreferences

    - #### cf_HashtagTimeline

          protected static com.netflix.astyanax.model.ColumnFamily<String,String> cf_HashtagTimeline

    - #### cf_EmailInvites

          protected static com.netflix.astyanax.model.ColumnFamily<String,String> cf_EmailInvites

    - #### cf_Attachments

          protected static com.netflix.astyanax.model.ColumnFamily<String,String> cf_Attachments

  - ### 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

    - #### getConnection

          protected CassandraClusterConnection getConnection()

    - #### requestFriendship

          public boolean requestFriendship(String from,
                                           String to)

      userid from requests a friendship to userid to
      Specified by:
        `requestFriendship` in interface `DatabookStore`
      Returns:
        true if everything went fine

    - #### approveFriendship

          public boolean approveFriendship(String from,
                                           String to)

      userid from approves a friendship to userid to
      Specified by:
        `approveFriendship` in interface `DatabookStore`
      Returns:
        true if everything went fine

    - #### denyFriendship

          public boolean denyFriendship(String from,
                                        String to)

      userid from denies a friendship to userid to
      Specified by:
        `denyFriendship` in interface `DatabookStore`
      Returns:
        true if everything went fine

    - #### getFriends

          public List<String> getFriends(String userid)

      Specified by:
        `getFriends` in interface `DatabookStore`
      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:
        `getPendingFriendRequests` in interface `DatabookStore`
      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

          public boolean saveUserFeed(Feed feed)

      save a Feed instance in the store
      Specified by:
        `saveUserFeed` in interface `DatabookStore`
      Returns:
        true if everything went fine

    - #### saveUserFeed

          public boolean saveUserFeed(Feed feed,
                                      List<Attachment> attachments)

      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:
        `saveUserFeed` in interface `DatabookStore`
      Returns:
        true if everything went fine

    - #### saveAppFeed

          public boolean saveAppFeed(Feed feed)

      save a Post instance in the store
      Specified by:
        `saveAppFeed` in interface `DatabookStore`
      Returns:
        true if everything went fine

    - #### saveAppFeed

          public boolean saveAppFeed(Feed feed,
                                     List<Attachment> attachments)

      Save a feed instance in the store Use this if your app needs to attach more than one file to the post
      Specified by:
        `saveAppFeed` in interface `DatabookStore`
      Returns:
        true if everything went fine

    - #### saveFeedToVRETimeline

          public boolean saveFeedToVRETimeline(String feedKey,
                                               String vreid)
                                        throws FeedIDNotFoundException

      save a post in the VRES TimeLine in the store
      Specified by:
        `saveFeedToVRETimeline` in interface `DatabookStore`
      Parameters:
        `feedKey` - feedKey
        `vreid` - vre identifier
      Returns:
      Throws:
        `FeedIDNotFoundException`

    - #### readFeed

          public Feed readFeed(String feedid)
                        throws PrivacyLevelTypeNotFoundException,
                               FeedTypeNotFoundException,
                               FeedIDNotFoundException,
                               ColumnNameNotFoundException

      read a feed from a given id
      Specified by:
        `readFeed` in interface `DatabookStore`
      Throws:
        `PrivacyLevelTypeNotFoundException`
        `FeedTypeNotFoundException`
        `ColumnNameNotFoundException`
        `FeedIDNotFoundException`

    - #### getRecentFeedsByUserAndDate

          public List<Feed> getRecentFeedsByUserAndDate(String userid,
                                                        long timeInMillis)
                                                 throws IllegalArgumentException

      Specified by:
        `getRecentFeedsByUserAndDate` in interface `DatabookStore`
      Parameters:
        `userid` - user identifier
        `timeInMillis` - 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

          public boolean deleteFeed(String feedId)
                             throws FeedIDNotFoundException,
                                    PrivacyLevelTypeNotFoundException,
                                    FeedTypeNotFoundException,
                                    ColumnNameNotFoundException

      delete a Feed from the store
      Specified by:
        `deleteFeed` in interface `DatabookStore`
      Returns:
        true if everything went fine
      Throws:
        `FeedIDNotFoundException`
        `PrivacyLevelTypeNotFoundException`
        `FeedTypeNotFoundException`
        `ColumnNameNotFoundException`

    - #### getAllFeedsByUser

          public List<Feed> getAllFeedsByUser(String userid)
                                       throws PrivacyLevelTypeNotFoundException,
                                              FeedTypeNotFoundException,
                                              ColumnNameNotFoundException,
                                              FeedIDNotFoundException

      Specified by:
        `getAllFeedsByUser` in interface `DatabookStore`
      Parameters:
        `userid` - user identifier return all the feeds belonging to the userid
      Throws:
        `PrivacyLevelTypeNotFoundException`
        `FeedTypeNotFoundException`
        `ColumnNameNotFoundException`
        `FeedIDNotFoundException`

    - #### getAllFeedsByApp

          public List<Feed> getAllFeedsByApp(String appid)
                                      throws PrivacyLevelTypeNotFoundException,
                                             FeedTypeNotFoundException,
                                             ColumnNameNotFoundException,
                                             FeedIDNotFoundException

      Specified by:
        `getAllFeedsByApp` in interface `DatabookStore`
      Parameters:
        `appid` - application identifier return all the feeds belonging to the appid
      Throws:
        `PrivacyLevelTypeNotFoundException`
        `FeedTypeNotFoundException`
        `ColumnNameNotFoundException`
        `FeedIDNotFoundException`

    - #### getRecentCommentedFeedsByUserAndDate

          public List<Feed> getRecentCommentedFeedsByUserAndDate(String userid,
                                                                 long timeInMillis)
                                                          throws Exception

      Specified by:
        `getRecentCommentedFeedsByUserAndDate` in interface `DatabookStore`
      Parameters:
        `userid` - the user identifier like andrea.rossi
        `timeInMillis` - the initial time in millis to be considered
      Returns:
        a list of feeds commented by userid starting from timeInMillis
      Throws:
        `Exception`

    - #### getAllPortalPrivacyLevelFeeds

          public List<Feed> getAllPortalPrivacyLevelFeeds()
                                                   throws FeedTypeNotFoundException,
                                                          ColumnNameNotFoundException,
                                                          PrivacyLevelTypeNotFoundException

      return all the feeds whose Level is PORTAL
      Specified by:
        `getAllPortalPrivacyLevelFeeds` in interface `DatabookStore`
      Throws:
        `ColumnNameNotFoundException`
        `PrivacyLevelTypeNotFoundException`
        `FeedTypeNotFoundException`

    - #### getRecentFeedsByUser

          public List<Feed> getRecentFeedsByUser(String userid,
                                                 int quantity)
                                          throws PrivacyLevelTypeNotFoundException,
                                                 FeedTypeNotFoundException,
                                                 ColumnNameNotFoundException,
                                                 FeedIDNotFoundException

      return the most recent feeds for this user up to quantity param
      Specified by:
        `getRecentFeedsByUser` in interface `DatabookStore`
      Parameters:
        `userid` - user identifier
        `quantity` - the number of most recent feeds for this user
      Returns:
        a List of most recent feeds for this user
      Throws:
        `PrivacyLevelTypeNotFoundException`
        `FeedTypeNotFoundException`
        `ColumnNameNotFoundException`
        `FeedIDNotFoundException`

    - #### getAllFeedsByVRE

          public List<Feed> getAllFeedsByVRE(String vreid)
                                      throws PrivacyLevelTypeNotFoundException,
                                             FeedTypeNotFoundException,
                                             ColumnNameNotFoundException,
                                             FeedIDNotFoundException

      Specified by:
        `getAllFeedsByVRE` in interface `DatabookStore`
      Parameters:
        `vreid` - vre identifier return all the feeds belonging to the userid
      Throws:
        `PrivacyLevelTypeNotFoundException`
        `FeedTypeNotFoundException`
        `ColumnNameNotFoundException`
        `FeedIDNotFoundException`

    - #### getRecentFeedsByVRE

          public List<Feed> getRecentFeedsByVRE(String vreid,
                                                int quantity)
                                         throws PrivacyLevelTypeNotFoundException,
                                                FeedTypeNotFoundException,
                                                ColumnNameNotFoundException,
                                                FeedIDNotFoundException

      return the most recent feeds for this vre up to quantity param
      Specified by:
        `getRecentFeedsByVRE` in interface `DatabookStore`
      Parameters:
        `vreid` - VRES identifier
        `quantity` - the number of most recent feeds for this vre
      Returns:
        a List of most recent feeds for this vre
      Throws:
        `PrivacyLevelTypeNotFoundException`
        `FeedTypeNotFoundException`
        `ColumnNameNotFoundException`
        `FeedIDNotFoundException`

    - #### getRecentFeedsByVREAndRange

          public RangeFeeds getRecentFeedsByVREAndRange(String vreid,
                                                        int from,
                                                        int quantity)
                                                 throws IllegalArgumentException,
                                                        PrivacyLevelTypeNotFoundException,
                                                        FeedTypeNotFoundException,
                                                        ColumnNameNotFoundException,
                                                        FeedIDNotFoundException

      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
      Specified by:
        `getRecentFeedsByVREAndRange` in interface `DatabookStore`
      Parameters:
        `vreid` - VRES identifier
        `from` - the range start (most recent feeds for this vre) has to be greater than 0
        `quantity` - 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:
        `PrivacyLevelTypeNotFoundException`
        `FeedTypeNotFoundException`
        `ColumnNameNotFoundException`
        `IllegalArgumentException`
        `FeedIDNotFoundException`

    - #### saveNotification

          public boolean saveNotification(Notification n)

      save a Notification instance in the store
      Specified by:
        `saveNotification` in interface `DatabookStore`
      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:
        `readNotification` in interface `DatabookStore`
      Throws:
        `NotificationIDNotFoundException`
        `NotificationTypeNotFoundException`
        `ColumnNameNotFoundException`

    - #### setNotificationRead

          public boolean setNotificationRead(String notificationidToSet)
                                      throws NotificationIDNotFoundException,
                                             NotificationTypeNotFoundException,
                                             ColumnNameNotFoundException

      set an existing Notification instance in the to read
      Specified by:
        `setNotificationRead` in interface `DatabookStore`
      Returns:
        true if everything went fine
      Throws:
        `NotificationIDNotFoundException`
        `NotificationTypeNotFoundException`
        `ColumnNameNotFoundException`

    - #### getAllNotificationByUser

          public List<Notification> getAllNotificationByUser(String userid,
                                                             int limit)
                                                      throws NotificationTypeNotFoundException,
                                                             ColumnNameNotFoundException

      Specified by:
        `getAllNotificationByUser` in interface `DatabookStore`
      Parameters:
        `userid` - user identifier
        `limit` - 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:
        `NotificationTypeNotFoundException`
        `ColumnNameNotFoundException`

    - #### getUnreadNotificationsByUser

          public List<Notification> getUnreadNotificationsByUser(String userid)
                                                          throws NotificationTypeNotFoundException,
                                                                 ColumnNameNotFoundException,
                                                                 NotificationIDNotFoundException

      return the not yet read notifications (not including messages)
      Specified by:
        `getUnreadNotificationsByUser` in interface `DatabookStore`
      Parameters:
        `userid` - user identifier
      Returns:
        a List of not yet read notifications for this user
      Throws:
        `NotificationTypeNotFoundException`
        `ColumnNameNotFoundException`
        `NotificationIDNotFoundException`

    - #### getRangeNotificationsByUser

          public List<Notification> getRangeNotificationsByUser(String userid,
                                                                int from,
                                                                int quantity)
                                                         throws NotificationTypeNotFoundException,
                                                                ColumnNameNotFoundException,
                                                                NotificationIDNotFoundException

      Specified by:
        `getRangeNotificationsByUser` in interface `DatabookStore`
      Parameters:
        `userid` - user identifier
        `from` - the range start has to be greater than 0
        `quantity` - 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:
        `NotificationTypeNotFoundException`
        `ColumnNameNotFoundException`
        `NotificationIDNotFoundException`

    - #### setAllNotificationReadByUser

          public boolean setAllNotificationReadByUser(String userid)
                                               throws NotificationTypeNotFoundException,
                                                      ColumnNameNotFoundException

      This is a fast way to set all notification to read quickly
      Specified by:
        `setAllNotificationReadByUser` in interface `DatabookStore`
      Returns:
        true if everything went fine
      Throws:
        `NotificationTypeNotFoundException`
        `ColumnNameNotFoundException`

    - #### checkUnreadNotifications

          public boolean checkUnreadNotifications(String userid)
                                           throws NotificationTypeNotFoundException,
                                                  ColumnNameNotFoundException

      Specified by:
        `checkUnreadNotifications` in interface `DatabookStore`
      Parameters:
        `userid` - user identifier
      Returns:
        true if there are unread notifications (not including messages), false if they are all read
      Throws:
        `NotificationTypeNotFoundException`
        `ColumnNameNotFoundException`

    - #### checkUnreadMessagesNotifications

          public boolean checkUnreadMessagesNotifications(String userid)
                                                   throws NotificationIDNotFoundException,
                                                          NotificationTypeNotFoundException,
                                                          ColumnNameNotFoundException

      Specified by:
        `checkUnreadMessagesNotifications` in interface `DatabookStore`
      Parameters:
        `userid` - user identifier
      Returns:
        true if there are unread messages notifications (including messages), false if they are all read
      Throws:
        `NotificationIDNotFoundException`
        `NotificationTypeNotFoundException` - self explaining
        `ColumnNameNotFoundException`

    - #### 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:
        `getUserNotificationChannels` in interface `DatabookStore`
      Parameters:
        `userid` - user identifier
        `notificationType` - the type of the notification
      Returns:
        a list of NotificationChannelType that represents the channels this user wants to be notified
      Throws:
        `NotificationChannelTypeNotFoundException`
        `NotificationTypeNotFoundException`

    - #### 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:
        `setUserNotificationPreferences` in interface `DatabookStore`
      Parameters:
        `userid` - user identifier
        `enabledChannels` - 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:
        `getUserNotificationPreferences` in interface `DatabookStore`
      Parameters:
        `userid` - user identifier
      Returns:
        the map
      Throws:
        `NotificationTypeNotFoundException` - self explaining
        `NotificationChannelTypeNotFoundException` - self explaining

    - #### addComment

          public boolean addComment(Comment comment)
                             throws FeedIDNotFoundException

      add a comment to a feed
      Specified by:
        `addComment` in interface `DatabookStore`
      Parameters:
        `comment` - the Comment instance to add
      Throws:
        `FeedIDNotFoundException`

    - #### readCommentById

          public Comment readCommentById(String commentId)
                                  throws CommentIDNotFoundException

      Specified by:
        `readCommentById` in interface `DatabookStore`
      Parameters:
        `commentId` - comment unique identifier
      Returns:
        the comment belonging to the commentId
      Throws:
        `CommentIDNotFoundException`

    - #### getAllCommentByFeed

          public List<Comment> getAllCommentByFeed(String feedid)

      Specified by:
        `getAllCommentByFeed` in interface `DatabookStore`
      Parameters:
        `feedid` - feed identifier return all the comments belonging to the feedid

    - #### getRecentCommentsByUserAndDate

          public List<Comment> getRecentCommentsByUserAndDate(String userid,
                                                              long timeInMillis)
                                                       throws Exception

      Specified by:
        `getRecentCommentsByUserAndDate` in interface `DatabookStore`
      Parameters:
        `userid` - user identifier
        `timeInMillis` - 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:
        `editComment` in interface `DatabookStore`
      Returns:
        true if success, false otherwise
      Throws:
        `PrivacyLevelTypeNotFoundException`
        `FeedTypeNotFoundException`
        `ColumnNameNotFoundException`
        `CommentIDNotFoundException`
        `FeedIDNotFoundException`

    - #### deleteComment

          public boolean deleteComment(String commentid,
                                       String feedid)
                                throws PrivacyLevelTypeNotFoundException,
                                       FeedTypeNotFoundException,
                                       ColumnNameNotFoundException,
                                       CommentIDNotFoundException,
                                       FeedIDNotFoundException

      delete a comment
      Specified by:
        `deleteComment` in interface `DatabookStore`
      Parameters:
        `commentid` - the comment identifier to delete
      Returns:
        true if success, false otherwise
      Throws:
        `PrivacyLevelTypeNotFoundException`
        `FeedTypeNotFoundException`
        `ColumnNameNotFoundException`
        `CommentIDNotFoundException`
        `FeedIDNotFoundException`

    - #### like

          public boolean like(Like like)
                       throws FeedIDNotFoundException

      add a like to a feed
      Specified by:
        `like` in interface `DatabookStore`
      Throws:
        `FeedIDNotFoundException`

    - #### unlike

          public boolean unlike(String userid,
                                String likeid,
                                String feedid)
                         throws PrivacyLevelTypeNotFoundException,
                                FeedTypeNotFoundException,
                                ColumnNameNotFoundException,
                                LikeIDNotFoundException,
                                FeedIDNotFoundException

      unlike a feed
      Specified by:
        `unlike` in interface `DatabookStore`
      Parameters:
        `userid` - user identifier
        `likeid` - the like identifier to delete
        `feedid` - the feedid to which the comment is associated
      Returns:
        true if success, false otherwise
      Throws:
        `PrivacyLevelTypeNotFoundException`
        `FeedTypeNotFoundException`
        `ColumnNameNotFoundException`
        `LikeIDNotFoundException`
        `FeedIDNotFoundException`

    - #### getAllLikedFeedIdsByUser

          public List<String> getAllLikedFeedIdsByUser(String userid)

      Specified by:
        `getAllLikedFeedIdsByUser` in interface `DatabookStore`
      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:
        `getAllLikedFeedsByUser` in interface `DatabookStore`
      Parameters:
        `userid` - user identifier
        `limit` - set 0 to get everything, an int to get the most recent -limit- liked feeds
      Throws:
        `PrivacyLevelTypeNotFoundException`
        `FeedTypeNotFoundException` - .
        `ColumnNameNotFoundException` - .
        `FeedIDNotFoundException` - .

    - #### getRecentLikedFeedsByUserAndDate

          public List<Feed> getRecentLikedFeedsByUserAndDate(String userid,
                                                             long timeInMillis)
                                                      throws IllegalArgumentException

      Specified by:
        `getRecentLikedFeedsByUserAndDate` in interface `DatabookStore`
      Parameters:
        `userid` - user identifier
        `timeInMillis` - 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

          public List<Like> getAllLikesByFeed(String feedid)

      Specified by:
        `getAllLikesByFeed` in interface `DatabookStore`
      Parameters:
        `feedid` - feed identifier return all the likes belonging to the feedid

    - #### saveHashTags

          public boolean saveHashTags(String feedid,
                                      String vreid,
                                      List<String> hashtags)
                               throws FeedIDNotFoundException

      Specified by:
        `saveHashTags` in interface `DatabookStore`
      Parameters:
        `feedid` - the feedid to which the hashtag is associated
        `vreid` - VRE identifier
        `hashtags` - 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:
        `deleteHashTags` in interface `DatabookStore`
      Parameters:
        `feedid` - the feedid to which the hashtag is associated
        `vreid` - VRE identifier
        `hashtags` - the hashtag including the '#'
      Returns:
        true if success, false otherwise
      Throws:
        `FeedIDNotFoundException`

    - #### 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:
        `getVREHashtagsWithOccurrence` in interface `DatabookStore`
      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:
        `getVREHashtagsWithOccurrenceFilteredByTime` in interface `DatabookStore`
      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:
        `getVREFeedsByHashtag` in interface `DatabookStore`
      Parameters:
        `vreid` - VRE identifier
        `hashtag` - the hashtag to look for including the '#', it is case sensitive
      Returns:
        all the feeds having the hashtag passed as parameter
      Throws:
        `PrivacyLevelTypeNotFoundException`
        `FeedTypeNotFoundException` - .
        `FeedIDNotFoundException` - .
        `ColumnNameNotFoundException` - .

    - #### isExistingInvite

          public String isExistingInvite(String vreid,
                                         String email)

      Specified by:
        `isExistingInvite` in interface `DatabookStore`
      Parameters:
        `vreid` - the environment where you want to check the invite
        `email` - 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:
        `saveInvite` in interface `DatabookStore`
      Parameters:
        `invite` - the invite object instanc to save
      Returns:
        `InviteOperationResult` SUCCESS, 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:
        `readInvite` in interface `DatabookStore`
      Throws:
        `InviteIDNotFoundException`
        `InviteStatusNotFoundException`

    - #### setInviteStatus

          public boolean setInviteStatus(String vreid,
                                         String email,
                                         InviteStatus status)
                                  throws InviteIDNotFoundException,
                                         InviteStatusNotFoundException

      set the status of an invite, see `InviteStatus`
      Specified by:
        `setInviteStatus` in interface `DatabookStore`
      Throws:
        `InviteStatusNotFoundException`
        `InviteIDNotFoundException`

    - #### getInvitedEmailsByVRE

          public List<Invite> getInvitedEmailsByVRE(String vreid,
                                                    InviteStatus... status)
                                             throws InviteIDNotFoundException,
                                                    InviteStatusNotFoundException

      Use to get the list of invites per VRE
      Specified by:
        `getInvitedEmailsByVRE` in interface `DatabookStore`
      Parameters:
        `vreid` - the vre id
        `status` - optional, if you want to restict on the status, e.g. all pending invites
      Returns:
        return the list of invites
      Throws:
        `InviteIDNotFoundException`
        `InviteStatusNotFoundException`

    - #### getAttachmentsByFeedId

          public List<Attachment> getAttachmentsByFeedId(String feedId)
                                                  throws FeedIDNotFoundException

      Specified by:
        `getAttachmentsByFeedId` in interface `DatabookStore`
      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:
        `closeConnection` in interface `DatabookStore`

    - #### getAllVREIds

          public List<String> getAllVREIds()
                                    throws com.netflix.astyanax.connectionpool.exceptions.ConnectionException

      Description copied from interface: `DatabookStore`
      Retrieve all the ids of the vre
      Specified by:
        `getAllVREIds` in interface `DatabookStore`
      Returns:
        the set of ids of the vre available or empty list in case of errors.
      Throws:
        `com.netflix.astyanax.connectionpool.exceptions.ConnectionException`

Copyright © 2017. All Rights Reserved.