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"?>
<classpath>
<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>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</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>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -41,5 +41,5 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</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>

View File

@ -1,4 +1,4 @@
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
warSrcDirIsOutput=false

View File

@ -1,10 +1,19 @@
<?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="/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"/>
<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"/>
</wb-module>
</wb-module>
</project-modules>

View File

@ -3,37 +3,40 @@
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).
## [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)
## [3-9-1] - [20-03-2017]
## [v3.9.1] - 20-03-2017
[Bug #7568] Managed ASL session expiration during polling on SPD jobs
## [3-9-0] - [11-01-2016]
## [v3.9.0] - 11-01-2016
[Feature #6313] SPD portlet upgrade: porting to spd-client-library 4.0.0
[Task #7001] Create Gis Layer via job
## [3-8-1] - [15-09-2016]
## [v3.8.1] - 15-09-2016
Removed Gis -viewer dependency
## [3-8-0] - [15-05-2015]
## [v3.8.0] - 15-05-2015
Upgraded to gwt 2.6.1
@ -42,86 +45,73 @@ Integrated with Workspace Explorer
Updated to Liferay 6.2
## [3-7-2] - [15-05-2015]
## [v3.7.2] - 15-05-2015
Changed dateformat at dd-MM-yyyy
## [3-7-1] - [09-12-2014]
## [v3.7.1] - 09-12-2014
Removed openlayers dependency from pom
## [3-7-0] - [04-06-2014]
## [v3.7.0] - 04-06-2014
Updated pom to support new portal configuration (gcube release 3.2)
## [3-6-0] - [23-04-2014]
## [v3.6.0] - 23-04-2014
Portlet updated to support service updating
## [3-5-0] - [24-10-2013]
## [v3.5.0] - 24-10-2013
Portlet updated to support GWT 2.5.1
Ticket 2224: was implemented
## [3-4-0] - [06-09-2013]
## [v3.4.0] - 06-09-2013
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".
## [3-3-0] - [09-07-2013]
## [v3.3.0] - 09-07-2013
Bug Fixed: on species classification
## [3-2-0] - [29-05-2013]
## [v3.2.0] - 29-05-2013
Bug Fixed: #612 (SPD: Error when saving csv file in workspace)
## [3-1-0] - [14-04-2013]
## [v3.1.0] - 14-04-2013
Synch with SPD service changes
## [3-0-0] - [05-03-2013]
## [v3.0.0] - 05-03-2013
Ticket #1260: This component has been mavenized
## [2-3-0] - [17-01-2013]
## [v2.3.0] - 17-01-2013
Ticket #986: Species Occurrence jobs / Re-submit job and "info"
Ticket #1002: SPD portlet persistence refactoring
## [2-2-0] - [30-11-2012]
## [v2.2.0] - 30-11-2012
Ticket #508: Implementation of requirements resulting from ticket #508
## [2-0-0] - [13-09-2012]
## [v2.0.0] - 13-09-2012
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
## [1-0-1] - [23-07-2012]
## [v1.0.1] - 23-07-2012
Fixed 447: Map generation fails in Species Discovery Portlet
## [1-0-0] - [04-05-2012]
## [v1.0.0] - 04-05-2012
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>
<repository>
<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>
</repositories>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>species-discovery</artifactId>
<packaging>war</packaging>
<version>3.10.0</version>
<version>3.11.0-SNAPSHOT</version>
<name>gCube Species Discovery</name>
<description>
gCube Species Discovery Portlet lets the users discovery species information from the Species Service
@ -51,7 +51,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.0</version>
<version>3.6.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -94,7 +94,7 @@
<dependency>
<groupId>org.gcube.data.spd</groupId>
<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>
</dependency>
@ -170,7 +170,7 @@
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<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>
<exclusions>
<exclusion>
@ -190,7 +190,7 @@
<dependency>
<groupId>org.gcube.spatial.data</groupId>
<artifactId>geonetwork</artifactId>
<version>[3.0.0,4.0.0-SNAPSHOT)</version>
<version>[3.4.5,4.0.0-SNAPSHOT)</version>
</dependency>
<!-- GWT-LOG -->
@ -245,6 +245,7 @@
<artifactId>aslcore</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId>
@ -252,15 +253,29 @@
</dependency>
<!-- 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>
<groupId>org.gcube.common</groupId>
<artifactId>home-library-jcr</artifactId>
<groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library</artifactId>
<scope>provided</scope>
<artifactId>storagehub-client-wrapper</artifactId>
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -280,22 +295,18 @@
<scope>provided</scope>
</dependency>
<!-- LOGGER -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>runtime</scope>
<!-- <version>1.6.4</version> -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>runtime</scope>
<!-- <version>1.6.4</version> -->
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -3,33 +3,99 @@
*/
package org.gcube.portlets.user.speciesdiscovery.server.util;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.workspace.Workspace;
import org.gcube.common.portal.PortalContext;
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
* @Oct 7, 2013
* The Class GetWorkspaceUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 27, 2021
*/
public class GetWorkspaceUtil {
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");
if(session.getScope()==null)
if (session.getScope() == null)
throw new Exception("Scope into ASL session is null");
String scope = session.getScope().toString();
//logger.trace("Get workspace for scope "+scope);
//ScopeProvider.instance.set(scope);
//logger.trace("ScopeProvider instancied for scope "+scope);
logger.trace("retuning workspace for username "+session.getUsername());
return HomeLibrary.getUserWorkspace(session.getUsername());
// logger.trace("Get workspace for scope "+scope);
// ScopeProvider.instance.set(scope);
// logger.trace("ScopeProvider instancied for scope "+scope);
logger.trace("retuning workspace for username " + 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);
}
}
}