diff --git a/.classpath b/.classpath index 72dcf7b..3762556 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + @@ -31,5 +31,5 @@ - + diff --git a/.settings/com.google.gdt.eclipse.core.prefs b/.settings/com.google.gdt.eclipse.core.prefs index c06311b..f4fc4f8 100644 --- a/.settings/com.google.gdt.eclipse.core.prefs +++ b/.settings/com.google.gdt.eclipse.core.prefs @@ -1,5 +1,5 @@ eclipse.preferences.version=1 jarsExcludedFromWebInfLib= -lastWarOutDir=/Users/massi/Documents/workspace/share-updates/target/share-updates-1.1.3-SNAPSHOT +lastWarOutDir=/Users/massi/Documents/workspace/share-updates/target/share-updates-1.2.0-SNAPSHOT warSrcDir=src/main/webapp warSrcDirIsOutput=false diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index fb4e233..dde9c8f 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -4,6 +4,9 @@ + + uses + diff --git a/pom.xml b/pom.xml index 909ee8f..7e5a4d2 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ org.gcube.portlets.user share-updates war - 1.1.3-SNAPSHOT + 1.2.0-SNAPSHOT gCube Share Updates Portlet diff --git a/src/main/java/org/gcube/portlets/user/shareupdates/server/FilePreviewer.java b/src/main/java/org/gcube/portlets/user/shareupdates/server/FilePreviewer.java index d28b2a9..ccf2b59 100644 --- a/src/main/java/org/gcube/portlets/user/shareupdates/server/FilePreviewer.java +++ b/src/main/java/org/gcube/portlets/user/shareupdates/server/FilePreviewer.java @@ -131,26 +131,34 @@ public class FilePreviewer { * @return * @throws Exception */ - protected static LinkPreview getImagePreview(String fileName, String path2Image, String httpUrl, String mimeType) throws Exception { + protected static LinkPreview getImagePreview(String fileName, String path2Image, String httpUrl, String mimeType) { ArrayList imagesUrl = new ArrayList(); - Dimension dim = extractDimension(path2Image); - //description - String desc = ((int) dim.getWidth()) + "x" + ((int) dim.getHeight()) + " pixels"; + Dimension dim; + ByteArrayOutputStream out = null; + String desc = ""; + try { + dim = extractDimension(path2Image); - ByteArrayOutputStream out = new ByteArrayOutputStream(); + //description + desc = ((int) dim.getWidth()) + "x" + ((int) dim.getHeight()) + " pixels"; - Thumbnails.of(path2Image) - .width(80) - .outputFormat("jpg") - .toOutputStream(out); + out = new ByteArrayOutputStream(); + Thumbnails.of(path2Image) + .width(80) + .outputFormat("jpg") + .toOutputStream(out); + } + catch (IOException e) { + e.printStackTrace(); + } String httpLink = getFTPManager().uploadImageOnFTPServer(new ByteArrayInputStream(out.toByteArray()), ImageType.JPG); _log.debug("\nFlushed, Image thumbnail available at: " + httpLink); imagesUrl.add(httpLink); return new LinkPreview(fileName, desc, httpUrl, mimeType, imagesUrl); } - + /** * * @param fileName thename of the file diff --git a/src/main/java/org/gcube/portlets/user/shareupdates/server/ShareUpdateServiceImpl.java b/src/main/java/org/gcube/portlets/user/shareupdates/server/ShareUpdateServiceImpl.java index 00e9fad..39169c8 100644 --- a/src/main/java/org/gcube/portlets/user/shareupdates/server/ShareUpdateServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/shareupdates/server/ShareUpdateServiceImpl.java @@ -190,10 +190,12 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar } else { textToPost = transformUrls(escapedFeedText); } - + + ScopeBean scope = new ScopeBean(session.getScope()); + String vreId2Set = scope.is(Type.VRE) ? scope.toString() : ""; Feed toShare = new Feed(UUID.randomUUID().toString(), feedType, username, feedDate, - "", url, urlThumbnail, textToPost, pLevel, fullName, email, thumbnailURL, linkTitle, linkDesc, host); + vreId2Set, url, urlThumbnail, textToPost, pLevel, fullName, email, thumbnailURL, linkTitle, linkDesc, host); _log.trace("Attempting to save Feed with text: " + escapedFeedText + " Level: " + pLevel);