git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/branches/data-access/spd-model-library/3.2@141986 82a268e6-3cf1-43bd-a215-b396298e98cf
commit
fe1bedb303
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/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/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>spd-model</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,7 @@
|
||||
#Thu Jan 10 12:34:05 CET 2013
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/main/resources=UTF-8
|
||||
encoding//src/test/java=UTF-8
|
||||
encoding//src/test/resources=UTF-8
|
||||
encoding/<project>=UTF-8
|
@ -0,0 +1,6 @@
|
||||
#Thu Dec 13 17:11:20 CET 2012
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
@ -0,0 +1,5 @@
|
||||
#Thu Dec 13 16:12:55 CET 2012
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
@ -0,0 +1 @@
|
||||
Used as a Library in the gCube Framework
|
@ -0,0 +1,6 @@
|
||||
gCube System - License
|
||||
------------------------------------------------------------
|
||||
|
||||
The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
The software and documentation is provided by its authors/distributors "as is" and no expressed or
|
||||
implied warranty is given for its use, quality or fitness for a particular case.
|
@ -0,0 +1,2 @@
|
||||
Lucio lelii (lucio.lelii@isti.cnr.it), CNR Pisa,
|
||||
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".
|
@ -0,0 +1,47 @@
|
||||
The gCube System - spd model library
|
||||
|
||||
------------------------------------------------------------
|
||||
|
||||
This work has been partially supported by the following European projects: DILIGENT (FP6-2003-IST-2),
|
||||
D4Science (FP7-INFRA-2007-1.2.2), D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2),
|
||||
and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil).
|
||||
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
* Lucio Lelii (lucio.lelii@isti.cnr.it), CNR Pisa,
|
||||
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".
|
||||
|
||||
|
||||
Version and Release Date
|
||||
------------------------
|
||||
|
||||
v. 1.0.0 (17-01-2013)
|
||||
* First release
|
||||
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
|
||||
|
||||
Download information
|
||||
--------------------
|
||||
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
Documentation is available on-line from the Projects Documentation Wiki:
|
||||
https://gcube.wiki.gcube-system.org/gcube/index.php/Biodiversity_Access
|
||||
|
||||
|
||||
Licensing
|
||||
---------
|
||||
|
||||
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
|
||||
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
<ReleaseNotes>
|
||||
<Changeset component="data-access.spd-model-library.1-0-0" date="2013-01-17">
|
||||
<Change>First Release</Change>
|
||||
</Changeset>
|
||||
<Changeset component="data-access.spd-model-library.2-0-0" date="2013-05-02">
|
||||
<Change>modified packages</Change>
|
||||
</Changeset>
|
||||
<Changeset component="data-access.spd-model-library.3-0-0" date="2013-05-02">
|
||||
<Change>some bug fixing</Change>
|
||||
</Changeset>
|
||||
<Changeset component="data-access.spd-model-library.3-0-1" date="2013-05-02">
|
||||
<Change>new Elements added to Basis of record Enumerator</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
@ -0,0 +1,42 @@
|
||||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||
<id>servicearchive</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<baseDirectory>/</baseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
<includes>
|
||||
<include>README</include>
|
||||
<include>LICENSE</include>
|
||||
<include>INSTALL</include>
|
||||
<include>MAINTAINERS</include>
|
||||
<include>changelog.xml</include>
|
||||
</includes>
|
||||
<fileMode>755</fileMode>
|
||||
<filtered>true</filtered>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<files>
|
||||
<file>
|
||||
<source>${distroDirectory}/profile.xml</source>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<filtered>true</filtered>
|
||||
</file>
|
||||
<file>
|
||||
<source>target/${build.finalName}.jar</source>
|
||||
<outputDirectory>/${artifactId}</outputDirectory>
|
||||
</file>
|
||||
<file>
|
||||
<source>${distroDirectory}/svnpath.txt</source>
|
||||
<outputDirectory>/${artifactId}</outputDirectory>
|
||||
<filtered>true</filtered>
|
||||
</file>
|
||||
</files>
|
||||
</assembly>
|
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Resource>
|
||||
<ID></ID>
|
||||
<Type>Service</Type>
|
||||
<Profile>
|
||||
<Description>${description}</Description>
|
||||
<Class>DataAccess</Class>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>1.0.0</Version>
|
||||
<Packages>
|
||||
<Software>
|
||||
<Description>${description}</Description>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>${version}</Version>
|
||||
<MavenCoordinates>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
<version>${version}</version>
|
||||
</MavenCoordinates>
|
||||
<Type>library</Type>
|
||||
<Files>
|
||||
<File>${build.finalName}.jar</File>
|
||||
</Files>
|
||||
</Software>
|
||||
</Packages>
|
||||
</Profile>
|
||||
</Resource>
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
https://gcube.wiki.gcube-system.org/gcube/index.php/Biodiversity_Access
|
@ -0,0 +1,83 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.gcube.tools</groupId>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<groupId>org.gcube.data.spd</groupId>
|
||||
<artifactId>spd-model</artifactId>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
<name>spd model</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-validator</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<distroDirectory>${project.basedir}/distro</distroDirectory>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-profile</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>target</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>profile.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>servicearchive</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -0,0 +1,27 @@
|
||||
package org.gcube.data.spd.model;
|
||||
|
||||
/*
|
||||
FOSSIL_SPECIMEN
|
||||
An occurrence record describing a fossilized specimen.
|
||||
HUMAN_OBSERVATION
|
||||
An occurrence record describing an observation made by one or more people.
|
||||
LITERATURE
|
||||
An occurrence record based on literature alone.
|
||||
LIVING_SPECIMEN
|
||||
An occurrence record describing a living specimen, e.g.
|
||||
MACHINE_OBSERVATION
|
||||
An occurrence record describing an observation made by a machine.
|
||||
MATERIAL_SAMPLE
|
||||
An occurrence record based on samples taken from other specimens or the environment.
|
||||
OBSERVATION
|
||||
An occurrence record describing an observation.
|
||||
PRESERVED_SPECIMEN
|
||||
An occurrence record describing a preserved specimen.
|
||||
UNKNOWN
|
||||
*/
|
||||
public enum BasisOfRecord {
|
||||
|
||||
PreservedSpecimen, FossilSpecimen, LivingSpecimen, HumanObservation,
|
||||
MachineObservation, Observation, Literature, MaterialSample, Unknown
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package org.gcube.data.spd.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class CommonName implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
@XmlAttribute
|
||||
private String language;
|
||||
@XmlAttribute
|
||||
private String name;
|
||||
@XmlAttribute
|
||||
private String locality;
|
||||
|
||||
protected CommonName(){}
|
||||
|
||||
public CommonName(String language, String name) {
|
||||
super();
|
||||
this.language = language;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getLocality() {
|
||||
return locality;
|
||||
}
|
||||
|
||||
public void setLocality(String locality) {
|
||||
this.locality = locality;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
StringBuilder toReturn = new StringBuilder();
|
||||
toReturn.append("[ language: "+this.language+"]");
|
||||
toReturn.append("[ name: "+this.name+"]");
|
||||
return toReturn.toString();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package org.gcube.data.spd.model;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
|
||||
public class Condition implements Comparable<Condition>{
|
||||
|
||||
public enum Operator {GE, GT, LE, LT, EQ}
|
||||
|
||||
Object value;
|
||||
Conditions cond;
|
||||
Operator op;
|
||||
|
||||
public Condition(Conditions cond,Object value, Operator op){
|
||||
this.value = value;
|
||||
this.cond = cond;
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
public boolean isValid(){
|
||||
return cond.getType().equals(value.getClass());
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Operator getOp() {
|
||||
return op;
|
||||
}
|
||||
|
||||
|
||||
public Conditions getType() {
|
||||
return cond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Condition o) {
|
||||
if (o.equals(this)) return 0;
|
||||
if (o.getType()!= this.getType()) return o.getType().compareTo(this.getType());
|
||||
if (o.getOp()!= this.getOp()) return o.getOp().compareTo(this.getOp());
|
||||
switch (this.getType()) {
|
||||
case DATE:
|
||||
return ((Calendar)this.getValue()).compareTo((Calendar)o.getValue());
|
||||
case COORDINATE:
|
||||
return ((Coordinate)this.getValue()).compareTo((Coordinate)o.getValue());
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((cond == null) ? 0 : cond.hashCode());
|
||||
result = prime * result + ((op == null) ? 0 : op.hashCode());
|
||||
result = prime * result + ((value == null) ? 0 : value.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Condition other = (Condition) obj;
|
||||
if (cond != other.cond)
|
||||
return false;
|
||||
if (op != other.op)
|
||||
return false;
|
||||
if (value == null) {
|
||||
if (other.value != null)
|
||||
return false;
|
||||
} else if (!value.equals(other.value))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
package org.gcube.data.spd.model;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@XmlEnum
|
||||
public enum Conditions {
|
||||
|
||||
DATE(Calendar.class),
|
||||
COORDINATE(Coordinate.class);
|
||||
|
||||
|
||||
private Class type;
|
||||
|
||||
Conditions(Class type){
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Class getType(){return this.type;}
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package org.gcube.data.spd.model;
|
||||
|
||||
public class Constants {
|
||||
|
||||
public static final String APPLICATION_ROOT_PATH = "/gcube/service";
|
||||
|
||||
public static final String MANAGER_PATH = "retrieve";
|
||||
|
||||
public static final String RESULTSET_PATH = "resultset";
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package org.gcube.data.spd.model;
|
||||
|
||||
public class Coordinate implements Comparable<Coordinate>{
|
||||
|
||||
private double latitude;
|
||||
private double longitude;
|
||||
|
||||
public Coordinate(double latitude, double longitude) {
|
||||
super();
|
||||
this.latitude = latitude;
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public double getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Coordinate o) {
|
||||
if (this.latitude>o.getLatitude()) return 1;
|
||||
else if (this.latitude<o.getLatitude()) return -1;
|
||||
|
||||
if (this.longitude>o.getLongitude()) return 1;
|
||||
else if (this.longitude<o.getLongitude()) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package org.gcube.data.spd.model;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class KeyValue {
|
||||
|
||||
KeyValue(){};
|
||||
|
||||
|
||||
@XmlAttribute
|
||||
private String key;
|
||||
|
||||
@XmlAttribute
|
||||
private String value;
|
||||
|
||||
public KeyValue(String key, String value) {
|
||||
super();
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "KeyValue [key=" + key + ", value=" + value + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
package org.gcube.data.spd.model;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
import org.gcube.data.spd.model.service.types.MapAdapter;
|
||||
import org.gcube.data.spd.model.util.Capabilities;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class PluginDescription {
|
||||
|
||||
private String name;
|
||||
private String description;
|
||||
private RepositoryInfo info;
|
||||
|
||||
@XmlJavaTypeAdapter(MapAdapter.class)
|
||||
private Map<Capabilities, List<Conditions>> supportedCapabilities = Collections.emptyMap();
|
||||
|
||||
private boolean isRemote = false;
|
||||
|
||||
public PluginDescription(){}
|
||||
|
||||
public PluginDescription(String name, String description,
|
||||
RepositoryInfo info) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public Map<Capabilities, List<Conditions>> getSupportedCapabilities() {
|
||||
return supportedCapabilities;
|
||||
}
|
||||
|
||||
public void setSupportedCapabilities(Map<Capabilities, List<Conditions>> supportedCapabilities) {
|
||||
this.supportedCapabilities = supportedCapabilities;
|
||||
}
|
||||
|
||||
|
||||
public boolean isRemote() {
|
||||
return isRemote;
|
||||
}
|
||||
|
||||
public void setRemote(boolean isRemote) {
|
||||
this.isRemote = isRemote;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public RepositoryInfo getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
public void setInfo(RepositoryInfo info) {
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
PluginDescription other = (PluginDescription) obj;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PluginDescription [name=" + name + ", description="
|
||||
+ description + ", info=" + info + ", supportedCapabilities="
|
||||
+ supportedCapabilities + ", isRemote=" + isRemote + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package org.gcube.data.spd.model;
|
||||
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class PointInfo {
|
||||
|
||||
PointInfo(){};
|
||||
|
||||
public PointInfo(double x, double y) {
|
||||
super();
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
|
||||
@XmlAttribute(required=true)
|
||||
double x;
|
||||
@XmlAttribute(required=true)
|
||||
double y;
|
||||
|
||||
@XmlElement(required=true, nillable=true)
|
||||
List<KeyValue> propertiesList;
|
||||
|
||||
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public List<KeyValue> getPropertiesList() {
|
||||
return propertiesList;
|
||||
}
|
||||
|
||||
public void setPropertiesList(List<KeyValue> propertiesList) {
|
||||
this.propertiesList = propertiesList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package org.gcube.data.spd.model;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public interface PropertySupport {
|
||||
|
||||
public Set<Conditions> getSupportedProperties();
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package org.gcube.data.spd.model;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class RepositoryInfo {
|
||||
|
||||
private String logoUrl;
|
||||
private String pageReferenceUrl;
|
||||
private String description;
|
||||
|
||||
private Map<String, String> properties= new HashMap<String, String>();
|
||||
|
||||
protected RepositoryInfo(){};
|
||||
|
||||
public RepositoryInfo(String logoUrl, String pageReferenceUrl, String description) {
|
||||
this.logoUrl = logoUrl;
|
||||
this.pageReferenceUrl = pageReferenceUrl;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getLogoUrl() {
|
||||
return logoUrl;
|
||||
}
|
||||
|
||||
public String getPageReferenceUrl() {
|
||||
return pageReferenceUrl;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public Map<String, String> getProperties() {
|
||||
return Collections.unmodifiableMap(properties);
|
||||
}
|
||||
|
||||
public void addProperty(String key, String value){
|
||||
this.properties.put(key, value);
|
||||
}
|
||||
|
||||
public void resetProperties(){
|
||||
this.properties = new HashMap<String, String>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RepositoryInfo [logoUrl=" + logoUrl + ", pageReferenceUrl="
|
||||
+ pageReferenceUrl + ", description=" + description
|
||||
+ ", properties=" + properties + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package org.gcube.data.spd.model.binding;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
|
||||
import org.gcube.data.spd.model.PointInfo;
|
||||
import org.gcube.data.spd.model.products.OccurrencePoint;
|
||||
import org.gcube.data.spd.model.products.ResultItem;
|
||||
import org.gcube.data.spd.model.products.TaxonomyItem;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
|
||||
public class Bindings {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(Bindings.class);
|
||||
|
||||
private static JAXBContext context ;
|
||||
|
||||
static{
|
||||
try {
|
||||
context = JAXBContext.newInstance(OccurrencePoint.class, TaxonomyItem.class, ResultItem.class, PointInfo.class);
|
||||
} catch (JAXBException e) {
|
||||
logger.error("error preparing the binding ",e);
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> String toXml(T obj) throws JAXBException{
|
||||
StringWriter sw = new StringWriter();
|
||||
if (obj==null)
|
||||
throw new JAXBException("null value passed");
|
||||
Marshaller m = context.createMarshaller();
|
||||
m.setProperty(Marshaller.JAXB_FRAGMENT, true);
|
||||
m.marshal(obj, sw);
|
||||
return sw.toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T fromXml(String payload) throws JAXBException {
|
||||
return (T) context.createUnmarshaller().unmarshal(new StringReader(payload));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package org.gcube.data.spd.model.exceptions;
|
||||
|
||||
public class ExternalRepositoryException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ExternalRepositoryException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ExternalRepositoryException(String arg0, Throwable arg1) {
|
||||
super(arg0, arg1);
|
||||
}
|
||||
|
||||
public ExternalRepositoryException(String arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
public ExternalRepositoryException(Throwable arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package org.gcube.data.spd.model.exceptions;
|
||||
|
||||
public class IdNotValidException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6500170339362279314L;
|
||||
|
||||
public IdNotValidException() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public IdNotValidException(String arg0, Throwable arg1) {
|
||||
super(arg0, arg1);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public IdNotValidException(String arg0) {
|
||||
super(arg0);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public IdNotValidException(Throwable arg0) {
|
||||
super(arg0);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package org.gcube.data.spd.model.exceptions;
|
||||
|
||||
public class InvalidQueryException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public InvalidQueryException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public InvalidQueryException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
|
||||
}
|
||||
|
||||
public InvalidQueryException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public InvalidQueryException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package org.gcube.data.spd.model.exceptions;
|
||||
|
||||
public class InvalidRecordException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public InvalidRecordException() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public InvalidRecordException(String message) {
|
||||
super(message);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public InvalidRecordException(Throwable cause) {
|
||||
super(cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public InvalidRecordException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package org.gcube.data.spd.model.exceptions;
|
||||
|
||||
public class MethodNotSupportedException extends Exception{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package org.gcube.data.spd.model.exceptions;
|
||||
|
||||
public class RetrySameStreamException extends StreamNonBlockingException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RetrySameStreamException(String repositoryName, String identifier) {
|
||||
super(repositoryName, identifier);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package org.gcube.data.spd.model.exceptions;
|
||||
|
||||
public class StreamBlockingException extends StreamException {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 167182159965012187L;
|
||||
|
||||
public StreamBlockingException(String repositoryName, String identifier) {
|
||||
super(repositoryName, identifier);
|
||||
}
|
||||
|
||||
public StreamBlockingException(String repositoryName) {
|
||||
super(repositoryName, "");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package org.gcube.data.spd.model.exceptions;
|
||||
|
||||
public abstract class StreamException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6254059644228632966L;
|
||||
|
||||
private String repositoryName;
|
||||
private String identifier;
|
||||
|
||||
public StreamException(String repositoryName, String identifier) {
|
||||
super();
|
||||
this.repositoryName = repositoryName;
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
public String getRepositoryName() {
|
||||
return repositoryName;
|
||||
}
|
||||
|
||||
public String getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package org.gcube.data.spd.model.exceptions;
|
||||
|
||||
public class StreamNonBlockingException extends StreamException {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3889030287274902179L;
|
||||
|
||||
public StreamNonBlockingException(String repositoryName, String identifier) {
|
||||
super(repositoryName, identifier);
|
||||
}
|
||||
|
||||
public StreamNonBlockingException(String repositoryName) {
|
||||
super(repositoryName, "");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package org.gcube.data.spd.model.exceptions;
|
||||
|
||||
public class WrapperAlreadyDisposedException extends Exception{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public WrapperAlreadyDisposedException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public WrapperAlreadyDisposedException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public WrapperAlreadyDisposedException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public WrapperAlreadyDisposedException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package org.gcube.data.spd.model.products;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.gcube.common.validator.annotations.NotNull;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class DataProvider {
|
||||
|
||||
|
||||
protected DataProvider(){}
|
||||
|
||||
@NotNull
|
||||
@XmlElement
|
||||
private String name;
|
||||
@NotNull
|
||||
@XmlAttribute
|
||||
private String id;
|
||||
|
||||
public DataProvider(String id) {
|
||||
super();
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/*
|
||||
protected Node node(){
|
||||
return n(id, e(Labels.NAME_TAG, this.name));
|
||||
}
|
||||
|
||||
protected static DataProvider fromNode(InnerNode node) throws Exception{
|
||||
DataProvider dataProvider= new DataProvider(node.id());
|
||||
for (Field field: DataProvider.class.getDeclaredFields())
|
||||
if (node.hasEdge(field.getName()) && (node.edge(field.getName()).target() instanceof Leaf)){
|
||||
field.setAccessible(true);
|
||||
field.set(dataProvider, ((Leaf) node.edge(field.getName()).target()).value());
|
||||
}
|
||||
return dataProvider;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DataProvider [name=" + name + ", id=" + id + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package org.gcube.data.spd.model.products;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.gcube.common.validator.annotations.IsValid;
|
||||
import org.gcube.common.validator.annotations.NotNull;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class DataSet {
|
||||
|
||||
protected DataSet(){}
|
||||
|
||||
@NotNull
|
||||
@XmlAttribute
|
||||
private String id;
|
||||
@XmlElement
|
||||
private String citation;
|
||||
@NotNull
|
||||
@XmlElement
|
||||
private String name;
|
||||
@NotNull
|
||||
@IsValid
|
||||
@XmlElement
|
||||
private DataProvider dataProvider;
|
||||
|
||||
public DataSet(String id) {
|
||||
super();
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCitation() {
|
||||
return citation;
|
||||
}
|
||||
public void setCitation(String citation) {
|
||||
this.citation = citation;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public DataProvider getDataProvider() {
|
||||
return dataProvider;
|
||||
}
|
||||
|
||||
public void setDataProvider(DataProvider dataProvider) {
|
||||
this.dataProvider = dataProvider;
|
||||
}
|
||||
/*
|
||||
protected Node node(){
|
||||
return n(id,e(Labels.DATAPROVIDER_TAG, this.dataProvider.node()), e(Labels.CITATION_LABEL, this.citation), e(Labels.NAME_TAG, this.name));
|
||||
}
|
||||
|
||||
protected static DataSet fromNode(InnerNode node) throws Exception{
|
||||
DataSet dataSet= new DataSet(node.id());
|
||||
for (Field field: DataSet.class.getDeclaredFields())
|
||||
if (node.hasEdge(field.getName()) && (node.edge(field.getName()).target() instanceof Leaf)){
|
||||
field.setAccessible(true);
|
||||
field.set(dataSet, ((Leaf) node.edge(field.getName()).target()).value());
|
||||
}
|
||||
if (node.hasEdge(Labels.DATAPROVIDER_TAG))
|
||||
dataSet.setDataProvider(DataProvider.fromNode((InnerNode)node.child(Labels.DATAPROVIDER_TAG)));
|
||||
return dataSet;
|
||||
}
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DataSet [id=" + id + ", citation=" + citation + ", name="
|
||||
+ name + ", dataProvider=" + dataProvider + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package org.gcube.data.spd.model.products;
|
||||
|
||||
public class Image {
|
||||
|
||||
String id;
|
||||
String type;
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,328 @@
|
||||
package org.gcube.data.spd.model.products;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.gcube.common.validator.annotations.IsValid;
|
||||
import org.gcube.common.validator.annotations.NotEmpty;
|
||||
import org.gcube.common.validator.annotations.NotNull;
|
||||
import org.gcube.data.spd.model.BasisOfRecord;
|
||||
import org.gcube.data.spd.model.util.ElementProperty;
|
||||
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class OccurrencePoint implements ResultElement{
|
||||
|
||||
@NotNull
|
||||
@NotEmpty
|
||||
@XmlAttribute
|
||||
private String id;
|
||||
|
||||
@XmlAttribute
|
||||
private String provider;
|
||||
|
||||
@XmlAttribute
|
||||
private String scientificNameAuthorship;
|
||||
|
||||
@XmlAttribute
|
||||
private String identifiedBy;
|
||||
|
||||
@XmlAttribute
|
||||
private String recordedBy;
|
||||
|
||||
@XmlAttribute
|
||||
private String credits;
|
||||
|
||||
@XmlAttribute
|
||||
private String institutionCode;
|
||||
|
||||
@XmlAttribute
|
||||
private String collectionCode;
|
||||
|
||||
@XmlAttribute
|
||||
private String catalogueNumber;
|
||||
|
||||
|
||||
|
||||
@XmlAttribute
|
||||
private Calendar eventDate;
|
||||
|
||||
@XmlAttribute
|
||||
private Calendar modified;
|
||||
|
||||
@NotNull
|
||||
@NotEmpty
|
||||
@XmlAttribute
|
||||
private String scientificName;
|
||||
|
||||
@XmlAttribute
|
||||
private String kingdom;
|
||||
|
||||
@XmlAttribute
|
||||
private String family;
|
||||
|
||||
@XmlAttribute
|
||||
private String locality;
|
||||
|
||||
@XmlAttribute
|
||||
private String country;
|
||||
|
||||
@XmlAttribute
|
||||
private String citation;
|
||||
|
||||
@XmlAttribute
|
||||
private double decimalLatitude;
|
||||
|
||||
@XmlAttribute
|
||||
private double decimalLongitude;
|
||||
|
||||
@XmlAttribute
|
||||
private String coordinateUncertaintyInMeters;
|
||||
|
||||
@XmlAttribute
|
||||
private double maxDepth;
|
||||
|
||||
@XmlAttribute
|
||||
private double minDepth;
|
||||
|
||||
@NotNull
|
||||
@XmlAttribute
|
||||
private BasisOfRecord basisOfRecord;
|
||||
|
||||
@IsValid
|
||||
@XmlElement
|
||||
private DataSet dataSet;
|
||||
|
||||
@XmlElement
|
||||
private List<ElementProperty> properties = new ArrayList<ElementProperty>() ;
|
||||
|
||||
|
||||
protected OccurrencePoint(){}
|
||||
|
||||
public OccurrencePoint(String id) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.basisOfRecord = BasisOfRecord.HumanObservation;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getCitation() {
|
||||
return citation;
|
||||
}
|
||||
public void setCitation(String citation) {
|
||||
this.citation = citation;
|
||||
}
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
public String getInstitutionCode() {
|
||||
return institutionCode;
|
||||
}
|
||||
public void setInstitutionCode(String institutionCode) {
|
||||
this.institutionCode = institutionCode;
|
||||
}
|
||||
public String getCollectionCode() {
|
||||
return collectionCode;
|
||||
}
|
||||
public void setCollectionCode(String collectionCode) {
|
||||
this.collectionCode = collectionCode;
|
||||
}
|
||||
public String getRecordedBy() {
|
||||
return recordedBy;
|
||||
}
|
||||
public void setRecordedBy(String recordedBy) {
|
||||
this.recordedBy = recordedBy;
|
||||
}
|
||||
public Calendar getEventDate() {
|
||||
return eventDate;
|
||||
}
|
||||
public void setEventDate(Calendar eventDate) {
|
||||
this.eventDate = eventDate;
|
||||
}
|
||||
public String getScientificName() {
|
||||
return scientificName;
|
||||
}
|
||||
public void setScientificName(String scientificName) {
|
||||
this.scientificName = scientificName;
|
||||
}
|
||||
public String getKingdom() {
|
||||
return kingdom;
|
||||
}
|
||||
public void setKingdom(String kingdom) {
|
||||
this.kingdom = kingdom;
|
||||
}
|
||||
public String getFamily() {
|
||||
return family;
|
||||
}
|
||||
public void setFamily(String family) {
|
||||
this.family = family;
|
||||
}
|
||||
public String getLocality() {
|
||||
return locality;
|
||||
}
|
||||
public void setLocality(String locality) {
|
||||
this.locality = locality;
|
||||
}
|
||||
public double getDecimalLatitude() {
|
||||
return decimalLatitude;
|
||||
}
|
||||
public void setDecimalLatitude(double decimalLatitude) {
|
||||
this.decimalLatitude = decimalLatitude;
|
||||
}
|
||||
public double getDecimalLongitude() {
|
||||
return decimalLongitude;
|
||||
}
|
||||
public void setDecimalLongitude(double decimalLongitude) {
|
||||
this.decimalLongitude = decimalLongitude;
|
||||
}
|
||||
public String getCoordinateUncertaintyInMeters() {
|
||||
return coordinateUncertaintyInMeters;
|
||||
}
|
||||
public void setCoordinateUncertaintyInMeters(String coordinateUncertaintyInMeters) {
|
||||
this.coordinateUncertaintyInMeters = coordinateUncertaintyInMeters;
|
||||
}
|
||||
public BasisOfRecord getBasisOfRecord() {
|
||||
return basisOfRecord;
|
||||
}
|
||||
public void setBasisOfRecord(BasisOfRecord basisOfRecord) {
|
||||
this.basisOfRecord = basisOfRecord;
|
||||
}
|
||||
public double getMaxDepth() {
|
||||
return maxDepth;
|
||||
}
|
||||
public void setMaxDepth(double maxDepth) {
|
||||
this.maxDepth = maxDepth;
|
||||
}
|
||||
public double getMinDepth() {
|
||||
return minDepth;
|
||||
}
|
||||
public void setMinDepth(double minDepth) {
|
||||
this.minDepth = minDepth;
|
||||
}
|
||||
|
||||
public Calendar getModified() {
|
||||
return modified;
|
||||
}
|
||||
public void setModified(Calendar modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
public String getCatalogueNumber() {
|
||||
return catalogueNumber;
|
||||
}
|
||||
public void setCatalogueNumber(String catalogueNumber) {
|
||||
this.catalogueNumber = catalogueNumber;
|
||||
}
|
||||
|
||||
public DataSet getDataSet() {
|
||||
return dataSet;
|
||||
}
|
||||
public void setDataSet(DataSet dataSet) {
|
||||
this.dataSet = dataSet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public void setProvider(String provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
public ResultType getType() {
|
||||
return ResultType.OCCURRENCEPOINT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the scientificNameAuthorship
|
||||
*/
|
||||
public String getScientificNameAuthorship() {
|
||||
return scientificNameAuthorship;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scientificNameAuthorship the scientificNameAuthorship to set
|
||||
*/
|
||||
public void setScientificNameAuthorship(String scientificNameAuthorship) {
|
||||
this.scientificNameAuthorship = scientificNameAuthorship;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the identifiedBy
|
||||
*/
|
||||
public String getIdentifiedBy() {
|
||||
return identifiedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param identifiedBy the identifiedBy to set
|
||||
*/
|
||||
public void setIdentifiedBy(String identifiedBy) {
|
||||
this.identifiedBy = identifiedBy;
|
||||
}
|
||||
|
||||
public String getCredits() {
|
||||
return credits;
|
||||
}
|
||||
|
||||
public void setCredits(String credits) {
|
||||
this.credits = credits;
|
||||
}
|
||||
|
||||
public void addProperty(ElementProperty property){
|
||||
this.properties.add(property);
|
||||
}
|
||||
|
||||
public void resetProperties(){
|
||||
this.properties = new ArrayList<ElementProperty>();
|
||||
}
|
||||
|
||||
|
||||
public List<ElementProperty> getProperties() {
|
||||
return Collections.unmodifiableList(properties);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OccurrencePoint [id=" + id + ", provider=" + provider
|
||||
+ ", scientificNameAuthorship=" + scientificNameAuthorship
|
||||
+ ", identifiedBy=" + identifiedBy + ", recordedBy="
|
||||
+ recordedBy + ", credits=" + credits + ", institutionCode="
|
||||
+ institutionCode + ", collectionCode=" + collectionCode
|
||||
+ ", catalogueNumber=" + catalogueNumber + ", eventDate="
|
||||
+ eventDate + ", modified=" + modified + ", scientificName="
|
||||
+ scientificName + ", kingdom=" + kingdom + ", family="
|
||||
+ family + ", locality=" + locality + ", country=" + country
|
||||
+ ", citation=" + citation + ", decimalLatitude="
|
||||
+ decimalLatitude + ", decimalLongitude=" + decimalLongitude
|
||||
+ ", coordinateUncertaintyInMeters="
|
||||
+ coordinateUncertaintyInMeters + ", maxDepth=" + maxDepth
|
||||
+ ", minDepth=" + minDepth + ", basisOfRecord=" + basisOfRecord
|
||||
+ ", dataSet=" + dataSet + ", properties=" + properties + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package org.gcube.data.spd.model.products;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class Product {
|
||||
|
||||
public enum ProductType {
|
||||
Occurrence,
|
||||
Taxon,
|
||||
Synonym
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
private ProductType type;
|
||||
@XmlElement
|
||||
private String key;
|
||||
@XmlElement
|
||||
private int count=1;
|
||||
|
||||
protected Product(){}
|
||||
|
||||
public Product(ProductType type, String key) {
|
||||
super();
|
||||
this.type = type;
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
public ProductType getType() {
|
||||
return type;
|
||||
}
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
return "[key: "+key+", name: "+type.name()+", count: "+count+"]";
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package org.gcube.data.spd.model.products;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.data.spd.model.util.ElementProperty;
|
||||
|
||||
public interface ResultElement{
|
||||
|
||||
public enum ResultType {
|
||||
OCCURRENCEPOINT,
|
||||
TAXONOMY,
|
||||
SPECIESPRODUCTS
|
||||
}
|
||||
|
||||
ResultType getType();
|
||||
|
||||
public String getProvider();
|
||||
public String getId();
|
||||
public String getCitation();
|
||||
public String getCredits();
|
||||
|
||||
public List<ElementProperty> getProperties();
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,197 @@
|
||||
package org.gcube.data.spd.model.products;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.gcube.common.validator.annotations.IsValid;
|
||||
import org.gcube.common.validator.annotations.NotNull;
|
||||
import org.gcube.data.spd.model.CommonName;
|
||||
import org.gcube.data.spd.model.util.ElementProperty;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class ResultItem extends Taxon implements ResultElement{
|
||||
|
||||
@XmlElement
|
||||
private String provider;
|
||||
|
||||
@XmlElement
|
||||
private List<Product> products = new ArrayList<Product>();
|
||||
|
||||
@XmlElement
|
||||
private List<CommonName> commonNames= new ArrayList<CommonName>();
|
||||
|
||||
@NotNull @IsValid
|
||||
@XmlElement
|
||||
private DataSet dataSet;
|
||||
|
||||
@XmlElement
|
||||
private String credits;
|
||||
|
||||
@XmlElement
|
||||
private List<ElementProperty> properties = new ArrayList<ElementProperty>() ;
|
||||
|
||||
|
||||
protected ResultItem(){}
|
||||
|
||||
protected ResultItem(String id){
|
||||
super(id);
|
||||
}
|
||||
|
||||
public ResultItem(String id, String scientificName) {
|
||||
super(id, scientificName);
|
||||
}
|
||||
|
||||
public String getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public void setProvider(String provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
public DataSet getDataSet() {
|
||||
return dataSet;
|
||||
}
|
||||
|
||||
public void setDataSet(DataSet dataSet) {
|
||||
this.dataSet = dataSet;
|
||||
}
|
||||
|
||||
|
||||
public List<Product> getProducts() {
|
||||
return products;
|
||||
}
|
||||
|
||||
public void setProducts(List<Product> products) {
|
||||
this.products = products;
|
||||
}
|
||||
|
||||
public String getCredits() {
|
||||
return credits;
|
||||
}
|
||||
|
||||
public void setCredits(String credits) {
|
||||
this.credits = credits;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return a Map with key language and value commonName
|
||||
*/
|
||||
public List<CommonName> getCommonNames(){
|
||||
return this.commonNames;
|
||||
}
|
||||
|
||||
public void setCommonNames(List<CommonName> commonNames){
|
||||
this.commonNames= commonNames;
|
||||
}
|
||||
|
||||
public void addProperty(ElementProperty property){
|
||||
this.properties.add(property);
|
||||
}
|
||||
|
||||
public void resetProperties(){
|
||||
this.properties = new ArrayList<ElementProperty>();
|
||||
}
|
||||
|
||||
|
||||
public List<ElementProperty> getProperties() {
|
||||
return Collections.unmodifiableList(properties);
|
||||
}
|
||||
|
||||
/*
|
||||
public Tree toTree(){
|
||||
Tree tree =node();
|
||||
tree.setAttribute(Labels.PROVIDER_LABEL, this.getProvider());
|
||||
tree.add(e(Labels.DATASET_TAG, this.dataSet.node()));
|
||||
//adding commonNames tag
|
||||
List<Edge> commonNameEdges = new ArrayList<Edge>();
|
||||
for (CommonName entry : this.commonNames)
|
||||
commonNameEdges.add(e(Labels.COMMONNAME_LABEL,n(e(Labels.NAME_TAG, entry.getName()),e(Labels.LANGUAGE_TAG, entry.getLanguage()))));
|
||||
if (commonNameEdges.size()>0)
|
||||
tree.add(e(Labels.COMMONNAMES_LABEL,n(commonNameEdges.toArray(new Edge[commonNameEdges.size()]))));
|
||||
|
||||
if (products!=null){
|
||||
List<Edge> productsEdges = new ArrayList<Edge>();
|
||||
for (Product product: products)
|
||||
productsEdges.add(e(Labels.PRODUCT_LABEL,n(product.getKey(),e(Labels.TYPE_LABEL, product.getType()),e(Labels.COUNT_LABEL, product.getCount()))));
|
||||
if (productsEdges.size()>0)
|
||||
tree.add(e(Labels.PRODUCTS_LABEL,n(productsEdges.toArray(new Edge[productsEdges.size()]))));
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
public static ResultItem fromTree(Tree tree) throws Exception{
|
||||
ResultItem item = new ResultItem(tree.id());
|
||||
if (tree.hasAttribute(Labels.PROVIDER_LABEL))item.setProvider(tree.attribute(Labels.PROVIDER_LABEL));
|
||||
for (Field field: ResultItem.class.getDeclaredFields())
|
||||
if (tree.hasEdge(field.getName()) && (tree.edge(field.getName()).target() instanceof Leaf)){
|
||||
field.setAccessible(true);
|
||||
Node node = tree.edge(field.getName()).target();
|
||||
field.set(item,((Leaf) node ).value());
|
||||
}
|
||||
|
||||
for (Field field: Taxon.class.getDeclaredFields())
|
||||
if (tree.hasEdge(field.getName()) && (tree.edge(field.getName()).target() instanceof Leaf)){
|
||||
field.setAccessible(true);
|
||||
Node node = tree.edge(field.getName()).target();
|
||||
field.set(item,((Leaf) node ).value());
|
||||
}
|
||||
|
||||
//retrieving commonNames
|
||||
List<CommonName> commonNames= new ArrayList<CommonName>();
|
||||
if (tree.hasEdge(Labels.COMMONNAMES_LABEL)){
|
||||
InnerNode commonNamesNode=(InnerNode) tree.edge(Labels.COMMONNAMES_LABEL).target();
|
||||
for (Edge edge :commonNamesNode.edges(Labels.COMMONNAME_LABEL)){
|
||||
String language = ((Leaf)((InnerNode)edge.target()).edge(Labels.LANGUAGE_TAG).target()).value();
|
||||
String commonName = ((Leaf)((InnerNode)edge.target()).edge(Labels.NAME_TAG).target()).value();
|
||||
commonNames.add(new CommonName(language, commonName));
|
||||
}
|
||||
item.setCommonNames(commonNames);
|
||||
}
|
||||
|
||||
//retrieving products
|
||||
List<Product> products= new ArrayList<Product>();
|
||||
if (tree.hasEdge(Labels.PRODUCTS_LABEL)){
|
||||
InnerNode productsNode=(InnerNode) tree.edge(Labels.PRODUCTS_LABEL).target();
|
||||
for (Edge edge :productsNode.edges(Labels.PRODUCT_LABEL)){
|
||||
String type = ((Leaf)((InnerNode)edge.target()).edge(Labels.TYPE_LABEL).target()).value();
|
||||
String count = ((Leaf)((InnerNode)edge.target()).edge(Labels.COUNT_LABEL).target()).value();
|
||||
String key= edge.target().id();
|
||||
Product prod = new Product(ProductType.valueOf(type), key );
|
||||
prod.setCount(Integer.parseInt(count));
|
||||
products.add(prod);
|
||||
}
|
||||
item.setProducts(products);
|
||||
}
|
||||
|
||||
if (tree.hasEdge(Labels.PARENT_TAG))
|
||||
item.setParent(Taxon.fromNode((InnerNode)tree.child(Labels.PARENT_TAG)));
|
||||
if (tree.hasEdge(Labels.DATASET_TAG))
|
||||
item.dataSet = DataSet.fromNode((InnerNode)tree.child(Labels.DATASET_TAG));
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
public ResultType getType() {
|
||||
return ResultType.SPECIESPRODUCTS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResultItem [provider=" + provider + ", products=" + products
|
||||
+ ", commonNames=" + commonNames + ", dataSet=" + dataSet
|
||||
+ ", credits=" + credits + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,181 @@
|
||||
package org.gcube.data.spd.model.products;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.gcube.common.validator.annotations.IsValid;
|
||||
import org.gcube.common.validator.annotations.NotEmpty;
|
||||
import org.gcube.common.validator.annotations.NotNull;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class Taxon implements TaxonomyInterface {
|
||||
|
||||
@NotNull
|
||||
@NotEmpty
|
||||
@XmlAttribute
|
||||
private String id;
|
||||
@XmlAttribute
|
||||
private String rank;
|
||||
@XmlAttribute
|
||||
private String scientificName;
|
||||
@XmlAttribute
|
||||
private String citation;
|
||||
|
||||
@XmlAttribute
|
||||
private String scientificNameAuthorship;
|
||||
|
||||
@XmlAttribute
|
||||
private String credits;
|
||||
@XmlAttribute
|
||||
private String lsid;
|
||||
@IsValid
|
||||
@XmlElement
|
||||
protected Taxon parent = null;
|
||||
|
||||
protected Taxon(){}
|
||||
|
||||
public Taxon(String id){
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Taxon(String id, String scientificName){
|
||||
this.id = id;
|
||||
this.scientificName = scientificName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.data.spd.plugin.fwk.model.TaxonomyInterface#setRank(java.lang.String)
|
||||
*/
|
||||
public void setRank(String rank) {
|
||||
this.rank = rank;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.data.spd.plugin.fwk.model.TaxonomyInterface#getScientificName()
|
||||
*/
|
||||
public String getScientificName() {
|
||||
return scientificName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.data.spd.plugin.fwk.model.TaxonomyInterface#setScientificName(java.lang.String)
|
||||
*/
|
||||
public void setScientificName(String scientificName) {
|
||||
this.scientificName = scientificName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.data.spd.plugin.fwk.model.TaxonomyInterface#getCitation()
|
||||
*/
|
||||
public String getCitation() {
|
||||
return citation;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.data.spd.plugin.fwk.model.TaxonomyInterface#setCitation(java.lang.String)
|
||||
*/
|
||||
public void setCitation(String citation) {
|
||||
this.citation = citation;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.data.spd.plugin.fwk.model.TaxonomyInterface#setId(java.lang.String)
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.data.spd.plugin.fwk.model.TaxonomyInterface#getId()
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.data.spd.plugin.fwk.model.TaxonomyInterface#getRank()
|
||||
*/
|
||||
public String getRank() {
|
||||
return rank;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.data.spd.plugin.fwk.model.TaxonomyInterface#getParent()
|
||||
*/
|
||||
public Taxon getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.data.spd.plugin.fwk.model.TaxonomyInterface#setParent(org.gcube.data.spd.plugin.fwk.model.Taxon)
|
||||
*/
|
||||
public void setParent(Taxon parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the scienitificNamAuthorship
|
||||
*/
|
||||
public String getScientificNameAuthorship() {
|
||||
return scientificNameAuthorship;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scienitificNamAuthorship the scienitificNamAuthorship to set
|
||||
*/
|
||||
public void setScientificNameAuthorship(String scientificNameAuthorship) {
|
||||
this.scientificNameAuthorship = scientificNameAuthorship;
|
||||
}
|
||||
|
||||
public String getCredits() {
|
||||
return credits;
|
||||
}
|
||||
|
||||
public void setCredits(String credits) {
|
||||
this.credits = credits;
|
||||
}
|
||||
|
||||
public String getLsid() {
|
||||
return lsid;
|
||||
}
|
||||
|
||||
public void setLsid(String lsid) {
|
||||
this.lsid = lsid;
|
||||
}
|
||||
/*
|
||||
protected Tree node(){
|
||||
Tree node = t(this.id);
|
||||
if (parent!=null) node.add(e(Labels.PARENT_TAG,this.parent.node()));
|
||||
node.add(e(Labels.CITATION_LABEL, this.getCitation()));
|
||||
node.add(e(Labels.SCIENTIFICNAME_LABEL, this.getScientificName()));
|
||||
node.add(e(Labels.RANK_LABEL, this.getRank()));
|
||||
return node;
|
||||
}
|
||||
|
||||
protected static Taxon fromNode(InnerNode node) throws Exception{
|
||||
Taxon taxon = new Taxon(node.id());
|
||||
for (Field field: Taxon.class.getDeclaredFields())
|
||||
if (node.hasEdge(field.getName()) && (node.edge(field.getName()).target() instanceof Leaf)){
|
||||
field.setAccessible(true);
|
||||
field.set(taxon, ((Leaf) node.edge(field.getName()).target()).value());
|
||||
}
|
||||
if (node.hasEdge(Labels.PARENT_TAG))
|
||||
taxon.parent = Taxon.fromNode((InnerNode)node.child(Labels.PARENT_TAG));
|
||||
|
||||
return taxon;
|
||||
}
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Taxon [id=" + id + ", rank=" + rank + ", scientificName="
|
||||
+ scientificName + ", citation=" + citation + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package org.gcube.data.spd.model.products;
|
||||
|
||||
public interface TaxonomyInterface {
|
||||
|
||||
public abstract String getScientificName();
|
||||
|
||||
public abstract String getCitation();
|
||||
|
||||
public abstract String getScientificNameAuthorship();
|
||||
|
||||
public abstract String getLsid();
|
||||
|
||||
public abstract String getCredits();
|
||||
|
||||
public abstract String getId();
|
||||
|
||||
public abstract String getRank();
|
||||
|
||||
public abstract TaxonomyInterface getParent();
|
||||
|
||||
}
|
@ -0,0 +1,250 @@
|
||||
package org.gcube.data.spd.model.products;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.gcube.common.validator.annotations.IsValid;
|
||||
import org.gcube.common.validator.annotations.NotEmpty;
|
||||
import org.gcube.common.validator.annotations.NotNull;
|
||||
import org.gcube.data.spd.model.CommonName;
|
||||
import org.gcube.data.spd.model.util.ElementProperty;
|
||||
|
||||
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class TaxonomyItem implements ResultElement, TaxonomyInterface, Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotEmpty
|
||||
@NotNull
|
||||
@XmlAttribute
|
||||
private String id;
|
||||
|
||||
@XmlAttribute
|
||||
private String rank;
|
||||
|
||||
@NotEmpty
|
||||
@NotNull
|
||||
@XmlAttribute
|
||||
private String scientificName;
|
||||
|
||||
@NotEmpty
|
||||
@NotNull
|
||||
@XmlAttribute
|
||||
private String citation;
|
||||
|
||||
@XmlAttribute
|
||||
public Calendar modified;
|
||||
|
||||
@XmlAttribute
|
||||
private String scientificNameAuthorship;
|
||||
|
||||
@XmlAttribute
|
||||
private String credits;
|
||||
|
||||
@XmlAttribute
|
||||
private String lsid;
|
||||
|
||||
@IsValid
|
||||
@XmlElement
|
||||
private TaxonomyItem parent;
|
||||
|
||||
@XmlElement
|
||||
private List<CommonName> commonNames;
|
||||
|
||||
@NotNull
|
||||
@XmlElement(required=true)
|
||||
private TaxonomyStatus status;
|
||||
|
||||
@XmlAttribute
|
||||
private String provider;
|
||||
|
||||
@XmlElement
|
||||
private List<ElementProperty> properties = new ArrayList<ElementProperty>() ;
|
||||
|
||||
TaxonomyItem(){}
|
||||
|
||||
public TaxonomyItem(String id){
|
||||
this.id = id;
|
||||
this.commonNames = Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public TaxonomyItem getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getRank() {
|
||||
return rank;
|
||||
}
|
||||
|
||||
public void setRank(String rank) {
|
||||
this.rank = rank;
|
||||
}
|
||||
|
||||
public String getScientificName() {
|
||||
return scientificName;
|
||||
}
|
||||
|
||||
public void setScientificName(String scientificName) {
|
||||
this.scientificName = scientificName;
|
||||
}
|
||||
|
||||
public String getCitation() {
|
||||
return citation;
|
||||
}
|
||||
|
||||
public void setCitation(String citation) {
|
||||
this.citation = citation;
|
||||
}
|
||||
|
||||
public void setParent(TaxonomyItem parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public List<CommonName> getCommonNames() {
|
||||
return commonNames;
|
||||
}
|
||||
|
||||
public void setCommonNames(List<CommonName> commonNames) {
|
||||
this.commonNames = commonNames;
|
||||
}
|
||||
|
||||
public TaxonomyStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(TaxonomyStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public void setProvider(String provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Calendar getModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
public void setModified(Calendar modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the scientificNameAuthorship
|
||||
*/
|
||||
public String getScientificNameAuthorship() {
|
||||
return scientificNameAuthorship;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scientificNameAuthorship the scientificNameAuthorship to set
|
||||
*/
|
||||
public void setScientificNameAuthorship(String scientificNameAuthorship) {
|
||||
this.scientificNameAuthorship = scientificNameAuthorship;
|
||||
}
|
||||
|
||||
public String getCredits() {
|
||||
return credits;
|
||||
}
|
||||
|
||||
public void setCredits(String credits) {
|
||||
this.credits = credits;
|
||||
}
|
||||
|
||||
public String getLsid() {
|
||||
return lsid;
|
||||
}
|
||||
|
||||
public void setLsid(String lsid) {
|
||||
this.lsid = lsid;
|
||||
}
|
||||
|
||||
public ResultType getType() {
|
||||
return ResultType.TAXONOMY;
|
||||
}
|
||||
|
||||
public void addProperty(ElementProperty property){
|
||||
this.properties.add(property);
|
||||
}
|
||||
|
||||
public void resetProperties(){
|
||||
this.properties = new ArrayList<ElementProperty>();
|
||||
}
|
||||
|
||||
public List<ElementProperty> getProperties() {
|
||||
return Collections.unmodifiableList(properties);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaxonomyItem [id=" + id + ", rank=" + rank
|
||||
+ ", scientificName=" + scientificName + ", citation="
|
||||
+ citation + ", modified=" + modified
|
||||
+ ", commonNames=" + commonNames + ", status=" + status
|
||||
+ ", provider=" + provider + "]";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
TaxonomyItem other = (TaxonomyItem) obj;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package org.gcube.data.spd.model.products;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class TaxonomyStatus implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public enum Status{
|
||||
ACCEPTED,
|
||||
SYNONYM,
|
||||
VALID,
|
||||
INVALID,
|
||||
MISAPPLIED,
|
||||
PROVISIONAL,
|
||||
UNKNOWN
|
||||
}
|
||||
|
||||
protected TaxonomyStatus(){ }
|
||||
|
||||
public TaxonomyStatus(String statusAsString, Status status){
|
||||
this.status = status;
|
||||
this.statusAsString = statusAsString;
|
||||
this.refId = null;
|
||||
}
|
||||
|
||||
public TaxonomyStatus(Status status, String refId){
|
||||
this.status = status;
|
||||
this.refId = refId;
|
||||
}
|
||||
|
||||
public TaxonomyStatus(Status status, String refId, String statusAsString){
|
||||
this.status = status;
|
||||
this.refId = refId;
|
||||
this.statusAsString = statusAsString;
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
private String refId;
|
||||
|
||||
@XmlAttribute
|
||||
private Status status;
|
||||
|
||||
@XmlAttribute
|
||||
private String statusAsString="";
|
||||
|
||||
|
||||
public String getRefId() {
|
||||
return refId;
|
||||
}
|
||||
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setRefId(String refId) {
|
||||
this.refId = refId;
|
||||
}
|
||||
|
||||
public String getStatusAsString() {
|
||||
return statusAsString;
|
||||
}
|
||||
|
||||
public void setStatusAsString(String statusAsString) {
|
||||
this.statusAsString = statusAsString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
StringBuilder toReturn= new StringBuilder();
|
||||
toReturn.append("[value: "+status.toString()+"]");
|
||||
if(refId!=null) toReturn.append("[refId :"+refId+"]");
|
||||
return toReturn.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package org.gcube.data.spd.model.service.exceptions;
|
||||
|
||||
import javax.xml.ws.WebFault;
|
||||
|
||||
|
||||
@WebFault
|
||||
public class InvalidIdentifierException extends Exception {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected SpeciesExceptionBean faultInfo ;
|
||||
|
||||
public InvalidIdentifierException(){}
|
||||
|
||||
public InvalidIdentifierException(String message, SpeciesExceptionBean faultInfo, Throwable cause){
|
||||
this.faultInfo = faultInfo;
|
||||
}
|
||||
|
||||
public InvalidIdentifierException(String message, SpeciesExceptionBean faultInfo){
|
||||
this.faultInfo = faultInfo;
|
||||
}
|
||||
|
||||
public SpeciesExceptionBean getFaultInfo(){
|
||||
return faultInfo;
|
||||
}
|
||||
|
||||
public InvalidIdentifierException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
this.faultInfo = new SpeciesExceptionBean(message, cause);
|
||||
}
|
||||
|
||||
public InvalidIdentifierException(String message) {
|
||||
super(message);
|
||||
this.faultInfo = new SpeciesExceptionBean(message);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package org.gcube.data.spd.model.service.exceptions;
|
||||
|
||||
import javax.xml.ws.WebFault;
|
||||
|
||||
@WebFault
|
||||
public class InvalidInputException extends Exception{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected SpeciesExceptionBean faultInfo ;
|
||||
|
||||
public InvalidInputException(){}
|
||||
|
||||
public InvalidInputException(String message, SpeciesExceptionBean faultInfo, Throwable cause){
|
||||
this.faultInfo = faultInfo;
|
||||
}
|
||||
|
||||
public InvalidInputException(String message, SpeciesExceptionBean faultInfo){
|
||||
this.faultInfo = faultInfo;
|
||||
}
|
||||
|
||||
public SpeciesExceptionBean getFaultInfo(){
|
||||
return faultInfo;
|
||||
}
|
||||
|
||||
public InvalidInputException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
this.faultInfo = new SpeciesExceptionBean(message, cause);
|
||||
}
|
||||
|
||||
public InvalidInputException(String message) {
|
||||
super(message);
|
||||
this.faultInfo = new SpeciesExceptionBean(message);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package org.gcube.data.spd.model.service.exceptions;
|
||||
|
||||
import javax.xml.ws.WebFault;
|
||||
|
||||
@WebFault
|
||||
public class InvalidJobException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected SpeciesExceptionBean faultInfo ;
|
||||
|
||||
public InvalidJobException(){}
|
||||
|
||||
public InvalidJobException(String message, SpeciesExceptionBean faultInfo, Throwable cause){
|
||||
this.faultInfo = faultInfo;
|
||||
}
|
||||
|
||||
public InvalidJobException(String message, SpeciesExceptionBean faultInfo){
|
||||
this.faultInfo = faultInfo;
|
||||
}
|
||||
|
||||
public SpeciesExceptionBean getFaultInfo(){
|
||||
return faultInfo;
|
||||
}
|
||||
|
||||
public InvalidJobException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
this.faultInfo = new SpeciesExceptionBean(message, cause);
|
||||
}
|
||||
|
||||
public InvalidJobException(String message) {
|
||||
super(message);
|
||||
this.faultInfo = new SpeciesExceptionBean(message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package org.gcube.data.spd.model.service.exceptions;
|
||||
|
||||
import javax.xml.ws.WebFault;
|
||||
|
||||
@WebFault
|
||||
public class QueryNotValidException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected SpeciesExceptionBean faultInfo ;
|
||||
|
||||
public QueryNotValidException(){}
|
||||
|
||||
public QueryNotValidException(String message, SpeciesExceptionBean faultInfo, Throwable cause){
|
||||
this.faultInfo = faultInfo;
|
||||
}
|
||||
|
||||
public QueryNotValidException(String message, SpeciesExceptionBean faultInfo){
|
||||
this.faultInfo = faultInfo;
|
||||
}
|
||||
|
||||
public SpeciesExceptionBean getFaultInfo(){
|
||||
return faultInfo;
|
||||
}
|
||||
|
||||
public QueryNotValidException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
this.faultInfo = new SpeciesExceptionBean(message, cause);
|
||||
}
|
||||
|
||||
public QueryNotValidException(String message) {
|
||||
super(message);
|
||||
this.faultInfo = new SpeciesExceptionBean(message);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package org.gcube.data.spd.model.service.exceptions;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class SpeciesExceptionBean {
|
||||
|
||||
protected String message;
|
||||
|
||||
@XmlJavaTypeAdapter(ThrowableAdapter.class)
|
||||
protected Throwable cause;
|
||||
|
||||
protected SpeciesExceptionBean(){}
|
||||
|
||||
public SpeciesExceptionBean(String message){
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public SpeciesExceptionBean(String message, Throwable cause){
|
||||
this.message = message;
|
||||
this.cause = cause;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the message
|
||||
*/
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cause
|
||||
*/
|
||||
public Throwable getCause() {
|
||||
return cause;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package org.gcube.data.spd.model.service.exceptions;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
|
||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||
|
||||
public class ThrowableAdapter extends XmlAdapter<String, Throwable> {
|
||||
private HexBinaryAdapter hexAdapter = new HexBinaryAdapter();
|
||||
|
||||
@Override
|
||||
public String marshal(Throwable v) throws Exception {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||
oos.writeObject(v);
|
||||
oos.close();
|
||||
byte[] serializedBytes = baos.toByteArray();
|
||||
return hexAdapter.marshal(serializedBytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Throwable unmarshal(String v) throws Exception {
|
||||
byte[] serializedBytes = hexAdapter.unmarshal(v);
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(serializedBytes);
|
||||
ObjectInputStream ois = new ObjectInputStream(bais);
|
||||
Throwable result = (Throwable) ois.readObject();
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package org.gcube.data.spd.model.service.exceptions;
|
||||
|
||||
import javax.xml.ws.WebFault;
|
||||
|
||||
@WebFault(name="UnsupportedCapabilityFault")
|
||||
public class UnsupportedCapabilityException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected SpeciesExceptionBean faultInfo ;
|
||||
|
||||
public UnsupportedCapabilityException(){}
|
||||
|
||||
public UnsupportedCapabilityException(String message, SpeciesExceptionBean faultInfo, Throwable cause){
|
||||
this.faultInfo = faultInfo;
|
||||
}
|
||||
|
||||
public UnsupportedCapabilityException(String message, SpeciesExceptionBean faultInfo){
|
||||
this.faultInfo = faultInfo;
|
||||
}
|
||||
|
||||
public SpeciesExceptionBean getFaultInfo(){
|
||||
return faultInfo;
|
||||
}
|
||||
|
||||
public UnsupportedCapabilityException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
this.faultInfo = new SpeciesExceptionBean(message, cause);
|
||||
}
|
||||
|
||||
public UnsupportedCapabilityException(String message) {
|
||||
super(message);
|
||||
this.faultInfo = new SpeciesExceptionBean(message);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package org.gcube.data.spd.model.service.exceptions;
|
||||
|
||||
import javax.xml.ws.WebFault;
|
||||
|
||||
@WebFault
|
||||
public class UnsupportedPluginException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected SpeciesExceptionBean faultInfo ;
|
||||
|
||||
public UnsupportedPluginException(){}
|
||||
|
||||
public UnsupportedPluginException(String message, SpeciesExceptionBean faultInfo, Throwable cause){
|
||||
this.faultInfo = faultInfo;
|
||||
}
|
||||
|
||||
public UnsupportedPluginException(String message, SpeciesExceptionBean faultInfo){
|
||||
this.faultInfo = faultInfo;
|
||||
}
|
||||
|
||||
public SpeciesExceptionBean getFaultInfo(){
|
||||
return faultInfo;
|
||||
}
|
||||
|
||||
public UnsupportedPluginException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
this.faultInfo = new SpeciesExceptionBean(message, cause);
|
||||
}
|
||||
|
||||
public UnsupportedPluginException(String message) {
|
||||
super(message);
|
||||
this.faultInfo = new SpeciesExceptionBean(message);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package org.gcube.data.spd.model.service.types;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class CompleteJobStatus {
|
||||
|
||||
@XmlElement
|
||||
private int completedEntries;
|
||||
|
||||
@XmlElement
|
||||
private JobStatus status;
|
||||
|
||||
@XmlElement(name="subNodesStatus")
|
||||
private List<NodeStatus> subNodes= new ArrayList<NodeStatus>();
|
||||
|
||||
@XmlElement
|
||||
private Calendar endDate;
|
||||
|
||||
@XmlElement
|
||||
private Calendar startDate;
|
||||
|
||||
public int getCompletedEntries() {
|
||||
return completedEntries;
|
||||
}
|
||||
|
||||
public JobStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public List<NodeStatus> getSubNodes() {
|
||||
return subNodes;
|
||||
}
|
||||
|
||||
public Calendar getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public Calendar getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setCompletedEntries(int completedEntries) {
|
||||
this.completedEntries = completedEntries;
|
||||
}
|
||||
|
||||
public void setStatus(JobStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public void setSubNodes(List<NodeStatus> subNodes) {
|
||||
this.subNodes = subNodes;
|
||||
}
|
||||
|
||||
public void setEndDate(Calendar endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Calendar startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CompleteJobStatus [completedEntries=" + completedEntries
|
||||
+ ", status=" + status + ", subNodes=" + subNodes
|
||||
+ ", endDate=" + endDate + ", startDate=" + startDate + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package org.gcube.data.spd.model.service.types;
|
||||
|
||||
public enum JobStatus {
|
||||
|
||||
PENDING,
|
||||
RUNNING,
|
||||
FAILED,
|
||||
COMPLETED
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package org.gcube.data.spd.model.service.types;
|
||||
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
|
||||
@XmlEnum(String.class)
|
||||
public enum JobType {
|
||||
|
||||
DWCAByChildren,
|
||||
DWCAById,
|
||||
CSV,
|
||||
CSVForOM,
|
||||
DarwinCore
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package org.gcube.data.spd.model.service.types;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||
|
||||
import org.gcube.data.spd.model.Conditions;
|
||||
import org.gcube.data.spd.model.util.Capabilities;
|
||||
|
||||
public class MapAdapter extends XmlAdapter<MapElements[], Map<Capabilities, List<Conditions>>> {
|
||||
|
||||
|
||||
public Map<Capabilities, List<Conditions>> unmarshal(MapElements[] v)
|
||||
throws Exception {
|
||||
Map<Capabilities, List<Conditions>> r = new HashMap<Capabilities, List<Conditions>>();
|
||||
for (MapElements mapelement : v){
|
||||
if (mapelement.value==null)
|
||||
r.put(mapelement.key, new ArrayList<Conditions>());
|
||||
else r.put(mapelement.key, mapelement.value);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
public MapElements[] marshal(Map<Capabilities, List<Conditions>> v)
|
||||
throws Exception {
|
||||
MapElements[] mapElements = new MapElements[v.size()];
|
||||
int i = 0;
|
||||
for (Map.Entry<Capabilities, List<Conditions>> entry : v.entrySet())
|
||||
mapElements[i++] = new MapElements(entry.getKey(), entry.getValue());
|
||||
return mapElements;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package org.gcube.data.spd.model.service.types;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import org.gcube.data.spd.model.Conditions;
|
||||
import org.gcube.data.spd.model.util.Capabilities;
|
||||
|
||||
public class MapElements
|
||||
{
|
||||
@XmlElement public Capabilities key;
|
||||
@XmlElement public List<Conditions> value;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private MapElements() {} //Required by JAXB
|
||||
|
||||
public MapElements(Capabilities key, List<Conditions> value)
|
||||
{
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package org.gcube.data.spd.model.service.types;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class NodeStatus {
|
||||
|
||||
@XmlElement
|
||||
private String scientificName;
|
||||
|
||||
@XmlElement
|
||||
private JobStatus status;
|
||||
|
||||
public NodeStatus(String scientificName, JobStatus status) {
|
||||
super();
|
||||
this.scientificName = scientificName;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
protected NodeStatus() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getScientificName() {
|
||||
return scientificName;
|
||||
}
|
||||
|
||||
public JobStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package org.gcube.data.spd.model.service.types;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.gcube.data.spd.model.PluginDescription;
|
||||
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class PluginDescriptions {
|
||||
|
||||
@XmlElement(name="pluginDescriptions")
|
||||
private List<PluginDescription> descriptions = new ArrayList<PluginDescription>();
|
||||
|
||||
public PluginDescriptions(List<PluginDescription> descriptions) {
|
||||
super();
|
||||
this.descriptions = descriptions;
|
||||
}
|
||||
|
||||
protected PluginDescriptions() {
|
||||
}
|
||||
|
||||
public List<PluginDescription> getDescriptions() {
|
||||
return descriptions;
|
||||
}
|
||||
|
||||
public void setDescriptions(List<PluginDescription> descriptions) {
|
||||
this.descriptions = descriptions;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package org.gcube.data.spd.model.service.types;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.gcube.data.spd.model.Condition.Operator;
|
||||
import org.gcube.data.spd.model.Conditions;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class SearchCondition {
|
||||
|
||||
private Conditions type;
|
||||
private Operator op;
|
||||
private String value;
|
||||
|
||||
protected SearchCondition() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SearchCondition(Conditions type, Operator op, String value) {
|
||||
super();
|
||||
this.type = type;
|
||||
this.op = op;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Conditions getType() {
|
||||
return type;
|
||||
}
|
||||
public Operator getOperator() {
|
||||
return op;
|
||||
}
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package org.gcube.data.spd.model.service.types;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class SearchRequest {
|
||||
|
||||
private String pluginName;
|
||||
private List<SearchCondition> properties;
|
||||
private String resultType;
|
||||
private String word;
|
||||
|
||||
protected SearchRequest() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SearchRequest(String pluginName,
|
||||
List<SearchCondition> properties, String resultType, String word) {
|
||||
super();
|
||||
this.pluginName = pluginName;
|
||||
this.properties = properties;
|
||||
this.resultType = resultType;
|
||||
this.word = word;
|
||||
}
|
||||
|
||||
public String getPluginName() {
|
||||
return pluginName;
|
||||
}
|
||||
public List<SearchCondition> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
public String getResultType() {
|
||||
return resultType;
|
||||
}
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package org.gcube.data.spd.model.service.types;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class SubmitJob {
|
||||
|
||||
@XmlElement
|
||||
private String input;
|
||||
|
||||
@XmlElement
|
||||
private JobType job;
|
||||
|
||||
public SubmitJob(String input, JobType job) {
|
||||
super();
|
||||
this.input = input;
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
protected SubmitJob() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
public String getInput() {
|
||||
return input;
|
||||
}
|
||||
public JobType getJob() {
|
||||
return job;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package org.gcube.data.spd.model.util;
|
||||
|
||||
public enum Capabilities {
|
||||
Classification("getClassificationInterface", true),
|
||||
NamesMapping("getMappingInterface", false),
|
||||
Occurrence("getOccurrencesInterface", true),
|
||||
Expansion("getExpansionInterface", false),
|
||||
Unfold("getUnfoldInterface", false);
|
||||
|
||||
private String method;
|
||||
private boolean propertySupport;
|
||||
|
||||
Capabilities(String method, boolean propertySupport){
|
||||
this.method = method;
|
||||
this.propertySupport = propertySupport;
|
||||
}
|
||||
|
||||
|
||||
public boolean isPropertySupport() {
|
||||
return propertySupport;
|
||||
}
|
||||
|
||||
|
||||
public void setPropertySupport(boolean propertySupport) {
|
||||
this.propertySupport = propertySupport;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getMethod(){
|
||||
return this.method;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package org.gcube.data.spd.model.util;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class ElementProperty implements Serializable{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@XmlAttribute
|
||||
private String name;
|
||||
@XmlAttribute
|
||||
private String value;
|
||||
|
||||
protected ElementProperty() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ElementProperty(String name, String value) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package org.gcube.data.spd.model.util;
|
||||
|
||||
public class Labels {
|
||||
|
||||
public static final String RANK_LABEL="rank";
|
||||
public static final String ACCORDINGTO_LABEL="accordingTo";
|
||||
public static final String SCIENTIFICNAME_LABEL="scientificName";
|
||||
public static final String COMMONNAME_LABEL="commonName";
|
||||
public static final String COMMONNAMES_LABEL="commonNames";
|
||||
public static final String PROVIDER_LABEL="provider";
|
||||
public static final String CITATION_LABEL="citation";
|
||||
public static final String PARENT_TAG="parent";
|
||||
|
||||
public static final String PRODUCTS_LABEL="products";
|
||||
|
||||
public static final String PRODUCT_LABEL="product";
|
||||
|
||||
public static final String TYPE_LABEL="type";
|
||||
public static final String KEY_LABEL="key";
|
||||
|
||||
public static final String DATASET_TAG="dataSet";
|
||||
public static final String DATAPROVIDER_TAG="dataProvider";
|
||||
public static final String NAME_TAG = "name";
|
||||
public static final String LANGUAGE_TAG = "language";
|
||||
public static final String COUNT_LABEL = "count";
|
||||
|
||||
public static final String CREDITS_LABEL = "credits";
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package org.gcube.data.spd.model.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class SerializableList<T> {
|
||||
|
||||
@XmlElement
|
||||
private List<T> valuesList = new ArrayList<T>();
|
||||
|
||||
protected SerializableList(){}
|
||||
|
||||
public SerializableList(List<T> valuesList) {
|
||||
super();
|
||||
this.valuesList = valuesList;
|
||||
}
|
||||
|
||||
public List<T> getValuesList() {
|
||||
return valuesList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return valuesList.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue