org.gcube.portal.databook.server
Interface DatabookStore

All Known Implementing Classes:
DBCassandraAstyanaxImpl

public interface DatabookStore

Version:
0.5 Oct 5th 2012 DatabookStore is the high level interface for querying and adding data to DatabookStore
Author:
Massimiliano Assante ISTI-CNR

Method Summary
 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 denyFriendship(String from, String to)
          userid from denies a friendship to userid to
 boolean editComment(Comment comment)
          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<Like> getAllLikesByFeed(String feedid)
           
 List<Notification> getAllNotificationByUser(String userid, int limit)
           
 List<Feed> getAllPortalPrivacyLevelFeeds()
          return all the feeds whose Level is PORTAL
 List<String> getFriends(String userid)
           
 List<String> getPendingFriendRequests(String userid)
           
 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
 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)
 boolean like(Like like)
          add a like to a feed
 Feed readFeed(String feedid)
          read a feed 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 saveNotification(Notification notification)
          save a Notification instance in the store
 boolean saveUserFeed(Feed feed)
          save a Feed instance in the store
 boolean setNotificationRead(String notificationidToSet)
          set an existing Notification instance in the to read
 boolean unlike(String likeid, String feedid)
          unlike a feed
 

Method Detail

requestFriendship

boolean requestFriendship(String from,
                          String to)
userid from requests a friendship to userid to

Returns:
true if everything went fine

approveFriendship

boolean approveFriendship(String from,
                          String to)
userid from approves a friendship to userid to

Returns:
true if everything went fine

denyFriendship

boolean denyFriendship(String from,
                       String to)
userid from denies a friendship to userid to

Returns:
true if everything went fine

getFriends

List<String> getFriends(String userid)
Parameters:
userid - the user id you want to know friends
Returns:
a List of userid representing the friends for the given userid

getPendingFriendRequests

List<String> getPendingFriendRequests(String userid)
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

boolean saveUserFeed(Feed feed)
save a Feed instance in the store

Returns:
true if everything went fine

deleteFeed

boolean deleteFeed(String feedid)
                   throws FeedIDNotFoundException,
                          PrivacyLevelTypeNotFoundException,
                          FeedTypeNotFoundException,
                          ColumnNameNotFoundException
delete a Feed from the store

Returns:
true if everything went fine
Throws:
FeedIDNotFoundException
PrivacyLevelTypeNotFoundException
FeedTypeNotFoundException
ColumnNameNotFoundException

saveFeedToVRETimeline

boolean saveFeedToVRETimeline(String feedKey,
                              String vreid)
                              throws FeedIDNotFoundException
save a Feed in the VRES TimeLine in the store

Parameters:
feedKey - feedKey
vreid - vre identifier
Returns:
Throws:
FeedIDNotFoundException

saveAppFeed

boolean saveAppFeed(Feed feed)
save a Feed instance in the store

Returns:
true if everything went fine

readFeed

Feed readFeed(String feedid)
              throws PrivacyLevelTypeNotFoundException,
                     FeedTypeNotFoundException,
                     FeedIDNotFoundException,
                     ColumnNameNotFoundException
read a feed from a given id

Throws:
PrivacyLevelTypeNotFoundException
FeedTypeNotFoundException
ColumnNameNotFoundException
FeedIDNotFoundException

getAllFeedsByUser

List<Feed> getAllFeedsByUser(String userid)
                             throws PrivacyLevelTypeNotFoundException,
                                    FeedTypeNotFoundException,
                                    FeedIDNotFoundException,
                                    ColumnNameNotFoundException
Parameters:
userid - user identifier return all the feeds belonging to the userid
Throws:
FeedTypeNotFoundException
PrivacyLevelTypeNotFoundException
ColumnNameNotFoundException
FeedIDNotFoundException

getAllFeedsByApp

List<Feed> getAllFeedsByApp(String appid)
                            throws PrivacyLevelTypeNotFoundException,
                                   FeedTypeNotFoundException,
                                   FeedIDNotFoundException,
                                   ColumnNameNotFoundException
Parameters:
appid - application identifier return all the feeds belonging to the appid
Throws:
FeedTypeNotFoundException
PrivacyLevelTypeNotFoundException
ColumnNameNotFoundException
FeedIDNotFoundException

getAllPortalPrivacyLevelFeeds

List<Feed> getAllPortalPrivacyLevelFeeds()
                                         throws FeedTypeNotFoundException,
                                                ColumnNameNotFoundException,
                                                PrivacyLevelTypeNotFoundException
return all the feeds whose Level is PORTAL

Throws:
PrivacyLevelTypeNotFoundException
ColumnNameNotFoundException
PrivacyLevelTypeNotFoundException
FeedTypeNotFoundException

getRecentFeedsByUser

List<Feed> getRecentFeedsByUser(String userid,
                                int quantity)
                                throws PrivacyLevelTypeNotFoundException,
                                       FeedTypeNotFoundException,
                                       ColumnNameNotFoundException,
                                       FeedIDNotFoundException
return the most recent feeds for this user up to quantity param

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:
FeedTypeNotFoundException
PrivacyLevelTypeNotFoundException
ColumnNameNotFoundException
FeedIDNotFoundException

getAllFeedsByVRE

List<Feed> getAllFeedsByVRE(String vreid)
                            throws PrivacyLevelTypeNotFoundException,
                                   FeedTypeNotFoundException,
                                   ColumnNameNotFoundException,
                                   FeedIDNotFoundException
Parameters:
vreid - vre identifier return all the feeds belonging to the userid
Throws:
FeedTypeNotFoundException
PrivacyLevelTypeNotFoundException
ColumnNameNotFoundException
FeedIDNotFoundException

getRecentFeedsByVRE

List<Feed> getRecentFeedsByVRE(String vreid,
                               int quantity)
                               throws PrivacyLevelTypeNotFoundException,
                                      FeedTypeNotFoundException,
                                      ColumnNameNotFoundException,
                                      FeedIDNotFoundException
return the most recent feeds for this vre up to quantity param

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:
FeedTypeNotFoundException
PrivacyLevelTypeNotFoundException
ColumnNameNotFoundException
FeedIDNotFoundException

saveNotification

boolean saveNotification(Notification notification)
save a Notification instance in the store

Returns:
true if everything went fine

setNotificationRead

boolean setNotificationRead(String notificationidToSet)
                            throws NotificationIDNotFoundException,
                                   NotificationTypeNotFoundException,
                                   ColumnNameNotFoundException
set an existing Notification instance in the to read

Returns:
true if everything went fine
Throws:
NotificationIDNotFoundException
NotificationTypeNotFoundException
ColumnNameNotFoundException

readNotification

Notification readNotification(String notificationid)
                              throws NotificationIDNotFoundException,
                                     NotificationTypeNotFoundException,
                                     ColumnNameNotFoundException
read a notification from a given id

Throws:
{@link - ColumnNameNotFoundException}
{@link - NotificationIDNotFoundException}
{@link - NotificationTypeNotFoundException}
NotificationIDNotFoundException
NotificationTypeNotFoundException
ColumnNameNotFoundException

getAllNotificationByUser

List<Notification> getAllNotificationByUser(String userid,
                                            int limit)
                                            throws NotificationTypeNotFoundException,
                                                   ColumnNameNotFoundException,
                                                   NotificationIDNotFoundException
Parameters:
userid - user identifier
limit - set 0 to get everything, an int to get the most -limit- notifications return all the notifications belonging to the userid up to limit, set 0 to get everything
Throws:
NotificationTypeNotFoundException
ColumnNameNotFoundException
NotificationIDNotFoundException

getUnreadNotificationsByUser

List<Notification> getUnreadNotificationsByUser(String userid)
                                                throws NotificationTypeNotFoundException,
                                                       ColumnNameNotFoundException,
                                                       NotificationIDNotFoundException
return the not yet read notifications (not including messages)

Parameters:
userid - user identifier
Returns:
a List of not yet read notifications for this user
Throws:
NotificationTypeNotFoundException
ColumnNameNotFoundException
NotificationIDNotFoundException

getUnreadNotificationMessagesByUser

List<Notification> getUnreadNotificationMessagesByUser(String userid)
                                                       throws NotificationTypeNotFoundException,
                                                              ColumnNameNotFoundException,
                                                              NotificationIDNotFoundException
return the not yet read notification messages

Parameters:
userid - user identifier
Returns:
a List of not yet read notifications for this user
Throws:
NotificationTypeNotFoundException
ColumnNameNotFoundException
NotificationIDNotFoundException

checkUnreadNotifications

boolean checkUnreadNotifications(String userid)
                                 throws NotificationIDNotFoundException,
                                        NotificationTypeNotFoundException,
                                        ColumnNameNotFoundException
Parameters:
userid - user identifier
Returns:
true if there are unread notifications (not including messages), false if they are all read
Throws:
ColumnNameNotFoundException
NotificationTypeNotFoundException
NotificationIDNotFoundException

checkUnreadMessagesNotifications

boolean checkUnreadMessagesNotifications(String userid)
                                         throws NotificationIDNotFoundException,
                                                NotificationTypeNotFoundException,
                                                ColumnNameNotFoundException
Parameters:
userid - user identifier
Returns:
true if there are unread messages notifications (including messages), false if they are all read
Throws:
ColumnNameNotFoundException
NotificationTypeNotFoundException
NotificationIDNotFoundException

addComment

boolean addComment(Comment comment)
                   throws FeedIDNotFoundException
add a comment to a feed

Parameters:
comment - the Comment instance to add
Throws:
FeedIDNotFoundException

getAllCommentByFeed

List<Comment> getAllCommentByFeed(String feedid)
Parameters:
feedid - feed identifier return all the comments belonging to the feedid

editComment

boolean editComment(Comment comment)
                    throws PrivacyLevelTypeNotFoundException,
                           FeedTypeNotFoundException,
                           ColumnNameNotFoundException,
                           CommentIDNotFoundException,
                           FeedIDNotFoundException
edit a comment

Parameters:
commentid - the comment identifier to edit
Returns:
true if success, false otherwise
Throws:
PrivacyLevelTypeNotFoundException
FeedTypeNotFoundException
ColumnNameNotFoundException
CommentIDNotFoundException
FeedIDNotFoundException

deleteComment

boolean deleteComment(String commentid,
                      String feedid)
                      throws PrivacyLevelTypeNotFoundException,
                             FeedTypeNotFoundException,
                             ColumnNameNotFoundException,
                             CommentIDNotFoundException,
                             FeedIDNotFoundException
delete a comment

Parameters:
commentid - the comment identifier to delete
Returns:
true if success, false otherwise
Throws:
PrivacyLevelTypeNotFoundException
FeedTypeNotFoundException
ColumnNameNotFoundException
CommentIDNotFoundException
FeedIDNotFoundException

like

boolean like(Like like)
             throws FeedIDNotFoundException
add a like to a feed

Parameters:
the - like instance
Throws:
FeedIDNotFoundException

unlike

boolean unlike(String likeid,
               String feedid)
               throws PrivacyLevelTypeNotFoundException,
                      FeedTypeNotFoundException,
                      ColumnNameNotFoundException,
                      LikeIDNotFoundException,
                      FeedIDNotFoundException
unlike a feed

Parameters:
likeid - the like identifier to delete
Returns:
true if success, false otherwise
Throws:
PrivacyLevelTypeNotFoundException
FeedTypeNotFoundException
ColumnNameNotFoundException
LikeIDNotFoundException
FeedIDNotFoundException

getAllLikedFeedIdsByUser

List<String> getAllLikedFeedIdsByUser(String userid)
Parameters:
userid - user identifier return all the feedids a user has liked

getAllLikesByFeed

List<Like> getAllLikesByFeed(String feedid)
Parameters:
feedid - feed identifier return all the likes belonging to the feedid

closeConnection

void closeConnection()
close the connection to the underlying database



Copyright © 2013. All Rights Reserved.