diff --git a/pom.xml b/pom.xml index a6ae81d..dc9428d 100644 --- a/pom.xml +++ b/pom.xml @@ -274,7 +274,6 @@ log4j log4j - runtime org.slf4j @@ -330,7 +329,7 @@ - WorkspacePortlet.html + SpeciesDiscovery.html ${webappDirectory} diff --git a/src/test/java/org/gcube/portlets/user/speciesdiscovery/client/ASLLogger.java b/src/test/java/org/gcube/portlets/user/speciesdiscovery/client/ASLLogger.java new file mode 100644 index 0000000..87344d9 --- /dev/null +++ b/src/test/java/org/gcube/portlets/user/speciesdiscovery/client/ASLLogger.java @@ -0,0 +1,94 @@ +/** + * + */ +package org.gcube.portlets.user.speciesdiscovery.client; + +import org.gcube.application.framework.accesslogger.library.impl.AccessLogger; +import org.gcube.application.framework.accesslogger.model.LoginToVreAccessLogEntry; +import org.gcube.application.framework.accesslogger.model.SimpleSearchAccessLogEntry; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * @Nov 4, 2013 + * + */ +public class ASLLogger { + + + static AccessLogger log = AccessLogger.getAccessLogger(); + static LoginToVreAccessLogEntry loginEntry = new LoginToVreAccessLogEntry(); + static String user = "test.user"; + static String scope = "/gcube/devsec/devVRE"; + + static final String SPECIES = "SPECIES"; + static final String DATASOURCE_SEARCHING = "DATASOURCE SEARCHING"; + static final String DATASOURCE_DOWLOADED = "DATASOURCE DOWLOADED"; + static final String TAXA_QUERY = "TAXA QUERY"; + static final String OCCURRENCE_QUERY = "OCCURRENCE QUERY"; + + + public static void main(String[] args) { + + + + + /* + * The first argument is the username of the user that performs the action + * The second argument is the name of the working VO/VRE + */ + log.logEntry(user, scope, loginEntry); + +// String collections[][] = new String[2][2]; +// collections[0][0] = "Earth images"; +// collections[0][1] = "12345"; +// collections[1][0] = "Landsat 7"; +// collections[1][1] = "54321"; +// +// +// SimpleSearchAccessLogEntry simpleEntry = new SimpleSearchAccessLogEntry(collections, "satellite, sea"); +// /* +// * The first argument is the username of the user that performs the action +// * The second argument is the name of the working VO/VRE +// */ +// log.logEntry(user, scope, simpleEntry); +// + + + //DATA SOURCE + + String dataSources[][] = new String[1][2]; + dataSources[0][0] = "GBIF"; + dataSources[0][1] = SPDAccessLoggerType.DATASOURCE_SEARCHING.getId(); + + + SimpleSearchAccessLogEntry simpleEntry = new SimpleSearchAccessLogEntry(dataSources, "GBIF"); + + log.logEntry(user, scope, simpleEntry); + + + //species + + String species[][] = new String[1][2]; + species[0][0] = "Sarda sarda"; + species[0][1] = SPDAccessLoggerType.SPECIES.getId(); + + + simpleEntry = new SimpleSearchAccessLogEntry(species, "Sarda sarda"); + log.logEntry(user, scope, simpleEntry); + + + //species + + String query[][] = new String[1][2]; + query[0][0] = "Taxa Query bla bla"; + query[0][1] = SPDAccessLoggerType.TAXA_QUERY.getId(); + + simpleEntry = new SimpleSearchAccessLogEntry(query, "Taxa Query bla bla"); + log.logEntry(user, scope, simpleEntry); + + System.out.println("completed"); + } + + + +} diff --git a/src/test/java/org/gcube/portlets/user/speciesdiscovery/client/SPDAccessLoggerType.java b/src/test/java/org/gcube/portlets/user/speciesdiscovery/client/SPDAccessLoggerType.java new file mode 100644 index 0000000..1eeb61c --- /dev/null +++ b/src/test/java/org/gcube/portlets/user/speciesdiscovery/client/SPDAccessLoggerType.java @@ -0,0 +1,46 @@ +/** + * + */ +package org.gcube.portlets.user.speciesdiscovery.client; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * @Nov 4, 2013 + * + */ +public enum SPDAccessLoggerType { + + SPECIES("SPECIES", "SPECIES"), + DATASOURCE_SEARCHING("DATASOURCE_SEARCHING", "DATASOURCE SEARCHING"), + DATASOURCE_DOWLOADED("DATASOURCE_DOWLOADED", "DATASOURCE DOWLOADED"), + TAXA_QUERY("TAXA_QUERY", "TAXA QUERY"), + OCCURRENCE_QUERY("OCCURRENCE_QUERY", "OCCURRENCE QUERY"), + MAP_GENERATION("MAP_GENERATION", "MAP GENERATION"); + + private String name; + private String id; + + /** + * + */ + private SPDAccessLoggerType(String id, String name) { + this.id = id; + this.name = name; + } + + protected String getName() { + return name; + } + + protected void setName(String name) { + this.name = name; + } + + protected String getId() { + return id; + } + + protected void setId(String id) { + this.id = id; + } +}