set the vreId when the update is sent within a VRE scope

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@92881 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-03-10 15:47:26 +00:00
parent 3cf049fae6
commit 65822d43ec
6 changed files with 29 additions and 16 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/share-updates-1.1.3-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/share-updates-1.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -31,5 +31,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/share-updates-1.1.3-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/share-updates-1.2.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

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

View File

@ -4,6 +4,9 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<dependent-module archiveName="fileupload-progress-bar-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/fileupload-progress-bar/fileupload-progress-bar">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="share-updates"/>
</wb-module>

View File

@ -13,7 +13,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>share-updates</artifactId>
<packaging>war</packaging>
<version>1.1.3-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
<name>gCube Share Updates Portlet</name>
<description>

View File

@ -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<String> imagesUrl = new ArrayList<String>();
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

View File

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