debug getRecentPosts

This commit is contained in:
Ahmed Salah Tawfik Ibrahim 2023-12-04 15:02:02 +01:00
parent 4ec40fb58c
commit bbd8172df6
1 changed files with 44 additions and 8 deletions

View File

@ -122,18 +122,52 @@ 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());
Post post = new Post();
if (feed.getKey()!=null)post.setKey(feed.getKey());
if (feed.getType()!=null)post.setType(PostType.valueOf(feed.getType().toString()));
if (feed.getEntityId()!=null)post.setEntityId(feed.getEntityId());
if (feed.getTime()!=null)post.setTime(feed.getTime());
if (feed.getVreid()!=null)post.setVreid(feed.getVreid());
if (feed.getUri()!=null)post.setUri(feed.getUri());
if (feed.getUriThumbnail()!=null)post.setUriThumbnail(feed.getUriThumbnail());
if (feed.getDescription()!=null)post.setDescription(feed.getDescription());
if (feed.getPrivacy()!=null)post.setPrivacy(feed.getPrivacy());
if (feed.getFullName()!=null)post.setFullName(feed.getFullName());
if (feed.getEmail()!=null)post.setEmail(feed.getEmail());
if (feed.getThumbnailURL()!=null)post.setThumbnailURL(feed.getThumbnailURL());
if (feed.getCommentsNo()!=null)post.setCommentsNo(feed.getCommentsNo());
if (feed.getLikesNo()!=null)post.setLikesNo(feed.getLikesNo());
if (feed.getLinkTitle()!=null)post.setLinkTitle(feed.getLinkTitle());
if (feed.getLinkDescription()!=null)post.setLinkDescription(feed.getLinkDescription());
if (feed.getLinkHost()!=null)post.setLinkHost(feed.getLinkHost());
post.setApplicationFeed(feed.isApplicationFeed());
post.setMultiFileUpload(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());
Feed feed = new Feed();
if (post.getKey()!=null)feed.setKey(post.getKey());
if (post.getType()!=null)feed.setType(FeedType.valueOf(post.getType().toString()));
if (post.getEntityId()!=null)feed.setEntityId(post.getEntityId());
if (post.getTime()!=null)feed.setTime(post.getTime());
if (post.getVreid()!=null)feed.setVreid(post.getVreid());
if (post.getUri()!=null)feed.setUri(post.getUri());
if (post.getUriThumbnail()!=null)feed.setUriThumbnail(post.getUriThumbnail());
if (post.getDescription()!=null)feed.setDescription(post.getDescription());
if (post.getPrivacy()!=null)feed.setPrivacy(post.getPrivacy());
if (post.getFullName()!=null)feed.setFullName(post.getFullName());
if (post.getEmail()!=null)feed.setEmail(post.getEmail());
if (post.getThumbnailURL()!=null)feed.setThumbnailURL(post.getThumbnailURL());
if (post.getCommentsNo()!=null)feed.setCommentsNo(post.getCommentsNo());
if (post.getLikesNo()!=null)feed.setLikesNo(post.getLikesNo());
if (post.getLinkTitle()!=null)feed.setLinkTitle(post.getLinkTitle());
if (post.getLinkDescription()!=null)feed.setLinkDescription(post.getLinkDescription());
if (post.getLinkHost()!=null)feed.setLinkHost(post.getLinkHost());
feed.setApplicationFeed(post.isApplicationFeed());
feed.setMultiFileUpload(post.isMultiFileUpload());
return feed;
}
/**
@ -242,8 +276,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
if (timeInMillis > now.getTime())
throw new IllegalArgumentException("the timeInMillis must be before today");
List<Post> posts = getRecentPostsByUserAndDate(userid, timeInMillis);
_log.info("Length of posts is " + posts.size());
List<Feed> feeds = new ArrayList<>();
for(Post post: posts){
_log.info(post.toString());
feeds.add(post2feed(post));
}
return feeds;