Added Implementation of deprecated methods.
This commit is contained in:
parent
60ddd56e8e
commit
c75c501644
|
@ -8,21 +8,7 @@ import java.util.Map;
|
|||
|
||||
import javax.mail.internet.AddressException;
|
||||
|
||||
import org.gcube.portal.databook.shared.Attachment;
|
||||
import org.gcube.portal.databook.shared.Comment;
|
||||
import org.gcube.portal.databook.shared.Feed;
|
||||
import org.gcube.portal.databook.shared.FeedType;
|
||||
import org.gcube.portal.databook.shared.Invite;
|
||||
import org.gcube.portal.databook.shared.InviteOperationResult;
|
||||
import org.gcube.portal.databook.shared.InviteStatus;
|
||||
import org.gcube.portal.databook.shared.Like;
|
||||
import org.gcube.portal.databook.shared.Notification;
|
||||
import org.gcube.portal.databook.shared.NotificationChannelType;
|
||||
import org.gcube.portal.databook.shared.NotificationType;
|
||||
import org.gcube.portal.databook.shared.Post;
|
||||
import org.gcube.portal.databook.shared.PostType;
|
||||
import org.gcube.portal.databook.shared.RangeFeeds;
|
||||
import org.gcube.portal.databook.shared.RangePosts;
|
||||
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;
|
||||
|
@ -160,13 +146,28 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
*
|
||||
*/
|
||||
|
||||
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 true;
|
||||
return saveUserPost(feed2post(post));
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -181,7 +182,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
@Deprecated
|
||||
@Override
|
||||
public boolean saveUserFeed(Feed feed, List<Attachment> attachments) {
|
||||
return true;
|
||||
return saveUserPost(feed2post(feed), attachments);
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -197,7 +198,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
@Override
|
||||
@Deprecated
|
||||
public boolean saveAppFeed(Feed post) {
|
||||
return true;
|
||||
return saveAppPost(feed2post(post));
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -212,7 +213,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
@Deprecated
|
||||
@Override
|
||||
public boolean saveAppFeed(Feed feed, List<Attachment> attachments) {
|
||||
return true;
|
||||
return saveAppPost(feed2post(feed), attachments);
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -227,7 +228,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
@Deprecated
|
||||
@Override
|
||||
public boolean saveFeedToVRETimeline(String feedKey, String vreid) throws FeedIDNotFoundException {
|
||||
return true;
|
||||
return savePostToVRETimeline(feedKey, vreid);
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -245,7 +246,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
throws PrivacyLevelTypeNotFoundException,
|
||||
FeedTypeNotFoundException, FeedIDNotFoundException, ColumnNameNotFoundException {
|
||||
|
||||
return null;
|
||||
return post2feed(readPost(feedid));
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -265,8 +266,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
Date now = new Date();
|
||||
if (timeInMillis > now.getTime())
|
||||
throw new IllegalArgumentException("the timeInMillis must be before today");
|
||||
|
||||
return null;
|
||||
List<Post> posts = getRecentPostsByUserAndDate(userid, timeInMillis);
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
return feeds;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -285,7 +290,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
@Deprecated
|
||||
@Override
|
||||
public boolean deleteFeed(String feedId) throws FeedIDNotFoundException, PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException {
|
||||
return true;
|
||||
return deletePost(feedId);
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -300,7 +305,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
@Deprecated
|
||||
@Override
|
||||
public List<Feed> getAllFeedsByUser(String userid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException {
|
||||
return null;
|
||||
List<Post> posts = getAllPostsByUser(userid);
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
return feeds;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -314,7 +324,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
*/
|
||||
@Override
|
||||
public List<Feed> getAllFeedsByApp(String appid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException {
|
||||
return null;
|
||||
List<Post> posts = getAllPostsByApp(appid);
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
return feeds;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -331,7 +346,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
@Override
|
||||
public List<Feed> getRecentCommentedFeedsByUserAndDate(String userid,
|
||||
long timeInMillis) throws Exception {
|
||||
return null;
|
||||
List<Post> posts = getRecentCommentedPostsByUserAndDate(userid, timeInMillis);
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
return feeds;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -348,7 +368,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
@Deprecated
|
||||
@Override
|
||||
public List<Feed> getAllPortalPrivacyLevelFeeds() throws FeedTypeNotFoundException, ColumnNameNotFoundException, PrivacyLevelTypeNotFoundException {
|
||||
return null;
|
||||
List<Post> posts = getAllPortalPrivacyLevelPosts();
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
return feeds;
|
||||
}
|
||||
@Override
|
||||
public List<Post> getAllPortalPrivacyLevelPosts() throws FeedTypeNotFoundException, ColumnNameNotFoundException, PrivacyLevelTypeNotFoundException {
|
||||
|
@ -360,7 +385,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
@Override
|
||||
@Deprecated
|
||||
public List<Feed> getRecentFeedsByUser(String userid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException {
|
||||
return null;
|
||||
List<Post> posts = getRecentPostsByUser(userid, quantity);
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
return feeds;
|
||||
}
|
||||
@Override
|
||||
public List<Post> getRecentPostsByUser(String userid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException {
|
||||
|
@ -372,7 +402,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
@Override
|
||||
@Deprecated
|
||||
public List<Feed> getAllFeedsByVRE(String vreid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException {
|
||||
return null;
|
||||
List<Post> posts = getAllPostsByVRE(vreid);
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
return feeds;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -387,7 +422,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
@Deprecated
|
||||
@Override
|
||||
public List<Feed> getRecentFeedsByVRE(String vreid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException {
|
||||
return null;
|
||||
List<Post> posts = getRecentPostsByVRE(vreid, quantity);
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
return feeds;
|
||||
}
|
||||
@Override
|
||||
public List<Post> getRecentPostsByVRE(String vreid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException {
|
||||
|
@ -398,7 +438,14 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
*/
|
||||
@Override
|
||||
public RangeFeeds getRecentFeedsByVREAndRange(String vreid, int from, int quantity) throws IllegalArgumentException, PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException {
|
||||
return null;
|
||||
RangePosts rangePosts = getRecentPostsByVREAndRange(vreid, from, quantity);
|
||||
List<Post> posts = rangePosts.getPosts();
|
||||
ArrayList<Feed> feeds = new ArrayList<>();
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
RangeFeeds rangeFeeds = new RangeFeeds(rangePosts.getLastReturnedPostTimelineIndex(), feeds);
|
||||
return rangeFeeds;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
|
Loading…
Reference in New Issue