removed ScopeProvider.set everywhere
fixed occurrencescall git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/speciesdiscovery@141544 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f82797b6f1
commit
2b71b38a8b
|
@ -1,20 +1,21 @@
|
||||||
<?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.8.2-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/species-discovery-3.9.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 including="**/*.java" kind="src" output="src/main/webapp/WEB-INF/classes" path="src/main/resources"/>
|
<classpathentry including="**/*.java" kind="src" output="src/main/webapp/WEB-INF/classes" path="src/main/resources"/>
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
<classpathentry excluding="log4j/" kind="src" output="target/test-classes" path="src/test/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 including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
|
<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
|
||||||
|
<classpathentry including="*.properties" kind="src" path="src/test/java/log4j"/>
|
||||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
|
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||||
|
@ -31,5 +32,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.8.2-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/species-discovery-3.9.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
<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="/" 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/java"/>
|
||||||
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
|
||||||
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java/log4j"/>
|
||||||
<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>
|
||||||
|
|
|
@ -41,19 +41,8 @@ import org.gcube.portlets.user.speciesdiscovery.shared.TaxonomyRow;
|
||||||
*/
|
*/
|
||||||
public class TaxonomyRowTable extends HttpServlet {
|
public class TaxonomyRowTable extends HttpServlet {
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected static final String UTF_8 = "UTF-8";
|
protected static final String UTF_8 = "UTF-8";
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 9157876104914505028L;
|
private static final long serialVersionUID = 9157876104914505028L;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static final String TEXT_HTML = "text/html; charset=UTF-8";
|
public static final String TEXT_HTML = "text/html; charset=UTF-8";
|
||||||
|
|
||||||
public static final String DOCTYPE = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
|
public static final String DOCTYPE = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.speciesdiscovery.server.asl;
|
package org.gcube.portlets.user.speciesdiscovery.server.asl;
|
||||||
|
|
||||||
|
@ -27,12 +27,12 @@ import org.gcube.portlets.user.speciesdiscovery.shared.cluster.ClusterCommonName
|
||||||
import org.gcube.portlets.user.speciesdiscovery.shared.cluster.ClusterCommonNameDataSourceForTaxonomyRow;
|
import org.gcube.portlets.user.speciesdiscovery.shared.cluster.ClusterCommonNameDataSourceForTaxonomyRow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SessionUtil {
|
public class SessionUtil {
|
||||||
|
|
||||||
public static final String SPECIES_SERVICE = "SPECIES_SERVICE";
|
public static final String SPECIES_SERVICE = "SPECIES_SERVICE";
|
||||||
public static final String SEARCH_SESSION = "SEARCH_SESSION";
|
public static final String SEARCH_SESSION = "SEARCH_SESSION";
|
||||||
public static final String TAXONOMY_OCCURRENCE = "TAXONOMY_OCCURRENCE";
|
public static final String TAXONOMY_OCCURRENCE = "TAXONOMY_OCCURRENCE";
|
||||||
|
@ -51,10 +51,10 @@ public class SessionUtil {
|
||||||
private static final String CACHE_HASH_MAP_CHILDREN_TAXONOMY = "CACHE_HASH_MAP_CHILDREN_TAXONOMY";
|
private static final String CACHE_HASH_MAP_CHILDREN_TAXONOMY = "CACHE_HASH_MAP_CHILDREN_TAXONOMY";
|
||||||
private static final String CACHE_HASH_MAP_SYNONYMS_TAXONOMY = "CACHE_HASH_MAP_SYNONYMS_TAXONOMY";
|
private static final String CACHE_HASH_MAP_SYNONYMS_TAXONOMY = "CACHE_HASH_MAP_SYNONYMS_TAXONOMY";
|
||||||
private static final String CACHE_HASH_MAP_TAXONOMYID_TAXONOMY = "CACHE_HASH_MAP_TAXONOMYID_TAXONOMY";
|
private static final String CACHE_HASH_MAP_TAXONOMYID_TAXONOMY = "CACHE_HASH_MAP_TAXONOMYID_TAXONOMY";
|
||||||
|
|
||||||
protected static Logger logger = Logger.getLogger(SessionUtil.class);
|
protected static Logger logger = Logger.getLogger(SessionUtil.class);
|
||||||
|
|
||||||
|
|
||||||
public static EntityManagerFactory getEntityManagerFactory(ASLSession session) {
|
public static EntityManagerFactory getEntityManagerFactory(ASLSession session) {
|
||||||
return (EntityManagerFactory) session.getAttribute(ENTITY_FACTORY);
|
return (EntityManagerFactory) session.getAttribute(ENTITY_FACTORY);
|
||||||
}
|
}
|
||||||
|
@ -62,41 +62,40 @@ public class SessionUtil {
|
||||||
public static void setEntityManagerFactory(ASLSession session, EntityManagerFactory factory) {
|
public static void setEntityManagerFactory(ASLSession session, EntityManagerFactory factory) {
|
||||||
session.setAttribute(ENTITY_FACTORY, factory);
|
session.setAttribute(ENTITY_FACTORY, factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SpeciesService getService(ASLSession session) throws Exception
|
public static SpeciesService getService(ASLSession session) throws Exception
|
||||||
{
|
{
|
||||||
SpeciesService service = (SpeciesService) session.getAttribute(SPECIES_SERVICE);
|
SpeciesService service = (SpeciesService) session.getAttribute(SPECIES_SERVICE);
|
||||||
if (service==null) {
|
if (service==null) {
|
||||||
logger.trace("Service not found, creating it");
|
logger.trace("Service not found, creating it");
|
||||||
String scope = session.getScope();
|
service = new SpeciesService();
|
||||||
service = new SpeciesService(scope, session);
|
|
||||||
session.setAttribute(SPECIES_SERVICE, service);
|
session.setAttribute(SPECIES_SERVICE, service);
|
||||||
}
|
}
|
||||||
|
|
||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static FetchingSession<? extends FetchingElement> getCurrentSearchSession(ASLSession session)
|
public static FetchingSession<? extends FetchingElement> getCurrentSearchSession(ASLSession session)
|
||||||
{
|
{
|
||||||
return (FetchingSession<? extends FetchingElement>) session.getAttribute(SEARCH_SESSION);
|
return (FetchingSession<? extends FetchingElement>) session.getAttribute(SEARCH_SESSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCurrentSearchSession(ASLSession session, FetchingSession<? extends FetchingElement> searchSession){
|
public static void setCurrentSearchSession(ASLSession session, FetchingSession<? extends FetchingElement> searchSession){
|
||||||
session.setAttribute(SEARCH_SESSION, searchSession);
|
session.setAttribute(SEARCH_SESSION, searchSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static FetchingSession<Occurrence> getCurrentOccurrenceSession(ASLSession session){
|
public static FetchingSession<Occurrence> getCurrentOccurrenceSession(ASLSession session){
|
||||||
return (FetchingSession<Occurrence>) session.getAttribute(TAXONOMY_OCCURRENCE);
|
return (FetchingSession<Occurrence>) session.getAttribute(TAXONOMY_OCCURRENCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void setCurrentOccurrenceSession(ASLSession session, FetchingSession<Occurrence> searchSession){
|
public static void setCurrentOccurrenceSession(ASLSession session, FetchingSession<Occurrence> searchSession){
|
||||||
session.setAttribute(TAXONOMY_OCCURRENCE, searchSession);
|
session.setAttribute(TAXONOMY_OCCURRENCE, searchSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static void setCurrentTaxonomyChildrenSession(ASLSession session, FetchingSession<TaxonomyRow> searchSession)
|
// public static void setCurrentTaxonomyChildrenSession(ASLSession session, FetchingSession<TaxonomyRow> searchSession)
|
||||||
// {
|
// {
|
||||||
// session.setAttribute(TAXONOMY_CHILD, searchSession);
|
// session.setAttribute(TAXONOMY_CHILD, searchSession);
|
||||||
|
@ -114,10 +113,10 @@ public class SessionUtil {
|
||||||
// user = "lucio.lelii";
|
// user = "lucio.lelii";
|
||||||
// user = "pasquale.pagano";
|
// user = "pasquale.pagano";
|
||||||
// user = "francesco.mangiacrapa";
|
// user = "francesco.mangiacrapa";
|
||||||
|
|
||||||
String scope = "/gcube/devsec"; //Development
|
String scope = "/gcube/devsec"; //Development
|
||||||
// String scope = "/d4science.research-infrastructures.eu/gCubeApps/BiodiversityResearchEnvironment"; //Production
|
// String scope = "/d4science.research-infrastructures.eu/gCubeApps/BiodiversityResearchEnvironment"; //Production
|
||||||
|
|
||||||
httpSession.setAttribute(USERNAME_ATTRIBUTE, user);
|
httpSession.setAttribute(USERNAME_ATTRIBUTE, user);
|
||||||
ASLSession session = SessionManager.getInstance().getASLSession(sessionID, user);
|
ASLSession session = SessionManager.getInstance().getASLSession(sessionID, user);
|
||||||
session.setScope(scope);
|
session.setScope(scope);
|
||||||
|
@ -125,7 +124,7 @@ public class SessionUtil {
|
||||||
logger.warn("TaxonomySearchServiceImpl STARTING IN TEST MODE - NO USER FOUND");
|
logger.warn("TaxonomySearchServiceImpl STARTING IN TEST MODE - NO USER FOUND");
|
||||||
logger.warn("Created fake Asl session for user "+user + " with scope "+scope);
|
logger.warn("Created fake Asl session for user "+user + " with scope "+scope);
|
||||||
// session.setScope("/gcube/devsec");
|
// session.setScope("/gcube/devsec");
|
||||||
|
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,12 +132,12 @@ public class SessionUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
//MODIFIED******************************************************************************************
|
//MODIFIED******************************************************************************************
|
||||||
|
|
||||||
|
|
||||||
public static void setCurrentEJBResultRow(ASLSession session, ResultRowPersistence resultRowPersistence) {
|
public static void setCurrentEJBResultRow(ASLSession session, ResultRowPersistence resultRowPersistence) {
|
||||||
session.setAttribute(EJB_RESULT_ROW, resultRowPersistence);
|
session.setAttribute(EJB_RESULT_ROW, resultRowPersistence);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResultRowPersistence getCurrentEJBResultRow(ASLSession session) {
|
public static ResultRowPersistence getCurrentEJBResultRow(ASLSession session) {
|
||||||
return (ResultRowPersistence) session.getAttribute(EJB_RESULT_ROW);
|
return (ResultRowPersistence) session.getAttribute(EJB_RESULT_ROW);
|
||||||
}
|
}
|
||||||
|
@ -146,39 +145,39 @@ public class SessionUtil {
|
||||||
public static void setCurrentEJBTaxonRow(ASLSession session,TaxonRowPersistence taxonRowPersistence) {
|
public static void setCurrentEJBTaxonRow(ASLSession session,TaxonRowPersistence taxonRowPersistence) {
|
||||||
session.setAttribute(EJB_TAXON_ROW, taxonRowPersistence);
|
session.setAttribute(EJB_TAXON_ROW, taxonRowPersistence);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TaxonRowPersistence getCurrentEJBTaxonRow(ASLSession session) {
|
public static TaxonRowPersistence getCurrentEJBTaxonRow(ASLSession session) {
|
||||||
return (TaxonRowPersistence) session.getAttribute(EJB_TAXON_ROW);
|
return (TaxonRowPersistence) session.getAttribute(EJB_TAXON_ROW);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCurrentEJBOccurrence(ASLSession session, OccurrenceRowPersistence occurrenceRowPersistence) {
|
public static void setCurrentEJBOccurrence(ASLSession session, OccurrenceRowPersistence occurrenceRowPersistence) {
|
||||||
session.setAttribute(EJB_OCCURENCE, occurrenceRowPersistence);
|
session.setAttribute(EJB_OCCURENCE, occurrenceRowPersistence);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OccurrenceRowPersistence getCurrentEJBOccurrence(ASLSession session) {
|
public static OccurrenceRowPersistence getCurrentEJBOccurrence(ASLSession session) {
|
||||||
return (OccurrenceRowPersistence) session.getAttribute(EJB_OCCURENCE);
|
return (OccurrenceRowPersistence) session.getAttribute(EJB_OCCURENCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static TaxonomyRowPersistence getCurrentEJBTaxonomyItem(ASLSession session) {
|
public static TaxonomyRowPersistence getCurrentEJBTaxonomyItem(ASLSession session) {
|
||||||
return (TaxonomyRowPersistence) session.getAttribute(EJB_TAXONOMY);
|
return (TaxonomyRowPersistence) session.getAttribute(EJB_TAXONOMY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCurrentEJBTaxonomyItem(ASLSession session, TaxonomyRowPersistence taxonomyItemDAO) {
|
public static void setCurrentEJBTaxonomyItem(ASLSession session, TaxonomyRowPersistence taxonomyItemDAO) {
|
||||||
session.setAttribute(EJB_TAXONOMY, taxonomyItemDAO);
|
session.setAttribute(EJB_TAXONOMY, taxonomyItemDAO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCurrentEJBOccurrencesJob(ASLSession session, OccurrenceJobPersistence occurrenceJobPersistence) {
|
public static void setCurrentEJBOccurrencesJob(ASLSession session, OccurrenceJobPersistence occurrenceJobPersistence) {
|
||||||
session.setAttribute(EJB_OCCURRENCES_JOB, occurrenceJobPersistence);
|
session.setAttribute(EJB_OCCURRENCES_JOB, occurrenceJobPersistence);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static OccurrenceJobPersistence getCurrentDaoOccurrencesJob(ASLSession session) {
|
public static OccurrenceJobPersistence getCurrentDaoOccurrencesJob(ASLSession session) {
|
||||||
return (OccurrenceJobPersistence) session.getAttribute(EJB_OCCURRENCES_JOB);
|
return (OccurrenceJobPersistence) session.getAttribute(EJB_OCCURRENCES_JOB);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static TaxonomyJobPersistence getCurrentDAOTaxonomyJob(ASLSession session) {
|
public static TaxonomyJobPersistence getCurrentDAOTaxonomyJob(ASLSession session) {
|
||||||
return (TaxonomyJobPersistence) session.getAttribute(EJB_TAXONOMY_JOB);
|
return (TaxonomyJobPersistence) session.getAttribute(EJB_TAXONOMY_JOB);
|
||||||
|
@ -195,17 +194,17 @@ public class SessionUtil {
|
||||||
public static void setCurrentQuery(ASLSession aslSession, String lastQuery) {
|
public static void setCurrentQuery(ASLSession aslSession, String lastQuery) {
|
||||||
logger.trace("Last query in session: "+lastQuery);
|
logger.trace("Last query in session: "+lastQuery);
|
||||||
aslSession.setAttribute(CURRENT_SPD_QUERY, lastQuery);
|
aslSession.setAttribute(CURRENT_SPD_QUERY, lastQuery);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param aslSession
|
* @param aslSession
|
||||||
*/
|
*/
|
||||||
public static String getCurrentQuery(ASLSession aslSession) {
|
public static String getCurrentQuery(ASLSession aslSession) {
|
||||||
return (String) aslSession.getAttribute(CURRENT_SPD_QUERY);
|
return (String) aslSession.getAttribute(CURRENT_SPD_QUERY);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -213,89 +212,89 @@ public class SessionUtil {
|
||||||
*/
|
*/
|
||||||
public static void setCurrentClusterCommonNameForResultRow(ASLSession session, HashMap<String, ClusterCommonNameDataSourceForResultRow> hashClusterCommonNameDataSource) {
|
public static void setCurrentClusterCommonNameForResultRow(ASLSession session, HashMap<String, ClusterCommonNameDataSourceForResultRow> hashClusterCommonNameDataSource) {
|
||||||
session.setAttribute(CLUSTER_COMMONNAME_FOR_RESULTROW, hashClusterCommonNameDataSource);
|
session.setAttribute(CLUSTER_COMMONNAME_FOR_RESULTROW, hashClusterCommonNameDataSource);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param hashClusterCommonNameDataSource
|
* @param hashClusterCommonNameDataSource
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static HashMap<String, ClusterCommonNameDataSourceForResultRow> getCurrentClusterCommonNameForResultRow(ASLSession session) {
|
public static HashMap<String, ClusterCommonNameDataSourceForResultRow> getCurrentClusterCommonNameForResultRow(ASLSession session) {
|
||||||
return (HashMap<String, ClusterCommonNameDataSourceForResultRow>) session.getAttribute(CLUSTER_COMMONNAME_FOR_RESULTROW);
|
return (HashMap<String, ClusterCommonNameDataSourceForResultRow>) session.getAttribute(CLUSTER_COMMONNAME_FOR_RESULTROW);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param hashClusterCommonNameDataSource
|
* @param hashClusterCommonNameDataSource
|
||||||
*/
|
*/
|
||||||
public static void setCurrentClusterCommonNameForTaxonomyRow(ASLSession session, HashMap<String, ClusterCommonNameDataSourceForTaxonomyRow> hashClusterCommonNameDataSource) {
|
public static void setCurrentClusterCommonNameForTaxonomyRow(ASLSession session, HashMap<String, ClusterCommonNameDataSourceForTaxonomyRow> hashClusterCommonNameDataSource) {
|
||||||
session.setAttribute(CLUSTER_COMMONNAME_FOR_TAXONOMYROW, hashClusterCommonNameDataSource);
|
session.setAttribute(CLUSTER_COMMONNAME_FOR_TAXONOMYROW, hashClusterCommonNameDataSource);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param hashClusterCommonNameDataSource
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static HashMap<String, ClusterCommonNameDataSourceForTaxonomyRow> getCurrentClusterCommonNameForTaxonomyRow(ASLSession session) {
|
|
||||||
return (HashMap<String, ClusterCommonNameDataSourceForTaxonomyRow>) session.getAttribute(CLUSTER_COMMONNAME_FOR_TAXONOMYROW);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @param hashClusterCommonNameDataSource
|
||||||
*
|
* @return
|
||||||
|
*/
|
||||||
|
public static HashMap<String, ClusterCommonNameDataSourceForTaxonomyRow> getCurrentClusterCommonNameForTaxonomyRow(ASLSession session) {
|
||||||
|
return (HashMap<String, ClusterCommonNameDataSourceForTaxonomyRow>) session.getAttribute(CLUSTER_COMMONNAME_FOR_TAXONOMYROW);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public static HashMap<String, TaxonomyRow> getHashMapChildrenTaxonomyCache(ASLSession session) {
|
public static HashMap<String, TaxonomyRow> getHashMapChildrenTaxonomyCache(ASLSession session) {
|
||||||
return (HashMap<String, TaxonomyRow>) session.getAttribute(CACHE_HASH_MAP_CHILDREN_TAXONOMY);
|
return (HashMap<String, TaxonomyRow>) session.getAttribute(CACHE_HASH_MAP_CHILDREN_TAXONOMY);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static void setHashMapChildrenTaxonomyCache(ASLSession session, Map<String, TaxonomyRow> list) {
|
public static void setHashMapChildrenTaxonomyCache(ASLSession session, Map<String, TaxonomyRow> list) {
|
||||||
session.setAttribute(CACHE_HASH_MAP_CHILDREN_TAXONOMY, list);
|
session.setAttribute(CACHE_HASH_MAP_CHILDREN_TAXONOMY, list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static HashMap<String, TaxonomyRow> getHashMapSynonymsTaxonomyCache(ASLSession session) {
|
public static HashMap<String, TaxonomyRow> getHashMapSynonymsTaxonomyCache(ASLSession session) {
|
||||||
return (HashMap<String, TaxonomyRow>) session.getAttribute(CACHE_HASH_MAP_SYNONYMS_TAXONOMY);
|
return (HashMap<String, TaxonomyRow>) session.getAttribute(CACHE_HASH_MAP_SYNONYMS_TAXONOMY);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static void setHashMapSynonymsTaxonomyCache(ASLSession session, Map<String, TaxonomyRow> list) {
|
public static void setHashMapSynonymsTaxonomyCache(ASLSession session, Map<String, TaxonomyRow> list) {
|
||||||
session.setAttribute(CACHE_HASH_MAP_SYNONYMS_TAXONOMY, list);
|
session.setAttribute(CACHE_HASH_MAP_SYNONYMS_TAXONOMY, list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static HashMap<String, TaxonomyRow> getHashMapTaxonomyByIdsCache(ASLSession session) {
|
public static HashMap<String, TaxonomyRow> getHashMapTaxonomyByIdsCache(ASLSession session) {
|
||||||
return (HashMap<String, TaxonomyRow>) session.getAttribute(CACHE_HASH_MAP_TAXONOMYID_TAXONOMY);
|
return (HashMap<String, TaxonomyRow>) session.getAttribute(CACHE_HASH_MAP_TAXONOMYID_TAXONOMY);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static void setHashMapTaxonomyByIdsCache(ASLSession session, Map<String, TaxonomyRow> list) {
|
public static void setHashMapTaxonomyByIdsCache(ASLSession session, Map<String, TaxonomyRow> list) {
|
||||||
session.setAttribute(CACHE_HASH_MAP_TAXONOMYID_TAXONOMY, list);
|
session.setAttribute(CACHE_HASH_MAP_TAXONOMYID_TAXONOMY, list);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,44 +23,44 @@ import org.gcube.portlets.user.speciesdiscovery.shared.DatabaseServiceException;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DaoSession {
|
public class DaoSession {
|
||||||
|
|
||||||
protected static final String PROPERTY_CATALINA_HOME = "catalina.home";
|
protected static final String PROPERTY_CATALINA_HOME = "catalina.home";
|
||||||
protected static final String CATALINA_HOME = "CATALINA_HOME";
|
protected static final String CATALINA_HOME = "CATALINA_HOME";
|
||||||
protected static final String PERSISTENCE_H2DBSPECIES_H2 = "persistence/h2dbspecies/h2";
|
protected static final String PERSISTENCE_H2DBSPECIES_H2 = "persistence/h2dbspecies/h2";
|
||||||
public static Logger logger = Logger.getLogger(DaoSession.class);
|
public static Logger logger = Logger.getLogger(DaoSession.class);
|
||||||
private static final String JDBCDRIVER = "jdbc:h2:";
|
private static final String JDBCDRIVER = "jdbc:h2:";
|
||||||
|
|
||||||
|
|
||||||
public static String getUsernameScopeValue(String username, String scope){
|
public static String getUsernameScopeValue(String username, String scope){
|
||||||
|
|
||||||
scope = scope.replaceAll("/","");
|
scope = scope.replaceAll("/","");
|
||||||
username = username.replaceAll("\\.","");
|
username = username.replaceAll("\\.","");
|
||||||
|
|
||||||
return username+scope;
|
return username+scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return $CATALINA_HOME
|
* @return $CATALINA_HOME
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static String getTomcatFolder(){
|
public static String getTomcatFolder(){
|
||||||
|
|
||||||
String catalinaHome = System.getenv(CATALINA_HOME) != null ? System.getenv(CATALINA_HOME) : System.getProperty(PROPERTY_CATALINA_HOME);
|
String catalinaHome = System.getenv(CATALINA_HOME) != null ? System.getenv(CATALINA_HOME) : System.getProperty(PROPERTY_CATALINA_HOME);
|
||||||
|
|
||||||
if(catalinaHome == null || catalinaHome.isEmpty())
|
if(catalinaHome == null || catalinaHome.isEmpty())
|
||||||
logger.error("CATALINA_HOME ENVIROMENT NOT FOUND - RETURNED / PATH");
|
logger.error("CATALINA_HOME ENVIROMENT NOT FOUND - RETURNED / PATH");
|
||||||
|
|
||||||
|
|
||||||
return catalinaHome.endsWith("/") ? catalinaHome : catalinaHome+"/";
|
return catalinaHome.endsWith("/") ? catalinaHome : catalinaHome+"/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String getConnectionUrl(ASLSession session){
|
public static String getConnectionUrl(ASLSession session){
|
||||||
|
|
||||||
String username = session.getUsername();
|
String username = session.getUsername();
|
||||||
String scope = session.getScopeName();
|
String scope = session.getScopeName();
|
||||||
return JDBCDRIVER +getTomcatFolder()+PERSISTENCE_H2DBSPECIES_H2+getUsernameScopeValue(username,scope)+";create=true";
|
return JDBCDRIVER +getTomcatFolder()+PERSISTENCE_H2DBSPECIES_H2+getUsernameScopeValue(username,scope)+";create=true";
|
||||||
|
@ -82,26 +82,26 @@ public class DaoSession {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//MODIFIED**************************************************************************************+
|
//MODIFIED**************************************************************************************+
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static EntityManager newEntityManager(ASLSession session){
|
public static EntityManager newEntityManager(ASLSession session){
|
||||||
|
|
||||||
return getEntityManagerFactory(session).createEntityManager();
|
return getEntityManagerFactory(session).createEntityManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EntityManagerFactory getEntityManagerFactory(ASLSession session){
|
public static EntityManagerFactory getEntityManagerFactory(ASLSession session){
|
||||||
|
|
||||||
|
|
||||||
EntityManagerFactory factory = SessionUtil.getEntityManagerFactory(session);
|
EntityManagerFactory factory = SessionUtil.getEntityManagerFactory(session);
|
||||||
|
|
||||||
if(factory==null){
|
if(factory==null){
|
||||||
factory = createEntityManagerFactory(session);
|
factory = createEntityManagerFactory(session);
|
||||||
SessionUtil.setEntityManagerFactory(session, factory);
|
SessionUtil.setEntityManagerFactory(session, factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,22 +109,22 @@ public class DaoSession {
|
||||||
{
|
{
|
||||||
|
|
||||||
OccurrenceJobPersistence occurrencesJobDao = SessionUtil.getCurrentDaoOccurrencesJob(session);
|
OccurrenceJobPersistence occurrencesJobDao = SessionUtil.getCurrentDaoOccurrencesJob(session);
|
||||||
|
|
||||||
if(occurrencesJobDao==null){
|
if(occurrencesJobDao==null){
|
||||||
occurrencesJobDao = initOccurrencesJobsDao(session);
|
occurrencesJobDao = initOccurrencesJobsDao(session);
|
||||||
SessionUtil.setCurrentEJBOccurrencesJob(session, occurrencesJobDao);
|
SessionUtil.setCurrentEJBOccurrencesJob(session, occurrencesJobDao);
|
||||||
}
|
}
|
||||||
|
|
||||||
return occurrencesJobDao;
|
return occurrencesJobDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static TaxonomyJobPersistence getTaxonomyJobDAO(ASLSession session) throws Exception
|
public static TaxonomyJobPersistence getTaxonomyJobDAO(ASLSession session) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
TaxonomyJobPersistence taxonomyJobPeristence = SessionUtil.getCurrentDAOTaxonomyJob(session);
|
TaxonomyJobPersistence taxonomyJobPeristence = SessionUtil.getCurrentDAOTaxonomyJob(session);
|
||||||
|
|
||||||
if(taxonomyJobPeristence==null){
|
if(taxonomyJobPeristence==null){
|
||||||
taxonomyJobPeristence = initTaxonomyJobsDao(session);
|
taxonomyJobPeristence = initTaxonomyJobsDao(session);
|
||||||
SessionUtil.setCurrentDAOTaxonomyJob(session, taxonomyJobPeristence);
|
SessionUtil.setCurrentDAOTaxonomyJob(session, taxonomyJobPeristence);
|
||||||
|
@ -132,12 +132,11 @@ public class DaoSession {
|
||||||
|
|
||||||
return taxonomyJobPeristence;
|
return taxonomyJobPeristence;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EntityManagerFactory createEntityManagerFactory(ASLSession session){
|
public static EntityManagerFactory createEntityManagerFactory(ASLSession session){
|
||||||
|
|
||||||
Map<String,String> properties = new HashMap<String, String>();
|
Map<String,String> properties = new HashMap<String, String>();
|
||||||
// properties.put("javax.persistence.jdbc.driver", jdbcDriverH2);
|
// properties.put("javax.persistence.jdbc.driver", jdbcDriverH2);
|
||||||
|
|
||||||
try{
|
try{
|
||||||
properties.put("javax.persistence.jdbc.url", getConnectionUrl(session));
|
properties.put("javax.persistence.jdbc.url", getConnectionUrl(session));
|
||||||
}
|
}
|
||||||
|
@ -149,19 +148,19 @@ public class DaoSession {
|
||||||
}
|
}
|
||||||
//emf = Persistence.createEntityManagerFactory("jpablogPUnit");
|
//emf = Persistence.createEntityManagerFactory("jpablogPUnit");
|
||||||
return Persistence.createEntityManagerFactory("SPD_PERSISTENCE_FACTORY",properties);
|
return Persistence.createEntityManagerFactory("SPD_PERSISTENCE_FACTORY",properties);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static OccurrenceJobPersistence initOccurrencesJobsDao(ASLSession session) throws Exception
|
public static OccurrenceJobPersistence initOccurrencesJobsDao(ASLSession session) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
String username = session.getUsername();
|
String username = session.getUsername();
|
||||||
String scope = session.getScopeName();
|
String scope = session.getScopeName();
|
||||||
return createOccurrencesJobDao(username, scope, session);
|
return createOccurrencesJobDao(username, scope, session);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static TaxonomyJobPersistence initTaxonomyJobsDao(ASLSession session) throws Exception{
|
public static TaxonomyJobPersistence initTaxonomyJobsDao(ASLSession session) throws Exception{
|
||||||
TaxonomyJobPersistence occurrenceJobPersistence = new TaxonomyJobPersistence(getEntityManagerFactory(session));
|
TaxonomyJobPersistence occurrenceJobPersistence = new TaxonomyJobPersistence(getEntityManagerFactory(session));
|
||||||
|
@ -169,34 +168,34 @@ public class DaoSession {
|
||||||
return occurrenceJobPersistence;
|
return occurrenceJobPersistence;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OccurrenceJobPersistence createOccurrencesJobDao(String username, String scope, ASLSession session) throws Exception{
|
public static OccurrenceJobPersistence createOccurrencesJobDao(String username, String scope, ASLSession session) throws Exception{
|
||||||
|
|
||||||
OccurrenceJobPersistence occurrenceJobPersistence = new OccurrenceJobPersistence(getEntityManagerFactory(session));
|
OccurrenceJobPersistence occurrenceJobPersistence = new OccurrenceJobPersistence(getEntityManagerFactory(session));
|
||||||
SessionUtil.setCurrentEJBOccurrencesJob(session, occurrenceJobPersistence);
|
SessionUtil.setCurrentEJBOccurrencesJob(session, occurrenceJobPersistence);
|
||||||
|
|
||||||
// logger.trace("ResultRow Dao IS READY AT CONNECTION URL: " + jdbcDriver + " table name "+ resultRowDAO.getTableInfo().getTableName());
|
// logger.trace("ResultRow Dao IS READY AT CONNECTION URL: " + jdbcDriver + " table name "+ resultRowDAO.getTableInfo().getTableName());
|
||||||
|
|
||||||
return occurrenceJobPersistence;
|
return occurrenceJobPersistence;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResultRowPersistence initResultRowDao(ASLSession session) throws Exception
|
public static ResultRowPersistence initResultRowDao(ASLSession session) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
ResultRowPersistence resultRowPersistence = new ResultRowPersistence(getEntityManagerFactory(session));
|
ResultRowPersistence resultRowPersistence = new ResultRowPersistence(getEntityManagerFactory(session));
|
||||||
SessionUtil.setCurrentEJBResultRow(session, resultRowPersistence);
|
SessionUtil.setCurrentEJBResultRow(session, resultRowPersistence);
|
||||||
|
|
||||||
// logger.trace("ResultRow Dao IS READY AT CONNECTION URL: " + jdbcDriver + " table name "+ resultRowDAO.getTableInfo().getTableName());
|
// logger.trace("ResultRow Dao IS READY AT CONNECTION URL: " + jdbcDriver + " table name "+ resultRowDAO.getTableInfo().getTableName());
|
||||||
|
|
||||||
return resultRowPersistence;
|
return resultRowPersistence;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OccurrenceRowPersistence getOccurrenceDAO(ASLSession session) throws Exception
|
public static OccurrenceRowPersistence getOccurrenceDAO(ASLSession session) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
OccurrenceRowPersistence occurrenceEJB = SessionUtil.getCurrentEJBOccurrence(session);
|
OccurrenceRowPersistence occurrenceEJB = SessionUtil.getCurrentEJBOccurrence(session);
|
||||||
|
|
||||||
if(occurrenceEJB==null){
|
if(occurrenceEJB==null){
|
||||||
occurrenceEJB = initOccurrenceDao(session);
|
occurrenceEJB = initOccurrenceDao(session);
|
||||||
SessionUtil.setCurrentEJBOccurrence(session, occurrenceEJB);
|
SessionUtil.setCurrentEJBOccurrence(session, occurrenceEJB);
|
||||||
|
@ -207,60 +206,60 @@ public class DaoSession {
|
||||||
|
|
||||||
public static TaxonRowPersistence initTaxonDao(ASLSession session) throws Exception
|
public static TaxonRowPersistence initTaxonDao(ASLSession session) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
TaxonRowPersistence taxonRowPersistence = new TaxonRowPersistence(getEntityManagerFactory(session));
|
TaxonRowPersistence taxonRowPersistence = new TaxonRowPersistence(getEntityManagerFactory(session));
|
||||||
SessionUtil.setCurrentEJBTaxonRow(session, taxonRowPersistence);
|
SessionUtil.setCurrentEJBTaxonRow(session, taxonRowPersistence);
|
||||||
|
|
||||||
// logger.trace("ResultRow Dao IS READY AT CONNECTION URL: " + jdbcDriver + " table name "+ resultRowDAO.getTableInfo().getTableName());
|
// logger.trace("ResultRow Dao IS READY AT CONNECTION URL: " + jdbcDriver + " table name "+ resultRowDAO.getTableInfo().getTableName());
|
||||||
|
|
||||||
return taxonRowPersistence;
|
return taxonRowPersistence;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static OccurrenceRowPersistence initOccurrenceDao(ASLSession session) throws Exception {
|
private static OccurrenceRowPersistence initOccurrenceDao(ASLSession session) throws Exception {
|
||||||
|
|
||||||
OccurrenceRowPersistence occurrenceRowPersistence = new OccurrenceRowPersistence(getEntityManagerFactory(session));
|
OccurrenceRowPersistence occurrenceRowPersistence = new OccurrenceRowPersistence(getEntityManagerFactory(session));
|
||||||
SessionUtil.setCurrentEJBOccurrence(session, occurrenceRowPersistence);
|
SessionUtil.setCurrentEJBOccurrence(session, occurrenceRowPersistence);
|
||||||
|
|
||||||
// logger.trace("ResultRow Dao IS READY AT CONNECTION URL: " + jdbcDriver + " table name "+ resultRowDAO.getTableInfo().getTableName());
|
// logger.trace("ResultRow Dao IS READY AT CONNECTION URL: " + jdbcDriver + " table name "+ resultRowDAO.getTableInfo().getTableName());
|
||||||
|
|
||||||
return occurrenceRowPersistence;
|
return occurrenceRowPersistence;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TaxonRowPersistence getTaxonDAO(ASLSession session) throws Exception
|
public static TaxonRowPersistence getTaxonDAO(ASLSession session) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
TaxonRowPersistence taxonDao = SessionUtil.getCurrentEJBTaxonRow(session);
|
TaxonRowPersistence taxonDao = SessionUtil.getCurrentEJBTaxonRow(session);
|
||||||
|
|
||||||
if(taxonDao==null){
|
if(taxonDao==null){
|
||||||
taxonDao = initTaxonDao(session);
|
taxonDao = initTaxonDao(session);
|
||||||
SessionUtil.setCurrentEJBTaxonRow(session, taxonDao);
|
SessionUtil.setCurrentEJBTaxonRow(session, taxonDao);
|
||||||
}
|
}
|
||||||
|
|
||||||
// System.out.println("Return taxon Dao : " + taxonDao + " table name: " + taxonDao.getTableConfig().getTableName());
|
// System.out.println("Return taxon Dao : " + taxonDao + " table name: " + taxonDao.getTableConfig().getTableName());
|
||||||
// System.out.println("session id: " + session.getExternalSessionID() + " sessione username: " +session.getUsername() + " session scope: "+session.getScopeName());
|
// System.out.println("session id: " + session.getExternalSessionID() + " sessione username: " +session.getUsername() + " session scope: "+session.getScopeName());
|
||||||
|
|
||||||
return taxonDao;
|
return taxonDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TaxonomyRowPersistence getTaxonomyDAO(ASLSession session) throws Exception
|
public static TaxonomyRowPersistence getTaxonomyDAO(ASLSession session) throws Exception
|
||||||
{
|
{
|
||||||
logger.trace("In getTaxonomyDAO...");
|
logger.trace("In getTaxonomyDAO...");
|
||||||
|
|
||||||
TaxonomyRowPersistence taxonItemDAO = SessionUtil.getCurrentEJBTaxonomyItem(session);
|
TaxonomyRowPersistence taxonItemDAO = SessionUtil.getCurrentEJBTaxonomyItem(session);
|
||||||
|
|
||||||
if(taxonItemDAO==null){
|
if(taxonItemDAO==null){
|
||||||
taxonItemDAO = initTaxonomyItemDao(session, "taxonomyrow");
|
taxonItemDAO = initTaxonomyItemDao(session, "taxonomyrow");
|
||||||
SessionUtil.setCurrentEJBTaxonomyItem(session, taxonItemDAO);
|
SessionUtil.setCurrentEJBTaxonomyItem(session, taxonItemDAO);
|
||||||
}
|
}
|
||||||
|
|
||||||
// logger.trace("Return taxonomy row Dao : " + taxonItemDAO + " table name: " + taxonItemDAO.getTableConfig().getTableName());
|
// logger.trace("Return taxonomy row Dao : " + taxonItemDAO + " table name: " + taxonItemDAO.getTableConfig().getTableName());
|
||||||
// logger.trace("session id: " + session.getExternalSessionID() + " sessione username: " +session.getUsername() + " session scope: "+session.getScopeName());
|
// logger.trace("session id: " + session.getExternalSessionID() + " sessione username: " +session.getUsername() + " session scope: "+session.getScopeName());
|
||||||
|
|
||||||
return taxonItemDAO;
|
return taxonItemDAO;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TaxonomyRowPersistence initTaxonomyItemDao(ASLSession session, String tableName) throws Exception{
|
private static TaxonomyRowPersistence initTaxonomyItemDao(ASLSession session, String tableName) throws Exception{
|
||||||
|
|
||||||
TaxonomyRowPersistence taxonomyRP = new TaxonomyRowPersistence(getEntityManagerFactory(session));
|
TaxonomyRowPersistence taxonomyRP = new TaxonomyRowPersistence(getEntityManagerFactory(session));
|
||||||
|
@ -268,26 +267,26 @@ public class DaoSession {
|
||||||
|
|
||||||
return taxonomyRP;
|
return taxonomyRP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResultRowPersistence getResultRowDAO(ASLSession session) throws Exception
|
public static ResultRowPersistence getResultRowDAO(ASLSession session) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
logger.trace("In getResultRowDAO...");
|
logger.trace("In getResultRowDAO...");
|
||||||
|
|
||||||
ResultRowPersistence resultRowEJB = SessionUtil.getCurrentEJBResultRow(session);
|
ResultRowPersistence resultRowEJB = SessionUtil.getCurrentEJBResultRow(session);
|
||||||
|
|
||||||
if(resultRowEJB==null){
|
if(resultRowEJB==null){
|
||||||
resultRowEJB = initResultRowDao(session);
|
resultRowEJB = initResultRowDao(session);
|
||||||
SessionUtil.setCurrentEJBResultRow(session, resultRowEJB);
|
SessionUtil.setCurrentEJBResultRow(session, resultRowEJB);
|
||||||
}
|
}
|
||||||
|
|
||||||
// logger.trace("Return result row Dao : " + resultRowEJB + " table name: " + resultRowDAO.getTableConfig().getTableName());
|
// logger.trace("Return result row Dao : " + resultRowEJB + " table name: " + resultRowDAO.getTableConfig().getTableName());
|
||||||
// logger.trace("session id: " + session.getExternalSessionID() + " sessione username: " +session.getUsername() + " session scope: "+session.getScopeName());
|
// logger.trace("session id: " + session.getExternalSessionID() + " sessione username: " +session.getUsername() + " session scope: "+session.getScopeName());
|
||||||
|
|
||||||
return resultRowEJB;
|
return resultRowEJB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,6 @@ import java.util.Map.Entry;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
|
||||||
import org.gcube.data.spd.client.proxies.ClassificationClient;
|
import org.gcube.data.spd.client.proxies.ClassificationClient;
|
||||||
import org.gcube.data.spd.client.proxies.ExecutorClient;
|
import org.gcube.data.spd.client.proxies.ExecutorClient;
|
||||||
import org.gcube.data.spd.client.proxies.ManagerClient;
|
import org.gcube.data.spd.client.proxies.ManagerClient;
|
||||||
|
@ -59,59 +57,24 @@ public class SpeciesService {
|
||||||
|
|
||||||
protected Logger logger = Logger.getLogger(SpeciesService.class);
|
protected Logger logger = Logger.getLogger(SpeciesService.class);
|
||||||
protected String scope;
|
protected String scope;
|
||||||
protected ASLSession session;
|
|
||||||
protected ManagerClient call;
|
protected ManagerClient call;
|
||||||
protected OccurrenceClient occurrencesCall;
|
protected OccurrenceClient occurrencesCall;
|
||||||
protected ClassificationClient classificationCall;
|
protected ClassificationClient classificationCall;
|
||||||
protected ExecutorClient executorCall;
|
protected ExecutorClient executorCall;
|
||||||
protected String lastQuery = "";
|
protected String lastQuery = "";
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new species service.
|
|
||||||
*
|
|
||||||
* @param scope
|
|
||||||
* the scope
|
|
||||||
* @param session
|
|
||||||
* the session
|
|
||||||
* @throws Exception
|
|
||||||
* the exception
|
|
||||||
*/
|
|
||||||
public SpeciesService(String scope, ASLSession session)
|
|
||||||
throws Exception {
|
|
||||||
|
|
||||||
this(scope);
|
|
||||||
this.session = session;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new species service.
|
* Instantiates a new species service.
|
||||||
*
|
*
|
||||||
* @param scope
|
* @throws Exception the exception
|
||||||
* the scope
|
|
||||||
* @throws Exception
|
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
public SpeciesService(String scope)
|
public SpeciesService() throws Exception {
|
||||||
throws Exception {
|
|
||||||
|
|
||||||
this.scope = scope;
|
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
// this.call = manager().at(
|
|
||||||
// URI.create("http://node24.d.d4science.research-infrastructures.eu:9000")).withTimeout(3,
|
|
||||||
// TimeUnit.MINUTES).build();
|
|
||||||
// this.occurrencesCall = occurrences().at(
|
|
||||||
// URI.create("http://node24.d.d4science.research-infrastructures.eu:9000")).withTimeout(3,
|
|
||||||
// TimeUnit.MINUTES).build();
|
|
||||||
// this.classificationCall = classification().at(
|
|
||||||
// URI.create("http://node24.d.d4science.research-infrastructures.eu:9000")).withTimeout(3,
|
|
||||||
// TimeUnit.MINUTES).build();
|
|
||||||
System.out.println("CALLING MANAGER ");
|
System.out.println("CALLING MANAGER ");
|
||||||
this.call = manager().withTimeout(3, TimeUnit.MINUTES).build();
|
this.call = manager().withTimeout(3, TimeUnit.MINUTES).build();
|
||||||
this.executorCall = executor().withTimeout(3, TimeUnit.MINUTES).build();
|
this.executorCall = executor().withTimeout(3, TimeUnit.MINUTES).build();
|
||||||
OccurrenceClient a =
|
this.occurrencesCall = occurrences().withTimeout(3, TimeUnit.MINUTES).build();
|
||||||
occurrences().withTimeout(3, TimeUnit.MINUTES).build();
|
this.classificationCall = classification().withTimeout(3, TimeUnit.MINUTES).build();
|
||||||
this.classificationCall =
|
|
||||||
classification().withTimeout(3, TimeUnit.MINUTES).build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,7 +92,6 @@ public class SpeciesService {
|
||||||
|
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
if (instanceOnlyOccurrence) {
|
if (instanceOnlyOccurrence) {
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
System.out.println("CALLING OCCURRENCE MANAGER ");
|
System.out.println("CALLING OCCURRENCE MANAGER ");
|
||||||
this.occurrencesCall = occurrences().withTimeout(3, TimeUnit.MINUTES).build();
|
this.occurrencesCall = occurrences().withTimeout(3, TimeUnit.MINUTES).build();
|
||||||
}
|
}
|
||||||
|
@ -185,7 +147,6 @@ public class SpeciesService {
|
||||||
|
|
||||||
logger.trace("retrieveTaxonomyById...");
|
logger.trace("retrieveTaxonomyById...");
|
||||||
try {
|
try {
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
Stream<TaxonomyItem> stream = classificationCall.getTaxaByIds(ids);
|
Stream<TaxonomyItem> stream = classificationCall.getTaxaByIds(ids);
|
||||||
return new StreamIterator<TaxonomyItem>(stream);
|
return new StreamIterator<TaxonomyItem>(stream);
|
||||||
}
|
}
|
||||||
|
@ -211,7 +172,6 @@ public class SpeciesService {
|
||||||
|
|
||||||
logger.trace("retrieveSynonymsById...");
|
logger.trace("retrieveSynonymsById...");
|
||||||
try {
|
try {
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
Stream<TaxonomyItem> stream =
|
Stream<TaxonomyItem> stream =
|
||||||
classificationCall.getSynonymsById(id);
|
classificationCall.getSynonymsById(id);
|
||||||
return new StreamIterator<TaxonomyItem>(stream);
|
return new StreamIterator<TaxonomyItem>(stream);
|
||||||
|
@ -239,9 +199,7 @@ public class SpeciesService {
|
||||||
logger.trace("search by Query - query is: " + query);
|
logger.trace("search by Query - query is: " + query);
|
||||||
// System.out.println("searchByQuery query: "+query);
|
// System.out.println("searchByQuery query: "+query);
|
||||||
try {
|
try {
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
lastQuery = query;
|
lastQuery = query;
|
||||||
// System.err.println("ScopeProvider SCOPE "+ScopeProvider.instance.get());
|
|
||||||
logger.trace("call species service search...");
|
logger.trace("call species service search...");
|
||||||
// System.out.println("call species service search...");
|
// System.out.println("call species service search...");
|
||||||
Stream<ResultElement> stream = call.search(query);
|
Stream<ResultElement> stream = call.search(query);
|
||||||
|
@ -286,10 +244,7 @@ public class SpeciesService {
|
||||||
throws SearchServiceException {
|
throws SearchServiceException {
|
||||||
|
|
||||||
logger.trace("searchByQuery query: " + query);
|
logger.trace("searchByQuery query: " + query);
|
||||||
// System.out.println("searchByQuery query: "+query);
|
|
||||||
try {
|
try {
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
// System.err.println("ScopeProvider SCOPE "+ScopeProvider.instance.get());
|
|
||||||
logger.trace("call species service search...");
|
logger.trace("call species service search...");
|
||||||
System.out.println("call species service search...");
|
System.out.println("call species service search...");
|
||||||
return call.search(query);
|
return call.search(query);
|
||||||
|
@ -316,7 +271,6 @@ public class SpeciesService {
|
||||||
try {
|
try {
|
||||||
List<DataSourceModel> listDsModel =
|
List<DataSourceModel> listDsModel =
|
||||||
new ArrayList<DataSourceModel>();
|
new ArrayList<DataSourceModel>();
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
System.out.println("setting scope " + scope);
|
System.out.println("setting scope " + scope);
|
||||||
List<PluginDescription> plugin = call.getPluginsDescription();
|
List<PluginDescription> plugin = call.getPluginsDescription();
|
||||||
if (plugin != null) {
|
if (plugin != null) {
|
||||||
|
@ -475,9 +429,6 @@ public class SpeciesService {
|
||||||
throws SearchServiceException {
|
throws SearchServiceException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Stream<String> keysStream = convert(keys);
|
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
logger.trace("Instancing scope: "+scope);
|
|
||||||
logger.trace("Calling occurrencesCall passing keys: "+keys);
|
logger.trace("Calling occurrencesCall passing keys: "+keys);
|
||||||
logger.trace("occurrencesCall != null? "+(occurrencesCall==null));
|
logger.trace("occurrencesCall != null? "+(occurrencesCall==null));
|
||||||
Stream<OccurrencePoint> stream = occurrencesCall.getByKeys(keys);
|
Stream<OccurrencePoint> stream = occurrencesCall.getByKeys(keys);
|
||||||
|
@ -504,7 +455,6 @@ public class SpeciesService {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Stream<String> idsStream = convert(ids);
|
// Stream<String> idsStream = convert(ids);
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
Stream<OccurrencePoint> stream = occurrencesCall.getByIds(ids);
|
Stream<OccurrencePoint> stream = occurrencesCall.getByIds(ids);
|
||||||
return new StreamIterator<OccurrencePoint>(stream);
|
return new StreamIterator<OccurrencePoint>(stream);
|
||||||
}
|
}
|
||||||
|
@ -530,7 +480,6 @@ public class SpeciesService {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Stream<String> keysStream = convert(keys);
|
// Stream<String> keysStream = convert(keys);
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
return occurrencesCall.createLayer(streamKey);
|
return occurrencesCall.createLayer(streamKey);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
@ -555,7 +504,6 @@ public class SpeciesService {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
Stream<TaxonomyItem> items =
|
Stream<TaxonomyItem> items =
|
||||||
classificationCall.getTaxonChildrenById(parentId);
|
classificationCall.getTaxonChildrenById(parentId);
|
||||||
return new StreamIterator<TaxonomyItem>(items);
|
return new StreamIterator<TaxonomyItem>(items);
|
||||||
|
@ -578,7 +526,6 @@ public class SpeciesService {
|
||||||
*/
|
*/
|
||||||
public CompleteJobStatus getTaxonomyJobById(String jobId) {
|
public CompleteJobStatus getTaxonomyJobById(String jobId) {
|
||||||
|
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
CompleteJobStatus status = null;
|
CompleteJobStatus status = null;
|
||||||
try {
|
try {
|
||||||
status = this.executorCall.getStatus(jobId);
|
status = this.executorCall.getStatus(jobId);
|
||||||
|
@ -609,7 +556,6 @@ public class SpeciesService {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
try {
|
try {
|
||||||
String url = this.executorCall.getResultLink(jobIdentifier);
|
String url = this.executorCall.getResultLink(jobIdentifier);
|
||||||
if (url == null || url.isEmpty()) {
|
if (url == null || url.isEmpty()) {
|
||||||
|
@ -640,7 +586,6 @@ public class SpeciesService {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
try {
|
try {
|
||||||
String url = this.executorCall.getErrorLink(jobIdentifier);
|
String url = this.executorCall.getErrorLink(jobIdentifier);
|
||||||
if (url == null || url.isEmpty()) {
|
if (url == null || url.isEmpty()) {
|
||||||
|
@ -670,7 +615,6 @@ public class SpeciesService {
|
||||||
public boolean isAvailableTaxonomyJobErrorFileById(String jobIdentifier)
|
public boolean isAvailableTaxonomyJobErrorFileById(String jobIdentifier)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
try {
|
try {
|
||||||
String url = this.executorCall.getErrorLink(jobIdentifier);
|
String url = this.executorCall.getErrorLink(jobIdentifier);
|
||||||
if (url == null || url.isEmpty()) {
|
if (url == null || url.isEmpty()) {
|
||||||
|
@ -700,7 +644,6 @@ public class SpeciesService {
|
||||||
public String createTaxonomyJobForDWCAByChildren(String taxonomyId)
|
public String createTaxonomyJobForDWCAByChildren(String taxonomyId)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
try {
|
try {
|
||||||
return this.executorCall.createDwCAByChildren(taxonomyId);
|
return this.executorCall.createDwCAByChildren(taxonomyId);
|
||||||
}
|
}
|
||||||
|
@ -722,7 +665,6 @@ public class SpeciesService {
|
||||||
public String createTaxonomyJobForDWCAByIds(List<String> ids)
|
public String createTaxonomyJobForDWCAByIds(List<String> ids)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
try {
|
try {
|
||||||
Stream<String> keysStream = convert(ids);
|
Stream<String> keysStream = convert(ids);
|
||||||
return executorCall.createDwCAByIds(keysStream);
|
return executorCall.createDwCAByIds(keysStream);
|
||||||
|
@ -744,7 +686,6 @@ public class SpeciesService {
|
||||||
public void cancelTaxonomyJobById(String jobIdentifier) {
|
public void cancelTaxonomyJobById(String jobIdentifier) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
this.executorCall.removeJob(jobIdentifier);
|
this.executorCall.removeJob(jobIdentifier);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
@ -763,7 +704,6 @@ public class SpeciesService {
|
||||||
public CompleteJobStatus getOccurrenceJobById(String jobId) {
|
public CompleteJobStatus getOccurrenceJobById(String jobId) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
return this.executorCall.getStatus(jobId); // CHANGE INTO OCCURRENCE
|
return this.executorCall.getStatus(jobId); // CHANGE INTO OCCURRENCE
|
||||||
// JOB
|
// JOB
|
||||||
// **************************************************************************************
|
// **************************************************************************************
|
||||||
|
@ -793,7 +733,6 @@ public class SpeciesService {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
return this.executorCall.createCSV(streamKey);
|
return this.executorCall.createCSV(streamKey);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
@ -817,7 +756,6 @@ public class SpeciesService {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
return this.executorCall.createDarwincoreFromOccurrenceKeys(streamKey);
|
return this.executorCall.createDarwincoreFromOccurrenceKeys(streamKey);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
@ -841,7 +779,6 @@ public class SpeciesService {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
return this.executorCall.createCSVforOM(streamKey);
|
return this.executorCall.createCSVforOM(streamKey);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
@ -863,7 +800,6 @@ public class SpeciesService {
|
||||||
public void cancelOccurrenceJobById(String jobIdentifier) {
|
public void cancelOccurrenceJobById(String jobIdentifier) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
this.executorCall.removeJob(jobIdentifier); // CHANGE INTO
|
this.executorCall.removeJob(jobIdentifier); // CHANGE INTO
|
||||||
// OCCURRENCE JOB
|
// OCCURRENCE JOB
|
||||||
// **************************************************************************************
|
// **************************************************************************************
|
||||||
|
@ -888,7 +824,6 @@ public class SpeciesService {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
try {
|
try {
|
||||||
String url = this.executorCall.getResultLink(jobIdentifier); // CHANGE
|
String url = this.executorCall.getResultLink(jobIdentifier); // CHANGE
|
||||||
// INTO
|
// INTO
|
||||||
|
@ -925,7 +860,6 @@ public class SpeciesService {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
try {
|
try {
|
||||||
String url = this.executorCall.getErrorLink(jobIdentifier);
|
String url = this.executorCall.getErrorLink(jobIdentifier);
|
||||||
logger.trace("URL returned by species service is: " + url);
|
logger.trace("URL returned by species service is: " + url);
|
||||||
|
@ -955,7 +889,6 @@ public class SpeciesService {
|
||||||
public boolean isAvailableOccurrenceJobErrorFileById(String jobIdentifier)
|
public boolean isAvailableOccurrenceJobErrorFileById(String jobIdentifier)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
ScopeProvider.instance.set(scope);
|
|
||||||
try {
|
try {
|
||||||
String url = this.executorCall.getErrorLink(jobIdentifier);
|
String url = this.executorCall.getErrorLink(jobIdentifier);
|
||||||
if (url == null || url.isEmpty()) {
|
if (url == null || url.isEmpty()) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.speciesdiscovery.server.util;
|
package org.gcube.portlets.user.speciesdiscovery.server.util;
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ 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.homelibrary.home.HomeLibrary;
|
||||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
@ -17,26 +16,20 @@ import org.gcube.common.scope.api.ScopeProvider;
|
||||||
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 {
|
public static Workspace getWorskspace(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);
|
||||||
|
//logger.trace("ScopeProvider instancied for scope "+scope);
|
||||||
ScopeProvider.instance.set(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 HomeLibrary.getUserWorkspace(session.getUsername());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.speciesdiscovery.shared;
|
package org.gcube.portlets.user.speciesdiscovery.shared;
|
||||||
|
|
||||||
|
@ -10,16 +10,18 @@ import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
public class CommonName implements Serializable {
|
public class CommonName implements IsSerializable, Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1140787822064828769L;
|
private static final long serialVersionUID = 1140787822064828769L;
|
||||||
|
|
||||||
|
@ -27,22 +29,22 @@ public class CommonName implements Serializable {
|
||||||
public final static String NAME= "name";
|
public final static String NAME= "name";
|
||||||
public final static String LANGUAGE= "language";
|
public final static String LANGUAGE= "language";
|
||||||
public final static String REFERENCE_RESULTROW_ID = "resultRowId";
|
public final static String REFERENCE_RESULTROW_ID = "resultRowId";
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private int internalId;
|
private int internalId;
|
||||||
|
|
||||||
|
|
||||||
protected int id;
|
protected int id;
|
||||||
|
|
||||||
private int resultRowId;
|
private int resultRowId;
|
||||||
|
|
||||||
protected String name;
|
protected String name;
|
||||||
|
|
||||||
protected String language;
|
protected String language;
|
||||||
|
|
||||||
public CommonName(){}
|
public CommonName(){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name
|
* @param name
|
||||||
* @param language
|
* @param language
|
||||||
|
@ -97,5 +99,5 @@ public class CommonName implements Serializable {
|
||||||
public int getResultRowId() {
|
public int getResultRowId() {
|
||||||
return resultRowId;
|
return resultRowId;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,28 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.speciesdiscovery.shared;
|
package org.gcube.portlets.user.speciesdiscovery.shared;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Coordinate implements Serializable {
|
public class Coordinate implements IsSerializable, Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -2357675565732391317L;
|
private static final long serialVersionUID = -2357675565732391317L;
|
||||||
|
|
||||||
protected float latitude;
|
protected float latitude;
|
||||||
protected float longitude;
|
protected float longitude;
|
||||||
|
|
||||||
public Coordinate(){}
|
public Coordinate(){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param latitude
|
* @param latitude
|
||||||
* @param longitude
|
* @param longitude
|
||||||
|
@ -29,35 +31,35 @@ public class Coordinate implements Serializable {
|
||||||
this.latitude = latitude;
|
this.latitude = latitude;
|
||||||
this.longitude = longitude;
|
this.longitude = longitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the latitude
|
* @return the latitude
|
||||||
*/
|
*/
|
||||||
public float getLatitude() {
|
public float getLatitude() {
|
||||||
return latitude;
|
return latitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param latitude the latitude to set
|
* @param latitude the latitude to set
|
||||||
*/
|
*/
|
||||||
public void setLatitude(float latitude) {
|
public void setLatitude(float latitude) {
|
||||||
this.latitude = latitude;
|
this.latitude = latitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the longitude
|
* @return the longitude
|
||||||
*/
|
*/
|
||||||
public float getLongitude() {
|
public float getLongitude() {
|
||||||
return longitude;
|
return longitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param longitude the longitude to set
|
* @param longitude the longitude to set
|
||||||
*/
|
*/
|
||||||
public void setLongitude(float longitude) {
|
public void setLongitude(float longitude) {
|
||||||
this.longitude = longitude;
|
this.longitude = longitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.gcube.portlets.user.speciesdiscovery.shared;
|
package org.gcube.portlets.user.speciesdiscovery.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
|
@ -15,7 +17,12 @@ import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
* Jan 10, 2017
|
* Jan 10, 2017
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
public class DataSource implements IsSerializable{
|
public class DataSource implements IsSerializable, Serializable{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -7978955895523864898L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.user.speciesdiscovery.shared;
|
package org.gcube.portlets.user.speciesdiscovery.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
@ -12,8 +13,12 @@ import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
* Jan 10, 2017
|
* Jan 10, 2017
|
||||||
*/
|
*/
|
||||||
public class DataSourceCapability implements IsSerializable{
|
public class DataSourceCapability implements IsSerializable, Serializable{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 844266531985842984L;
|
||||||
private ArrayList<SpeciesCapability> listFilters;
|
private ArrayList<SpeciesCapability> listFilters;
|
||||||
private SpeciesCapability capability;
|
private SpeciesCapability capability;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
package org.gcube.portlets.user.speciesdiscovery.shared;
|
package org.gcube.portlets.user.speciesdiscovery.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class DataSourceModel.
|
* The Class DataSourceModel.
|
||||||
|
@ -9,8 +12,12 @@ import java.util.ArrayList;
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
* Jan 10, 2017
|
* Jan 10, 2017
|
||||||
*/
|
*/
|
||||||
public class DataSourceModel extends DataSource {
|
public class DataSourceModel extends DataSource implements IsSerializable, Serializable{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -8314335099130160226L;
|
||||||
private ArrayList<DataSourceCapability> listCapabilities;
|
private ArrayList<DataSourceCapability> listCapabilities;
|
||||||
private DataSourceRepositoryInfo dataSourceRepositoryInfo;
|
private DataSourceRepositoryInfo dataSourceRepositoryInfo;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.user.speciesdiscovery.shared;
|
package org.gcube.portlets.user.speciesdiscovery.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
@ -11,8 +12,12 @@ import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
* Jan 10, 2017
|
* Jan 10, 2017
|
||||||
*/
|
*/
|
||||||
public class DataSourceRepositoryInfo implements IsSerializable{
|
public class DataSourceRepositoryInfo implements IsSerializable, Serializable{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -2778021508260771963L;
|
||||||
private String logoUrl;
|
private String logoUrl;
|
||||||
private String pageUrl;
|
private String pageUrl;
|
||||||
private Map<String, String> properties;
|
private Map<String, String> properties;
|
||||||
|
|
|
@ -2,13 +2,15 @@ package org.gcube.portlets.user.speciesdiscovery.shared;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public enum DownloadState implements Serializable {
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
PENDING,
|
|
||||||
ONGOING,
|
public enum DownloadState implements IsSerializable, Serializable {
|
||||||
ONGOINGWITHFAILURES,
|
PENDING,
|
||||||
FAILED,
|
ONGOING,
|
||||||
COMPLETED,
|
ONGOINGWITHFAILURES,
|
||||||
COMPLETEDWITHFAILURES,
|
FAILED,
|
||||||
|
COMPLETED,
|
||||||
|
COMPLETEDWITHFAILURES,
|
||||||
SAVING,
|
SAVING,
|
||||||
SAVED,
|
SAVED,
|
||||||
SERVICE_UNKNOWN
|
SERVICE_UNKNOWN
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
# Set root category priority to WARN and its only appender to A1.
|
||||||
|
log4j.rootCategory=ERROR, A1
|
||||||
|
|
||||||
|
log4j.appender.A1=org.apache.log4j.ConsoleAppender
|
||||||
|
|
||||||
|
|
||||||
|
# A1 uses PatternLayout.
|
||||||
|
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} [%t,%M:%L] %m%n
|
||||||
|
|
||||||
|
|
||||||
|
# Display any warnings generated by our code
|
||||||
|
#log4j.category.org.gcube=trace
|
||||||
|
#log4j.category.org.globus=trace
|
||||||
|
#log4j.category.isclient=INFO
|
||||||
|
#log4j.category.org.gcube.common.homelibrary.jcr=TRACE
|
||||||
|
|
||||||
|
|
||||||
|
log4j.category.org.gcube.portlets.user.workspace=TRACE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
log4j.logger.org.gcube=TRACE
|
||||||
|
log4j.logger.org.gcube.application.framework.core.session=INFO
|
||||||
|
log4j.logger.org.gcube.contentmanager=ERROR
|
||||||
|
log4j.logger.org.gcube.common.scope=ERROR
|
||||||
|
log4j.logger.org.gcube.contentmanagement=ERROR
|
||||||
|
log4j.logger.org.gcube.resources.discovery.icclient=ERROR
|
||||||
|
log4j.logger.org.gcube.common.clients=ERROR
|
||||||
|
#log4j.logger.org.gcube.common.homelibrary.jcr=TRACE
|
||||||
|
log4j.logger.org.gcube.application.framework.accesslogger=ERROR
|
||||||
|
log4j.logger.org.apache.pdfbox.util.PDFStreamEngine=ERROR
|
||||||
|
|
Reference in New Issue