git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/branches/data-access/obis-spd-plugin/1.8@115621 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
77c461eeaa
commit
0d574afdc7
|
@ -1,4 +1,7 @@
|
||||||
<ReleaseNotes>
|
<ReleaseNotes>
|
||||||
|
<Changeset component="org.gcube.data-access.obis-spd-plugin.1-8-2" date="2013-11-28">
|
||||||
|
<Change>Added more basis of record</Change>
|
||||||
|
</Changeset>
|
||||||
<Changeset component="org.gcube.data-access.obis-spd-plugin.1-8-1" date="2013-11-28">
|
<Changeset component="org.gcube.data-access.obis-spd-plugin.1-8-1" date="2013-11-28">
|
||||||
<Change> Added field SNAutorship and Dataset to occurrence points</Change>
|
<Change> Added field SNAutorship and Dataset to occurrence points</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
|
|
10
pom.xml
10
pom.xml
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.data.spd</groupId>
|
<groupId>org.gcube.data.spd</groupId>
|
||||||
<artifactId>obis-spd-plugin</artifactId>
|
<artifactId>obis-spd-plugin</artifactId>
|
||||||
<version>1.8.1-SNAPSHOT</version>
|
<version>1.8.2-SNAPSHOT</version>
|
||||||
<name>ObisPlugin</name>
|
<name>ObisPlugin</name>
|
||||||
<description>obis plugin for species manager service</description>
|
<description>obis plugin for species manager service</description>
|
||||||
|
|
||||||
|
@ -48,6 +48,14 @@
|
||||||
<artifactId>common-utils-encryption</artifactId>
|
<artifactId>common-utils-encryption</artifactId>
|
||||||
<version>[1.0.2-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
<version>[1.0.2-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.11</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -235,19 +235,12 @@ public class ObisClient {
|
||||||
|
|
||||||
public static BasisOfRecord getBasisOfRecord(String basis)
|
public static BasisOfRecord getBasisOfRecord(String basis)
|
||||||
{
|
{
|
||||||
|
if (basis==null) return BasisOfRecord.Unknown;
|
||||||
if (basis==null) return BasisOfRecord.HumanObservation;
|
if (basis.equalsIgnoreCase("HumanObservation") || basis.equalsIgnoreCase("O")) return BasisOfRecord.HumanObservation;
|
||||||
|
if (basis.equalsIgnoreCase("L")) return BasisOfRecord.LivingSpecimen;
|
||||||
//"HumanObservation"
|
if (basis.equalsIgnoreCase("P")) return BasisOfRecord.Literature;
|
||||||
if (basis.equals("HumanObservation")) return BasisOfRecord.HumanObservation;
|
if (basis.equalsIgnoreCase("PreservedSpecimen") || basis.equalsIgnoreCase("S")) return BasisOfRecord.PreservedSpecimen;
|
||||||
|
return BasisOfRecord.Unknown;
|
||||||
//"preservedspecimen"
|
|
||||||
//"Preservedspecimen"
|
|
||||||
//"PreservedSpecimen"
|
|
||||||
if (basis.equalsIgnoreCase("PreservedSpecimen")) return BasisOfRecord.PreservedSpecimen;
|
|
||||||
|
|
||||||
//others
|
|
||||||
return BasisOfRecord.HumanObservation;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,15 @@ public class ObisPlugin extends AbstractPlugin {
|
||||||
obisClassification = new ObisClassification(sessionPool);
|
obisClassification = new ObisClassification(sessionPool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void initialize(DatabaseCredential databaseCredential) throws Exception {
|
||||||
|
|
||||||
|
setUseCache(true);
|
||||||
|
sessionPool = new PluginSessionPool(databaseCredential);
|
||||||
|
nameMapping = new ObisNameMapping(sessionPool);
|
||||||
|
occurrencesInterface = new ObisOccurrencesInterface(sessionPool);
|
||||||
|
obisClassification = new ObisClassification(sessionPool);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package org.gcube.data.obisplugin;
|
||||||
|
|
||||||
|
import org.gcube.data.spd.model.exceptions.StreamException;
|
||||||
|
import org.gcube.data.spd.model.products.OccurrencePoint;
|
||||||
|
import org.gcube.data.spd.obisplugin.ObisPlugin;
|
||||||
|
import org.gcube.data.spd.obisplugin.pool.DatabaseCredential;
|
||||||
|
import org.gcube.data.spd.plugin.fwk.writers.ObjectWriter;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class ObisTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void search() throws Exception{
|
||||||
|
ObisPlugin plugin= new ObisPlugin();
|
||||||
|
plugin.initialize(new DatabaseCredential("jdbc:postgresql://geoserver2.i-marine.research-infrastructures.eu/obis", "postgres", "0b1s@d4sc13nc3"));
|
||||||
|
ObjectWriter<OccurrencePoint> writer = new ObjectWriter<OccurrencePoint>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAlive() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean write(OccurrencePoint arg0) {
|
||||||
|
System.out.println(arg0.toString());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean write(StreamException arg0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
plugin.getOccurrencesInterface().searchByScientificName("Architeuthis dux", writer);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue