package org.gcube.portal.databook.server; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Map; import javax.mail.internet.AddressException; import org.gcube.portal.databook.shared.*; import org.gcube.portal.databook.shared.ex.ColumnNameNotFoundException; import org.gcube.portal.databook.shared.ex.CommentIDNotFoundException; import org.gcube.portal.databook.shared.ex.FeedIDNotFoundException; import org.gcube.portal.databook.shared.ex.FeedTypeNotFoundException; import org.gcube.portal.databook.shared.ex.InviteIDNotFoundException; import org.gcube.portal.databook.shared.ex.InviteStatusNotFoundException; import org.gcube.portal.databook.shared.ex.LikeIDNotFoundException; import org.gcube.portal.databook.shared.ex.NotificationChannelTypeNotFoundException; import org.gcube.portal.databook.shared.ex.NotificationIDNotFoundException; import org.gcube.portal.databook.shared.ex.NotificationTypeNotFoundException; import org.gcube.portal.databook.shared.ex.PrivacyLevelTypeNotFoundException; import org.gcube.social_networking.social_networking_client_library.CommentClient; import org.gcube.social_networking.social_networking_client_library.HashTagClient; import org.gcube.social_networking.social_networking_client_library.InviteClient; import org.gcube.social_networking.social_networking_client_library.LikeClient; import org.gcube.social_networking.social_networking_client_library.NotificationClient; import org.gcube.social_networking.social_networking_client_library.PostClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author Massimiliano Assante ISTI-CNR * @author Costantino Perciante ISTI-CNR * This class is used for querying and adding data to Cassandra via Astyanax High Level API */ public final class DBCassandraAstyanaxImpl implements DatabookStore { /** * logger */ private static final Logger _log = LoggerFactory.getLogger(DBCassandraAstyanaxImpl.class); private static PostClient postClient; private static NotificationClient notificationClient; private static HashTagClient hashTagClient; private static InviteClient inviteClient; private static CommentClient commentClient; private static LikeClient likeClient; /** * use this constructor carefully from test classes * @param dropSchema set true if you want do drop the current and set up new one */ protected DBCassandraAstyanaxImpl(boolean dropSchema) { try { postClient = new PostClient(); notificationClient = new NotificationClient(); hashTagClient = new HashTagClient(); commentClient = new CommentClient(); inviteClient = new InviteClient(); likeClient = new LikeClient(); } catch (Exception e) { throw new RuntimeException(e); } } /** * public constructor, no dropping schema is allowed */ public DBCassandraAstyanaxImpl() { try { postClient = new PostClient(); notificationClient = new NotificationClient(); hashTagClient = new HashTagClient(); commentClient = new CommentClient(); inviteClient = new InviteClient(); likeClient = new LikeClient(); } catch (Exception e) { throw new RuntimeException(e); } } /** * public constructor, no dropping schema is allowed, infrastructureName is given. */ public DBCassandraAstyanaxImpl(String infrastructureName) { try { postClient = new PostClient(); notificationClient = new NotificationClient(); hashTagClient = new HashTagClient(); commentClient = new CommentClient(); inviteClient = new InviteClient(); likeClient = new LikeClient(); } catch (Exception e) { throw new RuntimeException(e); } } /* * ********************** FRIENDSHIPS (CONNECTIONS) *********************** * */ /** * {@inheritDoc} */ @Override public boolean requestFriendship(String from, String to) { return true; } /** * {@inheritDoc} */ @Override public boolean approveFriendship(String from, String to) { return true; } /** * {@inheritDoc} */ @Override public boolean denyFriendship(String from, String to) { return true; } /** * {@inheritDoc} */ @Override public List getFriends(String userid) { ArrayList toReturn = new ArrayList(); return toReturn; } /** * {@inheritDoc} */ @Override public List getPendingFriendRequests(String userid) { ArrayList toReturn = new ArrayList(); return toReturn; } /* * ********************** FEEDS *********************** * */ private static Post feed2post(Feed feed){ Post post = new Post(feed.getKey(), PostType.valueOf(feed.getType().toString()), feed.getEntityId(), feed.getTime(), feed.getVreid(), feed.getUri(), feed.getUriThumbnail(), feed.getDescription(), feed.getPrivacy(), feed.getFullName(), feed.getEmail(), feed.getThumbnailURL(), feed.getCommentsNo(), feed.getLikesNo(), feed.getLinkTitle(), feed.getLinkDescription(), feed.getLinkHost(), feed.isApplicationFeed(), feed.isMultiFileUpload()); return post; } private static Feed post2feed(Post post){ Feed feed = new Feed(post.getKey(), FeedType.valueOf(post.getType().toString()), post.getEntityId(), post.getTime(), post.getVreid(), post.getUri(), post.getUriThumbnail(), post.getDescription(), post.getPrivacy(), post.getFullName(), post.getEmail(), post.getThumbnailURL(), post.getCommentsNo(), post.getLikesNo(), post.getLinkTitle(), post.getLinkDescription(), post.getLinkHost(), post.isApplicationFeed(), post.isMultiFileUpload()); return feed; } /** * {@inheritDoc} */ @Deprecated @Override public boolean saveUserFeed(Feed post) { return saveUserPost(feed2post(post)); } /** * {@inheritDoc} */ @Override public boolean saveUserPost(Post post) { return postClient.saveUserPostLib(post); } /** * {@inheritDoc} */ @Deprecated @Override public boolean saveUserFeed(Feed feed, List attachments) { return saveUserPost(feed2post(feed), attachments); } /** * {@inheritDoc} */ @Override public boolean saveUserPost(Post post, List attachments) { return postClient.saveUserPostLib(post, attachments); } /** * {@inheritDoc} */ @Override @Deprecated public boolean saveAppFeed(Feed post) { return saveAppPost(feed2post(post)); } /** * {@inheritDoc} */ @Override public boolean saveAppPost(Post post) { return postClient.saveAppPostLib(post); } /** * {@inheritDoc} */ @Deprecated @Override public boolean saveAppFeed(Feed feed, List attachments) { return saveAppPost(feed2post(feed), attachments); } /** * {@inheritDoc} */ @Override public boolean saveAppPost(Post post, List attachments) { return postClient.saveAppPostLib(post, attachments); } /** * {@inheritDoc} */ @Deprecated @Override public boolean saveFeedToVRETimeline(String feedKey, String vreid) throws FeedIDNotFoundException { return savePostToVRETimeline(feedKey, vreid); } /** * {@inheritDoc} */ @Override public boolean savePostToVRETimeline(String postKey, String vreid) throws FeedIDNotFoundException { return postClient.savePostToVRETimelineLib(postKey, vreid); } /** * {@inheritDoc} */ @Deprecated @Override public Feed readFeed(String feedid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, FeedIDNotFoundException, ColumnNameNotFoundException { return post2feed(readPost(feedid)); } /** * {@inheritDoc} */ @Override public Post readPost(String postid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, FeedIDNotFoundException, ColumnNameNotFoundException { return postClient.readPostLib(postid); } /** * {@inheritDoc} */ @Override @Deprecated public List getRecentFeedsByUserAndDate(String userid, long timeInMillis) throws IllegalArgumentException { Date now = new Date(); if (timeInMillis > now.getTime()) throw new IllegalArgumentException("the timeInMillis must be before today"); List posts = getRecentPostsByUserAndDate(userid, timeInMillis); List feeds = new ArrayList<>(); for(Post post: posts){ feeds.add(post2feed(post)); } return feeds; } /** * {@inheritDoc} */ @Override public List getRecentPostsByUserAndDate(String userid, long timeInMillis) throws IllegalArgumentException { Date now = new Date(); if (timeInMillis > now.getTime()) throw new IllegalArgumentException("the timeInMillis must be before today"); return postClient.getRecentPostsByUserAndDateLib(userid, timeInMillis); } /** * {@inheritDoc} */ @Deprecated @Override public boolean deleteFeed(String feedId) throws FeedIDNotFoundException, PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException { return deletePost(feedId); } /** * {@inheritDoc} */ @Override public boolean deletePost(String postid) throws FeedIDNotFoundException, PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException { return postClient.deletePostLib(postid); } /** * {@inheritDoc} */ @Deprecated @Override public List getAllFeedsByUser(String userid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException { List posts = getAllPostsByUser(userid); List feeds = new ArrayList<>(); for(Post post: posts){ feeds.add(post2feed(post)); } return feeds; } /** * {@inheritDoc} */ @Override public List getAllPostsByUser(String userid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException { return postClient.getAllPostsByUserLib(userid); } /** * {@inheritDoc} */ @Override public List getAllFeedsByApp(String appid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException { List posts = getAllPostsByApp(appid); List feeds = new ArrayList<>(); for(Post post: posts){ feeds.add(post2feed(post)); } return feeds; } /** * {@inheritDoc} */ @Override public List getAllPostsByApp(String appid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException { return postClient.getAllPostsByAppLib(appid); } /** * {@inheritDoc} * @throws Exception */ @Deprecated @Override public List getRecentCommentedFeedsByUserAndDate(String userid, long timeInMillis) throws Exception { List posts = getRecentCommentedPostsByUserAndDate(userid, timeInMillis); List feeds = new ArrayList<>(); for(Post post: posts){ feeds.add(post2feed(post)); } return feeds; } /** * {@inheritDoc} * @throws Exception */ @Override public List getRecentCommentedPostsByUserAndDate(String userid, long timeInMillis) throws Exception { return postClient.getRecentCommentedPostsByUserAndDateLib(userid, timeInMillis); } /** * {@inheritDoc} */ @Deprecated @Override public List getAllPortalPrivacyLevelFeeds() throws FeedTypeNotFoundException, ColumnNameNotFoundException, PrivacyLevelTypeNotFoundException { List posts = getAllPortalPrivacyLevelPosts(); List feeds = new ArrayList<>(); for(Post post: posts){ feeds.add(post2feed(post)); } return feeds; } @Override public List getAllPortalPrivacyLevelPosts() throws FeedTypeNotFoundException, ColumnNameNotFoundException, PrivacyLevelTypeNotFoundException { return postClient.getAllPortalPrivacyLevelPostsLib(); } /** * {@inheritDoc} */ @Override @Deprecated public List getRecentFeedsByUser(String userid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException { List posts = getRecentPostsByUser(userid, quantity); List feeds = new ArrayList<>(); for(Post post: posts){ feeds.add(post2feed(post)); } return feeds; } @Override public List getRecentPostsByUser(String userid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException { return postClient.getRecentPostsByUserLib(userid, quantity); } /** * {@inheritDoc} */ @Override @Deprecated public List getAllFeedsByVRE(String vreid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException { List posts = getAllPostsByVRE(vreid); List feeds = new ArrayList<>(); for(Post post: posts){ feeds.add(post2feed(post)); } return feeds; } /** * {@inheritDoc} */ @Override public List getAllPostsByVRE(String vreid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException { return postClient.getAllPostsByVRELib(vreid); } /** * {@inheritDoc} */ @Deprecated @Override public List getRecentFeedsByVRE(String vreid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException { List posts = getRecentPostsByVRE(vreid, quantity); List feeds = new ArrayList<>(); for(Post post: posts){ feeds.add(post2feed(post)); } return feeds; } @Override public List getRecentPostsByVRE(String vreid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException { return postClient.getRecentPostsByVRELib(vreid, quantity); } /** * {@inheritDoc} */ @Override public RangeFeeds getRecentFeedsByVREAndRange(String vreid, int from, int quantity) throws IllegalArgumentException, PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException { RangePosts rangePosts = getRecentPostsByVREAndRange(vreid, from, quantity); List posts = rangePosts.getPosts(); ArrayList feeds = new ArrayList<>(); for(Post post: posts){ feeds.add(post2feed(post)); } RangeFeeds rangeFeeds = new RangeFeeds(rangePosts.getLastReturnedPostTimelineIndex(), feeds); return rangeFeeds; } /** * {@inheritDoc} */ @Override public RangePosts getRecentPostsByVREAndRange(String vreid, int from, int quantity) throws IllegalArgumentException, PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException { return postClient.getRecentPostsByVREAndRangeLib(vreid, from, quantity); } /* * ********************** NOTIFICATIONS *********************** * */ /** * {@inheritDoc} */ @Override public boolean saveNotification(Notification n) { return notificationClient.saveNotificationLib(n); } /** * {@inheritDoc} */ @Override public Notification readNotification(String notificationid) throws NotificationIDNotFoundException, NotificationTypeNotFoundException, ColumnNameNotFoundException { return notificationClient.readNotificationLib(notificationid); } /** * {@inheritDoc} */ @Override public boolean setNotificationRead(String notificationidToSet) throws NotificationIDNotFoundException, NotificationTypeNotFoundException, ColumnNameNotFoundException { return notificationClient.setNotificationReadLib(notificationidToSet); } /** * {@inheritDoc} */ @Override public List getAllNotificationByUser(String userid, int limit) throws NotificationTypeNotFoundException, ColumnNameNotFoundException { return notificationClient.getAllNotificationByUserLib(userid, limit); } /** * {@inheritDoc} */ @Override public List getUnreadNotificationsByUser(String userid) throws NotificationTypeNotFoundException, ColumnNameNotFoundException, NotificationIDNotFoundException { return notificationClient.getUnreadNotificationsByUserLib(userid); } /** * {@inheritDoc} */ @Override public List getRangeNotificationsByUser(String userid,int from, int quantity) throws NotificationTypeNotFoundException, ColumnNameNotFoundException, NotificationIDNotFoundException { return notificationClient.getRangeNotificationsByUserLib(userid, from, quantity); } /** * {@inheritDoc} */ @Override public boolean setAllNotificationReadByUser(String userid) throws NotificationTypeNotFoundException, ColumnNameNotFoundException { return notificationClient.setAllNotificationReadByUserLib(userid); } /** * {@inheritDoc} */ @Override public boolean checkUnreadNotifications(String userid) throws NotificationTypeNotFoundException, ColumnNameNotFoundException { return notificationClient.checkUnreadNotificationsLib(userid); } /** * {@inheritDoc} */ @Override public boolean checkUnreadMessagesNotifications(String userid) throws NotificationIDNotFoundException, NotificationTypeNotFoundException, ColumnNameNotFoundException { return notificationClient.checkUnreadMessagesNotificationsLib(userid); } /* * ********************** NOTIFICATION SETTINGS *********************** * */ /** * {@inheritDoc} */ @Override public List getUserNotificationChannels(String userid, NotificationType notificationType) throws NotificationChannelTypeNotFoundException, NotificationTypeNotFoundException { return notificationClient.getUserNotificationChannelsLib(userid, notificationType); } /** * {@inheritDoc} */ @Override public boolean setUserNotificationPreferences(String userid, Map enabledChannels) { return notificationClient.setUserNotificationPreferencesLib(userid, enabledChannels); } /** * {@inheritDoc} * * by default Workspace and Calendar Notifications are set to Portal */ @Override public Map getUserNotificationPreferences(String userid) throws NotificationTypeNotFoundException, NotificationChannelTypeNotFoundException { return notificationClient.getUserNotificationPreferencesLib(userid); } /* * ********************** COMMENTS *********************** * */ /** * {@inheritDoc} */ @Override public boolean addComment(Comment comment) throws FeedIDNotFoundException { return commentClient.addCommentLib(comment)!=null; } /** * {@inheritDoc} */ public Comment readCommentById(String commentId) throws CommentIDNotFoundException { return commentClient.readCommentByIdLib(commentId); } /** * {@inheritDoc} */ @Override @Deprecated public List getAllCommentByFeed(String feedid) { return getAllCommentByPost(feedid); } /** * {@inheritDoc} */ @Override public List getAllCommentByPost(String postid) { return commentClient.getAllCommentsByPostIdLib(postid); } /** * {@inheritDoc} * @throws Exception */ @Override public List getRecentCommentsByUserAndDate(final String userid, final long timeInMillis) throws Exception { return commentClient.getRecentCommentsByUserAndDateLib(userid, timeInMillis); } /** * {@inheritDoc} */ @Override public boolean editComment(Comment comment2Edit) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, CommentIDNotFoundException, FeedIDNotFoundException { return commentClient.editCommentLib(comment2Edit)!=null; } /** * {@inheritDoc} */ @Override public boolean deleteComment(String commentid, String feedid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, CommentIDNotFoundException, FeedIDNotFoundException { return commentClient.deleteCommentLib(commentid, feedid); } /** * {@inheritDoc} */ @Override public boolean like(Like like) throws FeedIDNotFoundException { return likeClient.likeLib(like); } /** * {@inheritDoc} */ @Override public boolean unlike(String userid, String likeid, String feedid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, LikeIDNotFoundException, FeedIDNotFoundException { return likeClient.unlikeLib(userid, likeid, feedid); } /** * {@inheritDoc} */ @Override @Deprecated public List getAllLikedFeedIdsByUser(String userid) { return getAllLikedPostIdsByUser(userid); } /** * {@inheritDoc} */ @Override public List getAllLikedPostIdsByUser(String userid) { return likeClient.getAllLikedPostIdsByUserLib(userid); } /** * {@inheritDoc} */ @Override public List getAllLikedFeedsByUser(String userid, int limit) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException { ArrayList toReturn = new ArrayList<>(); List likedPostIDs = getAllLikedPostIdsByUser(userid); //check if quantity is greater than user feeds limit = (limit > likedPostIDs.size()) ? likedPostIDs.size() : limit; //need them in reverse order for (int i = likedPostIDs.size()-1; i >= (likedPostIDs.size()-limit); i--) { Feed toAdd = readFeed(likedPostIDs.get(i)); if (toAdd.getType() == FeedType.TWEET || toAdd.getType() == FeedType.SHARE || toAdd.getType() == FeedType.PUBLISH) { toReturn.add(toAdd); _log.trace("Read recent post: " + likedPostIDs.get(i)); } else { _log.trace("Read and skipped post: " + likedPostIDs.get(i) + " (Removed post)"); limit += 1; //increase the quantity in case of removed feed //check if quantity is greater than user feeds limit = (limit > likedPostIDs.size()) ? likedPostIDs.size() : limit; } } return toReturn; } /** * {@inheritDoc} */ @Override public List getAllLikedPostsByUser(String userid, int limit) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException { ArrayList toReturn = new ArrayList(); List likedPostIDs = getAllLikedPostIdsByUser(userid); //check if quantity is greater than user feeds limit = (limit > likedPostIDs.size()) ? likedPostIDs.size() : limit; //need them in reverse order for (int i = likedPostIDs.size()-1; i >= (likedPostIDs.size()-limit); i--) { Post toAdd = readPost(likedPostIDs.get(i)); if (toAdd.getType() == PostType.TWEET || toAdd.getType() == PostType.SHARE || toAdd.getType() == PostType.PUBLISH) { toReturn.add(toAdd); _log.trace("Read recent post: " + likedPostIDs.get(i)); } else { _log.trace("Read and skipped post: " + likedPostIDs.get(i) + " (Removed post)"); limit += 1; //increase the quantity in case of removed feed //check if quantity is greater than user feeds limit = (limit > likedPostIDs.size()) ? likedPostIDs.size() : limit; } } return toReturn; } /** * {@inheritDoc} */ @Override public List getRecentLikedFeedsByUserAndDate(String userid, long timeInMillis) throws IllegalArgumentException { List toReturn = new ArrayList<>(); Date now = new Date(); if (timeInMillis > now.getTime()) throw new IllegalArgumentException("the timeInMillis must be before today"); if(userid == null || userid.isEmpty()) throw new IllegalArgumentException("the userId parameter cannot be null/empty"); // get the list of liked feeds List likedPostsIdsByUser = getAllLikedFeedIdsByUser(userid); if(likedPostsIdsByUser != null && !likedPostsIdsByUser.isEmpty()){ for(int i = likedPostsIdsByUser.size() - 1; i >= 0; i--){ String postid = likedPostsIdsByUser.get(i); try{ // retrieve the Post Feed toCheck = readFeed(postid); boolean isPostOk = (toCheck.getType() == FeedType.TWEET || toCheck.getType() == FeedType.SHARE || toCheck.getType() == FeedType.PUBLISH); // retrieve the like of the user for the post if(isPostOk){ List likes = getAllLikesByFeed(postid); for (Like like : likes) { if(like.getTime().getTime() >= timeInMillis && like.getUserid().equals(userid)) toReturn.add(toCheck); } } }catch(Exception e){ _log.error("Skipped post with id " + postid, e); } } } // please check consider that if a user made like recently to an old post, well it could happen that this // post comes first than a newer post in the toReturn list. Thus we need to sort it. Collections.sort(toReturn, Collections.reverseOrder()); return toReturn; } /** * {@inheritDoc} */ @Override public List getRecentLikedPostsByUserAndDate(String userid, long timeInMillis) throws IllegalArgumentException { List toReturn = new ArrayList<>(); Date now = new Date(); if (timeInMillis > now.getTime()) throw new IllegalArgumentException("the timeInMillis must be before today"); if(userid == null || userid.isEmpty()) throw new IllegalArgumentException("the userId parameter cannot be null/empty"); // get the list of liked feeds List likedPostsIdsByUser = getAllLikedPostIdsByUser(userid); if(likedPostsIdsByUser != null && !likedPostsIdsByUser.isEmpty()){ for(int i = likedPostsIdsByUser.size() - 1; i >= 0; i--){ String postid = likedPostsIdsByUser.get(i); try{ // retrieve the Post Post toCheck = readPost(postid); boolean isPostOk = (toCheck.getType() == PostType.TWEET || toCheck.getType() == PostType.SHARE || toCheck.getType() == PostType.PUBLISH); // retrieve the like of the user for the post if(isPostOk){ List likes = getAllLikesByPost(postid); for (Like like : likes) { if(like.getTime().getTime() >= timeInMillis && like.getUserid().equals(userid)) toReturn.add(toCheck); } } }catch(Exception e){ _log.error("Skipped post with id " + postid, e); } } } // please check consider that if a user made like recently to an old post, well it could happen that this // post comes first than a newer post in the toReturn list. Thus we need to sort it. Collections.sort(toReturn, Collections.reverseOrder()); return toReturn; } /** * {@inheritDoc} */ @Deprecated @Override public List getAllLikesByFeed(String feedid) { return getAllLikesByPost(feedid); } /** * {@inheritDoc} */ @Override public List getAllLikesByPost(String postid) { //possible error index return likeClient.getAllLikesByPostLib(postid); } /* * ********************** HASHTAGS *********************** * */ /** * {@inheritDoc} */ @Override public boolean saveHashTags(String feedid, String vreid, List hashtags) throws FeedIDNotFoundException { return hashTagClient.saveHashTagsLib(feedid, vreid, hashtags); } /** * {@inheritDoc} */ @Override public boolean deleteHashTags(String feedid, String vreid, List hashtags) throws FeedIDNotFoundException { return hashTagClient.deleteHashTagsLib(feedid, vreid, hashtags); } /** * {@inheritDoc} */ @Override public boolean saveHashTagsComment(String commentId, String vreid, List hashtags) throws CommentIDNotFoundException { return hashTagClient.saveHashTagsCommentLib(commentId, vreid, hashtags); } /** * {@inheritDoc} */ @Override public boolean deleteHashTagsComment(String commentId, String vreid, List hashtags) throws CommentIDNotFoundException { return hashTagClient.deleteHashTagsCommentLib(commentId, vreid, hashtags); } /** * {@inheritDoc} */ @Override public Map getVREHashtagsWithOccurrence(String vreid) { return hashTagClient.getVREHashtagsWithOccurrenceLib(vreid); } /** * {@inheritDoc} */ @Override public Map getVREHashtagsWithOccurrenceFilteredByTime(String vreid, long timestamp){ return hashTagClient.getVREHashtagsWithOccurrenceFilteredByTimeLib(vreid, timestamp); } /** * {@inheritDoc} */ @Override public List getVREFeedsByHashtag(String vreid, String hashtag) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, FeedIDNotFoundException, ColumnNameNotFoundException { return null; } /** * {@inheritDoc} */ @Override public List getVREPostsByHashtag(String vreid, String hashtag) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, FeedIDNotFoundException, ColumnNameNotFoundException { return hashTagClient.getVREPostsByHashtagLib(vreid, hashtag); } /* * ********************** Invites *********************** * */ /** * {@inheritDoc} */ @Override public String isExistingInvite(String vreid, String email) { return inviteClient.isExistingInviteLib(vreid, email); } /** * {@inheritDoc} */ @Override public InviteOperationResult saveInvite(Invite invite) throws AddressException { return inviteClient.saveInviteLib(invite); } /** * {@inheritDoc} */ @Override public Invite readInvite(String inviteid) throws InviteIDNotFoundException, InviteStatusNotFoundException { return inviteClient.readInviteLib(inviteid); } /** * {@inheritDoc} * @throws InviteStatusNotFoundException */ @Override public boolean setInviteStatus(String vreid, String email, InviteStatus status) throws InviteIDNotFoundException, InviteStatusNotFoundException { return inviteClient.setInviteStatusLib(vreid, email, status); } /** * {@inheritDoc} */ @Override public List getInvitedEmailsByVRE(String vreid, InviteStatus... status) throws InviteIDNotFoundException, InviteStatusNotFoundException{ return inviteClient.getInvitedEmailsByVRELib(vreid, status); } /** * {@inheritDoc} */ @Override public List getAttachmentsByFeedId(String feedId) throws FeedIDNotFoundException { return postClient.getAttachmentsByFeedIdLib(feedId); } /** * {@inheritDoc} */ @Override public void closeConnection() { } @Override public List getAllVREIds(){ return postClient.getAllVREIdsLib(); } }