diff --git a/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java b/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java index 08d5bf0..022f6d2 100644 --- a/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java +++ b/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java @@ -3546,11 +3546,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { return boundStatements; } /** - * @param feedId the feedId to which the attachment is attached - * @param toSave the instance to save - * @return true if the attachemnt entry is saved in the Attachments CF + * {@inheritDoc} */ - private boolean saveAttachmentEntry(String feedId, Attachment toSave) { + @Override + public boolean saveAttachmentEntry(String feedId, Attachment toSave) { // Inserting data CqlSession session = conn.getKeyspaceSession(); //an entry in the Attachment CF diff --git a/src/main/java/org/gcube/portal/databook/server/DatabookStore.java b/src/main/java/org/gcube/portal/databook/server/DatabookStore.java index 95af072..6235830 100644 --- a/src/main/java/org/gcube/portal/databook/server/DatabookStore.java +++ b/src/main/java/org/gcube/portal/databook/server/DatabookStore.java @@ -654,6 +654,11 @@ public interface DatabookStore { */ List getAttachmentsByFeedId(String feedId) throws FeedIDNotFoundException; + /** + * save an attachment + */ + boolean saveAttachmentEntry(String feedId, Attachment toSave); + /** * Retrieve all the ids of the vre * @return the set of ids of the vre available or empty list in case of errors. diff --git a/src/main/java/org/gcube/portal/databook/shared/PostWithAttachment.java b/src/main/java/org/gcube/portal/databook/shared/PostWithAttachment.java index 948dcc3..23a5850 100644 --- a/src/main/java/org/gcube/portal/databook/shared/PostWithAttachment.java +++ b/src/main/java/org/gcube/portal/databook/shared/PostWithAttachment.java @@ -3,6 +3,7 @@ package org.gcube.portal.databook.shared; import java.io.Serializable; import java.util.List; +@SuppressWarnings("serial") public class PostWithAttachment implements Serializable { private Post post; private List attachments; @@ -28,4 +29,28 @@ public class PostWithAttachment implements Serializable { public Post getPost() { return post; } + + public String toString() { + String postInfo = "Post [key=" + post.getKey() + ", type=" + post.getType() + ", entityId=" + post.getEntityId() + + ", time=" + post.getTime() + ", vreid=" + post.getVreid() + ", uri=" + post.getUri() + + ", uriThumbnail=" + post.getUriThumbnail() + ", description=" + + post.getDescription() + ", privacy=" + post.getPrivacy() + ", fullName=" + + post.getFullName() + ", email=" + post.getEmail() + ", thumbnailURL=" + + post.getThumbnailURL() + ", commentsNo=" + post.getCommentsNo() + ", likesNo=" + + post.getLikesNo() + ", linkTitle=" + post.getLinkTitle() + ", linkDescription=" + + post.getLinkDescription() + ", linkHost=" + post.getLinkHost() + + ", applicationFeed=" + post.isApplicationFeed() + + ", multiFileUpload=" + post.isMultiFileUpload() + "]"; + String attachmentInfo = "[Attachments: "; + for (Attachment attachment: attachments){ + attachmentInfo += "[Attachment [key=" + attachment.getId() + ", uri=" + attachment.getUri() + ", name=" + attachment.getName() + ", description=" + + attachment.getDescription() + ", thumbnailURL=" + attachment.getThumbnailURL() + + ", mimeType=" + attachment.getMimeType() + "]],"; + } + attachmentInfo = attachmentInfo.substring(0, attachmentInfo.length()-1); + attachmentInfo += "]"; + ; + + return "[" + postInfo + ", " + attachmentInfo + "]" ; + } }