Attachments bug fixed

This commit is contained in:
Ahmed Salah Tawfik Ibrahim 2023-11-28 19:40:20 +01:00
parent 61723dcc11
commit b968a6f7dd
3 changed files with 33 additions and 4 deletions

View File

@ -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

View File

@ -654,6 +654,11 @@ public interface DatabookStore {
*/
List<Attachment> 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.

View File

@ -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<Attachment> 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 + "]" ;
}
}