Fix for attachments handling

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@122336 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-01-20 09:36:24 +00:00
parent 74ba3b3d6f
commit 636c42d7aa
1 changed files with 9 additions and 8 deletions

View File

@ -124,7 +124,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
}
public String getDevelopmentUser() {
String user = TEST_USER;
// user = "costantino.perciante";
// user = "costantino.perciante";
return user;
}
/**
@ -313,7 +313,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
}
}
// Managing attachments: the first one (if any) will use the same fields of a link preview.
// Managing attachments: the first one will use the same fields of a link preview.
// If more than one attachments are present, they will be saved as Attachment objects.
// In this way we can handle retro-compatibility.
@ -327,7 +327,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
if(uploadedFiles.size() > 0){
// retrieve the first element
// retrieve the first element (and remove it)
UploadedFile firstAttachment = uploadedFiles.get(0);
firstAttachmentName = firstAttachment.getFileName();
@ -338,20 +338,22 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
firstAttachment.getThumbnailUrl() != null ?
firstAttachment.getThumbnailUrl() : firstAttachmenturlThumbnail;
// check if there are more files
if(uploadedFiles.size() > 1){
attachments = new ArrayList<>();
// check if there are more files
for (UploadedFile file : uploadedFiles) {
for (int i = 1; i < uploadedFiles.size(); i++){
UploadedFile file = uploadedFiles.get(i);
attachments.add(new Attachment(
UUID.randomUUID().toString(),
file.getDownloadUrl(),
file.getFileName(),
file.getDescription(),
file.getThumbnailUrl(),
file.getThumbnailUrl() == null ? "null" : file.getThumbnailUrl(),
file.getFormat())
);
);
}
}
@ -366,7 +368,6 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
textToPost = TextTransfromUtils.convertFileNameAnchorHTML(textToPost);
} else {
textToPost = escapedFeedText;
//System.out.println("textToPost=" + textToPost);
}
//get the VRE scope if single channel post