refs:4381: org.gcube.portlets.user.tabular-data-toolbox-widget.1-11-0

https://support.d4science.org/issues/4381

Updated to Liferay 6.2

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@129374 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-06-23 14:57:54 +00:00
parent fbd394f4e2
commit caad9e3c97
6 changed files with 500 additions and 203 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/tabular-data-gwt-service-2.10.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/tabular-data-gwt-service-2.10.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -33,5 +33,5 @@
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/tabular-data-gwt-service-2.10.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/tabular-data-gwt-service-2.12.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -1,4 +1,7 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets-user.tabular-data-gwt-service.2-12-0" date="2016-07-15">
<Change>Updated to Liferay 6.2</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.tabular-data-gwt-service.2-11-0" date="2016-05-01">
<Change>Fixed ASLSession</Change>
</Changeset>

154
pom.xml
View File

@ -14,7 +14,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>tabular-data-gwt-service</artifactId>
<version>2.11.0-SNAPSHOT</version>
<version>2.12.0-SNAPSHOT</version>
<name>tabular-data-gwt-service</name>
<description>tabular-data-gwt-service allows communication between the GUI and services</description>
@ -95,12 +95,54 @@
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
</dependency>
<!-- PORTAL -->
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<scope>compile</scope>
</dependency>
<!-- <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId>
<version>1.0.0.GA</version> <scope>test</scope> </dependency> <dependency>
<groupId>javax.validation</groupId> <artifactId>validation-api</artifactId>
<version>1.0.0.GA</version> <classifier>sources</classifier> <scope>test</scope>
</dependency> -->
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>custom-portal-handler</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslcore</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId>
<scope>provided</scope>
</dependency>
<!-- Authorization -->
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-authorization</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId>
<scope>provided</scope>
</dependency>
<!-- GCube Widgets -->
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-widgets</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
@ -112,33 +154,10 @@
<groupId>org.gcube.data.publishing</groupId>
<artifactId>sdmx-registry-client-gcube</artifactId>
<version>[3.0.0-SNAPSHOT,4.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslcore</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>custom-portal-handler</artifactId>
<scope>provided</scope>
</dependency>
</dependency>
<!-- Authorization
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-authorization</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId>
<scope>provided</scope>
</dependency> -->
<!-- Social -->
<dependency>
@ -154,12 +173,6 @@
</dependency>
<!-- Home Library -->
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library</artifactId>
<scope>provided</scope>
</dependency>
<!-- Apache Common Library -->
<dependency>
@ -184,6 +197,53 @@
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<!-- Social -->
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslsocial</artifactId>
<scope>provided</scope>
</dependency>
<!-- Storage -->
<dependency>
<groupId>org.gcube.contentmanagement</groupId>
<artifactId>storage-manager-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.contentmanagement</groupId>
<artifactId>storage-manager-wrapper</artifactId>
<scope>provided</scope>
</dependency>
<!-- Home Library -->
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library-jcr</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library-model</artifactId>
<scope>provided</scope>
</dependency>
<!-- Service Client -->
<dependency>
<groupId>org.gcube.data.analysis.tabulardata</groupId>
@ -191,17 +251,7 @@
<version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<!-- Storage for CSV temp -->
<dependency>
<groupId>org.gcube.contentmanagement</groupId>
<artifactId>storage-manager-core</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.contentmanagement</groupId>
<artifactId>storage-manager-wrapper</artifactId>
</dependency>
<!-- Uri Resolver Manager -->
<dependency>
@ -224,10 +274,7 @@
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<!-- Tika <dependency> <groupId>org.apache.tika</groupId> <artifactId>tika-core</artifactId>
<version>1.7</version> </dependency> -->
<!-- LOGGING -->
<dependency>
@ -300,7 +347,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<descriptors>
<descriptor>${distroDirectory}/descriptor.xml</descriptor>

View File

@ -2,9 +2,13 @@ package org.gcube.portlets.user.td.gwtservice.server.social;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
import org.gcube.applicationsupportlayer.social.NotificationsManager;
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite;
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser;
import org.gcube.common.homelibrary.util.WorkspaceUtil;
import org.gcube.portal.databook.shared.NotificationType;
import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts;
@ -30,6 +34,9 @@ public class TDMNotifications extends Thread {
private ShareTabResource shareTabularResource;
private ShareRule shareRule;
private ShareTemplate shareTemplate;
private SocialNetworkingSite site;
private SocialNetworkingUser user;
private String scope;
/**
* Share Tabular Resource
@ -37,11 +44,16 @@ public class TDMNotifications extends Thread {
* @param aslSession
* @param shareTabularResource
*/
public TDMNotifications(ASLSession aslSession,
public TDMNotifications(HttpServletRequest request, ASLSession aslSession,
ShareTabResource shareTabularResource) {
this.aslSession = aslSession;
this.shareTabularResource = shareTabularResource;
this.notificationType = NotificationType.TDM_TAB_RESOURCE_SHARE;
site = new SocialNetworkingSite(request);
user = new SocialNetworkingUser(aslSession.getUsername(),
aslSession.getUserEmailAddress(), aslSession.getUserFullName(),
aslSession.getUserAvatarId());
scope = aslSession.getScope();
}
@ -50,10 +62,16 @@ public class TDMNotifications extends Thread {
* @param aslSession
* @param shareRule
*/
public TDMNotifications(ASLSession aslSession, ShareRule shareRule) {
public TDMNotifications(HttpServletRequest request, ASLSession aslSession,
ShareRule shareRule) {
this.aslSession = aslSession;
this.shareRule = shareRule;
this.notificationType = NotificationType.TDM_RULE_SHARE;
site = new SocialNetworkingSite(request);
user = new SocialNetworkingUser(aslSession.getUsername(),
aslSession.getUserEmailAddress(), aslSession.getUserFullName(),
aslSession.getUserAvatarId());
scope = aslSession.getScope();
}
@ -62,10 +80,16 @@ public class TDMNotifications extends Thread {
* @param aslSession
* @param shareTemplate
*/
public TDMNotifications(ASLSession aslSession, ShareTemplate shareTemplate) {
public TDMNotifications(HttpServletRequest request, ASLSession aslSession,
ShareTemplate shareTemplate) {
this.aslSession = aslSession;
this.shareTemplate = shareTemplate;
this.notificationType = NotificationType.TDM_TEMPLATE_SHARE;
site = new SocialNetworkingSite(request);
user = new SocialNetworkingUser(aslSession.getUsername(),
aslSession.getUserEmailAddress(), aslSession.getUserFullName(),
aslSession.getUserAvatarId());
scope = aslSession.getScope();
}
@ -87,8 +111,8 @@ public class TDMNotifications extends Thread {
}
private void tabularResourceNotify() {
NotificationsManager nm = new ApplicationNotificationsManager(
aslSession, Constants.APPLICATION_ID);
NotificationsManager nm = new ApplicationNotificationsManager(site,
scope, user, Constants.APPLICATION_ID);
for (Contacts contact : shareTabularResource.getContacts()) {
if (contact.isGroup()) {
@ -108,7 +132,8 @@ public class TDMNotifications extends Thread {
} catch (Exception e) {
logger.error("Error in the notification(Type: "
+ notificationType + " - "
+ notificationType
+ " - "
+ aslSession.getUsername()
+ " share tabular resource id="
+ shareTabularResource.getTabResource()
@ -137,7 +162,8 @@ public class TDMNotifications extends Thread {
} catch (Exception e) {
logger.error("Error in the notification(Type: "
+ notificationType + " - "
+ notificationType
+ " - "
+ aslSession.getUsername()
+ " share tabular resource id="
+ shareTabularResource.getTabResource().getTrId()
@ -151,8 +177,8 @@ public class TDMNotifications extends Thread {
}
private void ruleNotify() {
NotificationsManager nm = new ApplicationNotificationsManager(
aslSession, Constants.APPLICATION_ID);
NotificationsManager nm = new ApplicationNotificationsManager(site,
scope, user, Constants.APPLICATION_ID);
for (Contacts contact : shareRule.getContacts()) {
if (contact.isGroup()) {
@ -168,7 +194,8 @@ public class TDMNotifications extends Thread {
} catch (Exception e) {
logger.error("Error in the notification(Type: "
+ notificationType + " - "
+ notificationType
+ " - "
+ aslSession.getUsername()
+ " share rule id="
+ shareRule.getRuleDescriptionData()
@ -208,8 +235,8 @@ public class TDMNotifications extends Thread {
}
private void templateNotify() {
NotificationsManager nm = new ApplicationNotificationsManager(
aslSession, Constants.APPLICATION_ID);
NotificationsManager nm = new ApplicationNotificationsManager(site,
scope, user, Constants.APPLICATION_ID);
for (Contacts contact : shareTemplate.getContacts()) {
if (contact.isGroup()) {

View File

@ -15,7 +15,6 @@ import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
import org.gcube.common.homelibrary.util.WorkspaceUtil;
import org.gcube.contentmanagement.blobstorage.service.IClient;
import org.gcube.contentmanager.storageclient.model.protocol.smp.SMPUrl;
import org.gcube.contentmanager.storageclient.wrapper.AccessType;
import org.gcube.contentmanager.storageclient.wrapper.MemoryType;
import org.gcube.contentmanager.storageclient.wrapper.StorageClient;
@ -35,6 +34,12 @@ public class FilesStorage {
public static final Logger logger = LoggerFactory
.getLogger(FilesStorage.class);
/**
*
* @param user
* @param file
* @return
*/
public String storageCSVTempFile(String user, File file) {
try {
IClient client = new StorageClient(user, AccessType.PUBLIC,
@ -43,7 +48,6 @@ public class FilesStorage {
logger.debug("remotePath: " + remotePath);
String id = client.put(true).LFile(file.getAbsolutePath())
.RFile(remotePath);
// url = client.getUrl().RFile(remotePath);
return id;
} catch (Throwable e) {
@ -55,16 +59,20 @@ public class FilesStorage {
}
/**
*
* @param user
* @param file
* @return
*/
public String storageCodelistMappingTempFile(String user, File file) {
try {
// String url = null;
IClient client = new StorageClient(user, AccessType.PUBLIC,
MemoryType.VOLATILE).getClient();
String remotePath = "/CodelistMappingImport/" + file.getName();
logger.debug("remotePath: " + remotePath);
String id = client.put(true).LFile(file.getAbsolutePath())
.RFile(remotePath);
// url = client.getUrl().RFile(remotePath);
return id;
} catch (Throwable e) {
logger.error("Error no codelist mapping file loaded on storage"
@ -75,6 +83,13 @@ public class FilesStorage {
}
/**
*
* @param user
* @param url
* @return
* @throws TDGWTServiceException
*/
public String storageCodelistMappingTempFile(String user, String url)
throws TDGWTServiceException {
InputStream is = null;
@ -117,22 +132,20 @@ public class FilesStorage {
* Destination file
* @throws TDGWTServiceException
*/
public void retriveFile(String user, WorkspaceItem wi, File file)
public void retrieveFile(String user, WorkspaceItem wi, File file)
throws TDGWTServiceException {
InputStream is = null;
try {
org.gcube.common.homelibrary.home.workspace.folder.items.File gcubeItem = ((org.gcube.common.homelibrary.home.workspace.folder.items.File) wi);
SMPUrl smsHome = new SMPUrl(gcubeItem.getPublicLink());
/*
* Handler.activateProtocol(); URL smsHome = null; smsHome = new
* URL(gcubeItem.getPublicLink());
*/
logger.debug("smsHome: [host:" + smsHome.getHost() + " path:"
+ smsHome.getPath() + " ref:" + smsHome.getRef()
+ " userinfo:" + smsHome.getUserInfo() + " ]");
//SMPUrl smsHome = new SMPUrl(gcubeItem.getPublicLink());
URL url=new URL(gcubeItem.getPublicLink());
logger.debug("smsHome: [host:" + url.getHost() + " path:"
+ url.getPath() + " ref:" + url.getRef()
+ " userinfo:" + url.getUserInfo() + " ]");
URLConnection uc = null;
uc = (URLConnection) smsHome.openConnection();
uc = (URLConnection) url.openConnection();
is = uc.getInputStream();
} catch (Exception e) {
@ -174,28 +187,21 @@ public class FilesStorage {
* @return InputStream back to read the file
* @throws TDGWTServiceException
*/
public InputStream retriveInputStream(String user, WorkspaceItem wi)
public InputStream retrieveInputStream(String user, WorkspaceItem wi)
throws TDGWTServiceException {
InputStream is = null;
try {
org.gcube.common.homelibrary.home.workspace.folder.items.File gcubeItem = ((org.gcube.common.homelibrary.home.workspace.folder.items.File) wi);
SMPUrl smsHome = new SMPUrl(gcubeItem.getPublicLink());
//SMPUrl smsHome = new SMPUrl(gcubeItem.getPublicLink());
URL url=new URL(gcubeItem.getPublicLink());
/*
* Handler.activateProtocol(); URL smsHome = null; smsHome = new
* URL(null, gcubeItem.getPublicLink(), new URLStreamHandler() {
*
* @Override protected URLConnection openConnection(URL u) throws
* IOException { return new SMPURLConnection(u); }
*
* });
*/
logger.debug("smsHome: [host:" + smsHome.getHost() + " path:"
+ smsHome.getPath() + " ref:" + smsHome.getRef()
+ " userinfo:" + smsHome.getUserInfo() + " ]");
logger.debug("smsHome: [host:" + url.getHost() + " path:"
+ url.getPath() + " ref:" + url.getRef()
+ " userinfo:" + url.getUserInfo() + " ]");
URLConnection uc = null;
uc = (URLConnection) smsHome.openConnection();
uc = (URLConnection) url.openConnection();
is = uc.getInputStream();
} catch (Exception e) {
@ -224,22 +230,14 @@ public class FilesStorage {
InputStream is = null;
try {
SMPUrl smsHome = new SMPUrl(uri);
/*
* Handler.activateProtocol(); URL smsHome = null; smsHome = new
* URL(null, uri, new URLStreamHandler() {
*
* @Override protected URLConnection openConnection(URL u) throws
* IOException { return new SMPURLConnection(u); }
*
* });
*/
logger.debug("smsHome: [host:" + smsHome.getHost() + " path:"
+ smsHome.getPath() + " ref:" + smsHome.getRef()
+ " userinfo:" + smsHome.getUserInfo() + " ]");
//SMPUrl smsHome = new SMPUrl(uri);
URL url=new URL(uri);
logger.debug("smsHome: [host:" + url.getHost() + " path:"
+ url.getPath() + " ref:" + url.getRef()
+ " userinfo:" + url.getUserInfo() + " ]");
URLConnection uc = null;
uc = (URLConnection) smsHome.openConnection();
uc = (URLConnection) url.openConnection();
is = uc.getInputStream();
} catch (Exception e) {
@ -269,24 +267,15 @@ public class FilesStorage {
InputStream is = null;
try {
SMPUrl smsHome = new SMPUrl(uri);
/*
* URL smsHome = new SMPUrl(); smsHome = new URL(null, uri, new
* URLStreamHandler() {
*
* @Override protected URLConnection openConnection(URL u) throws
* IOException { return new SMPURLConnection(u); }
*
* });
*/
logger.debug("smsHome: [host:" + smsHome.getHost() + " path:"
+ smsHome.getPath() + " ref:" + smsHome.getRef()
+ " userinfo:" + smsHome.getUserInfo() + " ]");
//SMPUrl smsHome = new SMPUrl(uri);
URL url=new URL(uri);
logger.debug("smsHome: [host:" + url.getHost() + " path:"
+ url.getPath() + " ref:" + url.getRef()
+ " userinfo:" + url.getUserInfo() + " ]");
URLConnection uc = null;
uc = (URLConnection) smsHome.openConnection();
uc = (URLConnection) url.openConnection();
is = uc.getInputStream();
Workspace ws = HomeLibrary.getUserWorkspace(user);
@ -338,8 +327,7 @@ public class FilesStorage {
+ ", uniqueName: " + uniqueName + ", description: "
+ item_description + ", mimetype: " + item_mimetype
+ ", StorageId: " + storageId + "]");
WorkspaceUtil.createExternalFile(folder, uniqueName,
item_description, item_mimetype, storageId);
WorkspaceUtil.createExternalFile(folder, uniqueName,item_description, item_mimetype, storageId);
} catch (Exception e) {
logger.error("Error creating item on workspace", e);