Merge pull request 'task_21969' (!1) from task_21969 into master

Reviewed-on: #1
This commit is contained in:
Francesco Mangiacrapa 2021-11-03 11:22:51 +01:00
commit 3fada24dbf
9 changed files with 1295 additions and 720 deletions

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="lib" path="/home/francesco-mangiacrapa/libraries/asm-5.0.3/lib/asm-5.0.3.jar"/> <classpathentry kind="lib" path="/home/francesco-mangiacrapa/libraries/asm-5.0.3/lib/asm-5.0.3.jar"/>
<classpathentry kind="src" output="target/species-discovery-3.10.0/WEB-INF/classes" path="src/main/java"> <classpathentry kind="src" output="target/species-discovery-3.11.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/species-discovery-3.10.0/WEB-INF/classes" path="src/main/resources"> <classpathentry excluding="**" kind="src" output="target/species-discovery-3.11.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
@ -41,5 +41,5 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/species-discovery-3.10.0/WEB-INF/classes"/> <classpathentry kind="output" path="target/species-discovery-3.11.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -1,4 +1,4 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
lastWarOutDir=/home/francesco/git/species-discovery/target/species-discovery-3.10.0 lastWarOutDir=/home/francescomangiacrapa/git/species-discovery/target/species-discovery-3.11.0-SNAPSHOT
warSrcDir=src/main/webapp warSrcDir=src/main/webapp
warSrcDirIsOutput=false warSrcDirIsOutput=false

View File

@ -1,10 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="species-discovery-3.10.0">
<wb-module deploy-name="species-discovery-3.11.0-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<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="/" 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="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="species-discovery"/> <property name="context-root" value="species-discovery"/>
</wb-module>
</wb-module>
</project-modules> </project-modules>

View File

@ -3,37 +3,40 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v3-10-0] [r4-23-0] - 2020-05-22 ## [v3.11.0-SNAPSHOT] - 27-10-2021
[#19221] Ported to git/jenkins - [#21969] Removed HL dependency
- Ported to maven-portal-bom v3.6.3
- Ported to workspace-explorer v2.X.Y
- Ported to geonetwork [3.4.5,4.0.0-SNAPSHOT)
- Ported to storagehub-client-wrapper [1.0.0, 2.0.0-SNAPSHOT)
- Ported to spd-client-library [4.1.0-SNAPSHOT, 5.0.0-SNAPSHOT)
**Fixes** ## [v3.10.0] - 22-05-2020
[#19312] the WorkspaceExplorer window appears behind the Job Window (z-index issue) - [#19221] Migrateto git/jenkins
#### Fixes
- [#19312] the WorkspaceExplorer window appears behind the Job Window (z-index issue)
## [v3.9.1] - 20-03-2017
## [3-9-1] - [20-03-2017]
[Bug #7568] Managed ASL session expiration during polling on SPD jobs [Bug #7568] Managed ASL session expiration during polling on SPD jobs
## [v3.9.0] - 11-01-2016
## [3-9-0] - [11-01-2016]
[Feature #6313] SPD portlet upgrade: porting to spd-client-library 4.0.0 [Feature #6313] SPD portlet upgrade: porting to spd-client-library 4.0.0
[Task #7001] Create Gis Layer via job [Task #7001] Create Gis Layer via job
## [v3.8.1] - 15-09-2016
## [3-8-1] - [15-09-2016]
Removed Gis -viewer dependency Removed Gis -viewer dependency
## [v3.8.0] - 15-05-2015
## [3-8-0] - [15-05-2015]
Upgraded to gwt 2.6.1 Upgraded to gwt 2.6.1
@ -42,86 +45,73 @@ Integrated with Workspace Explorer
Updated to Liferay 6.2 Updated to Liferay 6.2
## [v3.7.2] - 15-05-2015
## [3-7-2] - [15-05-2015]
Changed dateformat at dd-MM-yyyy Changed dateformat at dd-MM-yyyy
## [v3.7.1] - 09-12-2014
## [3-7-1] - [09-12-2014]
Removed openlayers dependency from pom Removed openlayers dependency from pom
## [v3.7.0] - 04-06-2014
## [3-7-0] - [04-06-2014]
Updated pom to support new portal configuration (gcube release 3.2) Updated pom to support new portal configuration (gcube release 3.2)
## [v3.6.0] - 23-04-2014
## [3-6-0] - [23-04-2014]
Portlet updated to support service updating Portlet updated to support service updating
## [v3.5.0] - 24-10-2013
## [3-5-0] - [24-10-2013]
Portlet updated to support GWT 2.5.1 Portlet updated to support GWT 2.5.1
Ticket 2224: was implemented Ticket 2224: was implemented
## [v3.4.0] - 06-09-2013
## [3-4-0] - [06-09-2013]
Enhancements on GUI of SPD portlet was realized (view last query, new expand button are available) Enhancements on GUI of SPD portlet was realized (view last query, new expand button are available)
The functionalities was updated in order to fit the changes in the service client. New advanced options are now available: "Expand with synonyms", "Unfold the taxa group by". The functionalities was updated in order to fit the changes in the service client. New advanced options are now available: "Expand with synonyms", "Unfold the taxa group by".
## [v3.3.0] - 09-07-2013
## [3-3-0] - [09-07-2013]
Bug Fixed: on species classification Bug Fixed: on species classification
## [v3.2.0] - 29-05-2013
## [3-2-0] - [29-05-2013]
Bug Fixed: #612 (SPD: Error when saving csv file in workspace) Bug Fixed: #612 (SPD: Error when saving csv file in workspace)
## [v3.1.0] - 14-04-2013
## [3-1-0] - [14-04-2013]
Synch with SPD service changes Synch with SPD service changes
## [v3.0.0] - 05-03-2013
## [3-0-0] - [05-03-2013]
Ticket #1260: This component has been mavenized Ticket #1260: This component has been mavenized
## [v2.3.0] - 17-01-2013
## [2-3-0] - [17-01-2013]
Ticket #986: Species Occurrence jobs / Re-submit job and "info" Ticket #986: Species Occurrence jobs / Re-submit job and "info"
Ticket #1002: SPD portlet persistence refactoring Ticket #1002: SPD portlet persistence refactoring
## [v2.2.0] - 30-11-2012
## [2-2-0] - [30-11-2012]
Ticket #508: Implementation of requirements resulting from ticket #508 Ticket #508: Implementation of requirements resulting from ticket #508
## [v2.0.0] - 13-09-2012
## [2-0-0] - [13-09-2012]
Ticket #81: Implementation of requirements resulting from user feedback Ticket #81: Implementation of requirements resulting from user feedback
@ -130,15 +120,11 @@ Dynamic clustering of result set items
Revised the occurrence points visualization strategy through the GIS Viewer Revised the occurrence points visualization strategy through the GIS Viewer
## [v1.0.1] - 23-07-2012
## [1-0-1] - [23-07-2012]
Fixed 447: Map generation fails in Species Discovery Portlet Fixed 447: Map generation fails in Species Discovery Portlet
## [v1.0.0] - 04-05-2012
## [1-0-0] - [04-05-2012]
First release First release

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.google.gwt.eclipse.core.launch.gwtJUnit">
<stringAttribute key="com.google.gwt.eclipse.core.LOG_LEVEL" value="INFO"/>
<booleanAttribute key="com.google.gwt.eclipse.core.NOT_HEADLESS" value="false"/>
<stringAttribute key="com.google.gwt.eclipse.core.OUT_DIR" value="www-test"/>
<booleanAttribute key="com.google.gwt.eclipse.core.STANDARDS_MODE" value="false"/>
<stringAttribute key="com.google.gwt.eclipse.core.STYLE" value="OBFUSCATED"/>
<stringAttribute key="com.google.gwt.eclipse.core.WEB_MODE" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/speciesdiscovery/src/test/java/org/gcube/portlets/user/speciesdiscovery/client/GwtTestSpeciesDiscovery.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.gcube.portlets.user.speciesdiscovery.client.GwtTestSpeciesDiscovery"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="speciesdiscovery"/>
</launchConfiguration>

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.google.gwt.eclipse.core.launch.gwtJUnit">
<stringAttribute key="com.google.gwt.eclipse.core.LOG_LEVEL" value="INFO"/>
<booleanAttribute key="com.google.gwt.eclipse.core.NOT_HEADLESS" value="false"/>
<stringAttribute key="com.google.gwt.eclipse.core.OUT_DIR" value="www-test"/>
<booleanAttribute key="com.google.gwt.eclipse.core.STANDARDS_MODE" value="false"/>
<stringAttribute key="com.google.gwt.eclipse.core.STYLE" value="OBFUSCATED"/>
<stringAttribute key="com.google.gwt.eclipse.core.WEB_MODE" value="true"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/speciesdiscovery/src/test/java/org/gcube/portlets/user/speciesdiscovery/client/GwtTestSpeciesDiscovery.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.gcube.portlets.user.speciesdiscovery.client.GwtTestSpeciesDiscovery"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="speciesdiscovery"/>
</launchConfiguration>

47
pom.xml
View File

@ -14,14 +14,14 @@
<repositories> <repositories>
<repository> <repository>
<id>eclipselink</id> <id>eclipselink</id>
<url>http://maven.research-infrastructures.eu:8081/nexus/content/repositories/eclipselink/</url> <url>https://maven.research-infrastructures.eu/nexus/content/repositories/eclipselink/</url>
</repository> </repository>
</repositories> </repositories>
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>species-discovery</artifactId> <artifactId>species-discovery</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>3.10.0</version> <version>3.11.0-SNAPSHOT</version>
<name>gCube Species Discovery</name> <name>gCube Species Discovery</name>
<description> <description>
gCube Species Discovery Portlet lets the users discovery species information from the Species Service gCube Species Discovery Portlet lets the users discovery species information from the Species Service
@ -51,7 +51,7 @@
<dependency> <dependency>
<groupId>org.gcube.distribution</groupId> <groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId> <artifactId>maven-portal-bom</artifactId>
<version>3.6.0</version> <version>3.6.3</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
@ -94,7 +94,7 @@
<dependency> <dependency>
<groupId>org.gcube.data.spd</groupId> <groupId>org.gcube.data.spd</groupId>
<artifactId>spd-client-library</artifactId> <artifactId>spd-client-library</artifactId>
<version>[4.0.0, 5.0.0-SNAPSHOT)</version> <version>[4.1.0-SNAPSHOT, 5.0.0-SNAPSHOT)</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
@ -170,7 +170,7 @@
<dependency> <dependency>
<groupId>org.gcube.portlets.widgets</groupId> <groupId>org.gcube.portlets.widgets</groupId>
<artifactId>workspace-explorer</artifactId> <artifactId>workspace-explorer</artifactId>
<version>[1.0.0, 2.0.0-SNAPSHOT)</version> <version>[2.0.0, 3.0.0-SNAPSHOT)</version>
<scope>compile</scope> <scope>compile</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>
@ -190,7 +190,7 @@
<dependency> <dependency>
<groupId>org.gcube.spatial.data</groupId> <groupId>org.gcube.spatial.data</groupId>
<artifactId>geonetwork</artifactId> <artifactId>geonetwork</artifactId>
<version>[3.0.0,4.0.0-SNAPSHOT)</version> <version>[3.4.5,4.0.0-SNAPSHOT)</version>
</dependency> </dependency>
<!-- GWT-LOG --> <!-- GWT-LOG -->
@ -245,6 +245,7 @@
<artifactId>aslcore</artifactId> <artifactId>aslcore</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.portal</groupId> <groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId> <artifactId>social-networking-library</artifactId>
@ -252,15 +253,29 @@
</dependency> </dependency>
<!-- HOME LIBRARY --> <!-- HOME LIBRARY -->
<!-- <dependency> -->
<!-- <groupId>org.gcube.common</groupId> -->
<!-- <artifactId>home-library-jcr</artifactId> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>org.gcube.common</groupId> -->
<!-- <artifactId>home-library</artifactId> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<!-- PORTAL MANAGER -->
<dependency> <dependency>
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common.portal</groupId>
<artifactId>home-library-jcr</artifactId> <artifactId>portal-manager</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>
<artifactId>home-library</artifactId> <artifactId>storagehub-client-wrapper</artifactId>
<scope>provided</scope> <version>[1.0.0, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -280,22 +295,18 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- LOGGER --> <!-- LOGGER -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId> <artifactId>slf4j-log4j12</artifactId>
<scope>runtime</scope> <!-- <version>1.6.4</version> -->
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<scope>runtime</scope> <!-- <version>1.6.4</version> -->
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -3,33 +3,99 @@
*/ */
package org.gcube.portlets.user.speciesdiscovery.server.util; package org.gcube.portlets.user.speciesdiscovery.server.util;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.gcube.application.framework.core.session.ASLSession; import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.common.homelibrary.home.HomeLibrary; import org.gcube.common.portal.PortalContext;
import org.gcube.common.homelibrary.home.workspace.Workspace; import org.gcube.common.storagehubwrapper.server.StorageHubWrapper;
import org.gcube.common.storagehubwrapper.server.tohl.Workspace;
import com.liferay.portal.service.UserLocalServiceUtil;
/** /**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * The Class GetWorkspaceUtil.
* @Oct 7, 2013
* *
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 27, 2021
*/ */
public class GetWorkspaceUtil { public class GetWorkspaceUtil {
protected static Logger logger = Logger.getLogger(GetWorkspaceUtil.class); protected static Logger logger = Logger.getLogger(GetWorkspaceUtil.class);
public static Workspace getWorskspace(ASLSession session) throws Exception { /**
* Gets the workspace.
*
* @param request the request
* @param session the session
* @return the workspace
* @throws Exception the exception
*/
public static Workspace getWorkspace(final HttpServletRequest request, ASLSession session) throws Exception {
if(session==null) if (session == null)
throw new Exception("ASL session is null"); throw new Exception("ASL session is null");
if(session.getScope()==null) if (session.getScope() == null)
throw new Exception("Scope into ASL session is null"); throw new Exception("Scope into ASL session is null");
String scope = session.getScope().toString(); String scope = session.getScope().toString();
//logger.trace("Get workspace for scope "+scope); // logger.trace("Get workspace for scope "+scope);
//ScopeProvider.instance.set(scope); // ScopeProvider.instance.set(scope);
//logger.trace("ScopeProvider instancied for scope "+scope); // logger.trace("ScopeProvider instancied for scope "+scope);
logger.trace("retuning workspace for username "+session.getUsername()); logger.trace("retuning workspace for username " + session.getUsername());
return HomeLibrary.getUserWorkspace(session.getUsername()); return getStorageHubWrapper(request, null, session.getUsername()).getWorkspace();
} }
/**
* Checks if is within portal.
*
* @return true if you're running into the portal, false if in development
*/
public static boolean isWithinPortal() {
try {
UserLocalServiceUtil.getService();
return true;
} catch (Exception ex) {
logger.trace("Development Mode ON");
return false;
}
}
/**
* Gets the storage hub wrapper.
*
* @param request the request
* @param scopeGroupId the scope group id. If scopeGroupId is null the scope is
* read by using the request else by using the scopeGroupId
* @param username the username
* @return the storage hub wrapper
* @throws Exception the exception
*/
public static StorageHubWrapper getStorageHubWrapper(final HttpServletRequest request, String scopeGroupId,
String username) throws Exception {
if (username == null || username.isEmpty())
throw new Exception("Session expired");
try {
String scope;
PortalContext pContext = PortalContext.getConfiguration();
if (isWithinPortal() && scopeGroupId != null) {
scope = pContext.getCurrentScope(scopeGroupId);
logger.debug(scope + " has retrieved by using the scopeGroupId=" + scopeGroupId);
} else
scope = pContext.getCurrentScope(request);
logger.debug("Getting " + StorageHubWrapper.class.getSimpleName() + " for user: " + username
+ " by using the scope: " + scope);
String token = pContext.getCurrentUserToken(scope, username);
return new StorageHubWrapper(scope, token, false, false, true);
} catch (Exception e) {
logger.error("Error during getting storageHub wrapper", e);
throw new Exception("Error on gettig the StorageHub wrapper for userId: " + username);
}
}
} }