updated to support new spd-model at version 3.0.0-SNAPSHOT
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/speciesdiscovery@86191 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c51f6ef716
commit
b40c5c4b3a
9
pom.xml
9
pom.xml
|
@ -97,15 +97,6 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.data.spd</groupId>
|
||||
<artifactId>spd-model</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<!-- UNCOMMENT THIS FOR RELEASE -->
|
||||
<!-- <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> -->
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>discovery-client</artifactId>
|
||||
|
|
|
@ -29,7 +29,7 @@ public class TablesForResultRow {
|
|||
String matchingCredits= "";
|
||||
int occurencesCount = 0;
|
||||
|
||||
String author = "";
|
||||
String scientificNameAuthorship = "";
|
||||
String lsid = "";
|
||||
String credits = "";
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class TablesForResultRow {
|
|||
}
|
||||
|
||||
|
||||
if(row.getAuthor()!=null) author = row.getAuthor();
|
||||
if(row.getScientificNameAuthorship()!=null) scientificNameAuthorship = row.getScientificNameAuthorship();
|
||||
|
||||
if(row.getLsid()!=null) lsid = row.getLsid();
|
||||
|
||||
|
@ -139,8 +139,8 @@ public class TablesForResultRow {
|
|||
" <td>"+lsid+"</td>" +
|
||||
"</tr>" +
|
||||
"<tr>" +
|
||||
" <td class=\"title\">"+SpeciesGridFields.AUTHOR.getName()+"</td>" +
|
||||
" <td>"+author+"</td>" +
|
||||
" <td class=\"title\">"+SpeciesGridFields.SCIENTIFICNAMEAUTHORSHIP.getName()+"</td>" +
|
||||
" <td>"+scientificNameAuthorship+"</td>" +
|
||||
"</tr>" +
|
||||
"<tr>" +
|
||||
" <td class=\"title\">"+SpeciesGridFields.CREDITS.getName()+"</td>" +
|
||||
|
|
|
@ -117,7 +117,7 @@ public class SpeciesGrid extends ContentPanel implements SpeciesViewInterface {
|
|||
ColumnConfig matchingName = Util.createColumnConfig(SpeciesGridFields.MATCHING_NAME, 180);
|
||||
columns.add(matchingName);
|
||||
|
||||
ColumnConfig author = Util.createColumnConfig(TaxonomyGridField.AUTHOR, 150);
|
||||
ColumnConfig author = Util.createColumnConfig(TaxonomyGridField.SCIENTIFICNAMEAUTHORSHIP, 150);
|
||||
columns.add(author);
|
||||
|
||||
ColumnConfig accordingTo = Util.createColumnConfig(SpeciesGridFields.MATCHING_AUTHOR, 200);
|
||||
|
|
|
@ -96,7 +96,7 @@ public class TaxonomyGrid extends ContentPanel implements SpeciesViewInterface {
|
|||
ColumnConfig matchingName = Util.createColumnConfig(TaxonomyGridField.SCIENTIFIC_NAME, 180);
|
||||
columns.add(matchingName);
|
||||
|
||||
ColumnConfig author = Util.createColumnConfig(TaxonomyGridField.AUTHOR, 150);
|
||||
ColumnConfig author = Util.createColumnConfig(TaxonomyGridField.SCIENTIFICNAMEAUTHORSHIP, 150);
|
||||
columns.add(author);
|
||||
|
||||
ColumnConfig dataProvider = Util.createColumnConfig(TaxonomyGridField.DATASOURCE, 250);
|
||||
|
|
|
@ -18,12 +18,13 @@ public enum OccurencesGridFields implements GridField {
|
|||
DATAPROVIDER("dataProvider", "Data Provider"),
|
||||
DATASET("dataSet","Dataset"),
|
||||
|
||||
AUTHOR("author", "Author"),
|
||||
SCIENTIFICNAMEAUTHORSHIP("scientificNameAuthorship", "S.N. Authorship"),
|
||||
CREDITS("credits", "Credits"),
|
||||
// LSID("lsid", "LSID"),
|
||||
PROPERTIES("properties", "Properties"),
|
||||
|
||||
RECORDED_BY("recordedBy", "RecordedBy"),
|
||||
RECORDED_BY("recordedBy", "Recorded By"),
|
||||
IDENTIFIED_BY("identifiedBy","Identified By"),
|
||||
EVENT_DATE("eventDate", "EventDate"),
|
||||
MODIFIED("modified", "Modified"),
|
||||
SCIENTIFIC_NAME("scientificName", "ScientificName"),
|
||||
|
|
|
@ -25,7 +25,7 @@ public enum SpeciesGridFields implements GridField {
|
|||
PRODUCT_LAYERS("productLayers", "Layers"),
|
||||
PRODUCT_OCCURRENCES("productOccurrences", "Occurrences"),
|
||||
|
||||
AUTHOR("author", "Author"),
|
||||
SCIENTIFICNAMEAUTHORSHIP("scientificNameAuthorship", "S.N. Authorship"),
|
||||
CREDITS("credits", "Credits"),
|
||||
LSID("lsid", "LSID"),
|
||||
PROPERTIES("properties", "Properties"),
|
||||
|
|
|
@ -17,7 +17,7 @@ public enum TaxonomyGridField implements GridField {
|
|||
// NAME("name", "Name"),
|
||||
MATCHING_AUTHOR("accordingTo", "According to"),
|
||||
|
||||
AUTHOR("author", "Author"),
|
||||
SCIENTIFICNAMEAUTHORSHIP("scientificNameAuthorship", "S.N. Authorship"),
|
||||
CREDITS("credits", "Credits"),
|
||||
LSID("lsid", "LSID"),
|
||||
PROPERTIES("properties", "Properties"),
|
||||
|
|
|
@ -60,13 +60,13 @@ public class OccurrencesDataSource implements DataSource{
|
|||
{
|
||||
BaseModelData data = new BaseModelData();
|
||||
|
||||
String author = "";
|
||||
String authorship = "";
|
||||
String lsid = "";
|
||||
String credits = "";
|
||||
|
||||
String propertiesHtml = "";
|
||||
|
||||
if(occurrence.getAuthor()!=null) author = occurrence.getAuthor();
|
||||
if(occurrence.getScientificNameAuthorship()!=null) authorship = occurrence.getScientificNameAuthorship();
|
||||
|
||||
if(occurrence.getLsid()!=null) lsid = occurrence.getLsid();
|
||||
|
||||
|
@ -101,12 +101,13 @@ public class OccurrencesDataSource implements DataSource{
|
|||
data.set(OccurencesGridFields.DATASOURCE.getId(), occurrence.getDataSource());
|
||||
|
||||
|
||||
data.set(OccurencesGridFields.AUTHOR.getId(),author);
|
||||
data.set(OccurencesGridFields.SCIENTIFICNAMEAUTHORSHIP.getId(),authorship);
|
||||
// data.set(OccurencesGridFields.LSID.getId(), lsid);
|
||||
data.set(OccurencesGridFields.CREDITS.getId(), credits);
|
||||
data.set(OccurencesGridFields.PROPERTIES.getId(), propertiesHtml);
|
||||
|
||||
data.set(OccurencesGridFields.RECORDED_BY.getId(), occurrence.getRecordedBy());
|
||||
data.set(OccurencesGridFields.IDENTIFIED_BY.getId(), occurrence.getIdentifiedBy());
|
||||
data.set(OccurencesGridFields.EVENT_DATE.getId(), occurrence.getEventDate());
|
||||
data.set(OccurencesGridFields.MODIFIED.getId(), occurrence.getModified());
|
||||
data.set(OccurencesGridFields.SCIENTIFIC_NAME.getId(), occurrence.getScientificName());
|
||||
|
|
|
@ -144,7 +144,7 @@ public class ResultRowDataSource implements DataSource {
|
|||
int mapCount= 0;
|
||||
int layerCount = 0;
|
||||
int occurencesCount = 0;
|
||||
String author = "";
|
||||
String authorship = "";
|
||||
|
||||
List<ItemParameter> listProperties = new ArrayList<ItemParameter>();
|
||||
|
||||
|
@ -174,7 +174,7 @@ public class ResultRowDataSource implements DataSource {
|
|||
if(row.getMapsCount()!=0) mapCount = row.getMapsCount();
|
||||
if(row.getLayersCount()!=0) layerCount = row.getLayersCount();
|
||||
if(row.getOccurencesCount()!=0) occurencesCount = row.getOccurencesCount();
|
||||
if(row.getAuthor()!=null) author = row.getAuthor();
|
||||
if(row.getScientificNameAuthorship()!=null) authorship = row.getScientificNameAuthorship();
|
||||
|
||||
if(row.getProperties()!=null) listProperties = row.getProperties();
|
||||
|
||||
|
@ -192,7 +192,7 @@ public class ResultRowDataSource implements DataSource {
|
|||
|
||||
data.set(SpeciesGridFields.MATCHING_CREDITS.getId(),matchingCredits);
|
||||
data.set(SpeciesGridFields.PROPERTIES.getId(),listProperties);
|
||||
data.set(SpeciesGridFields.AUTHOR.getId(), author);
|
||||
data.set(SpeciesGridFields.SCIENTIFICNAMEAUTHORSHIP.getId(), authorship);
|
||||
|
||||
List<CommonName> listCommonName = new ArrayList<CommonName>();
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ public class TaxonomyRowDataSource implements DataSource {
|
|||
// if(row.getAccordingTo()!=null) matchingAccordingTo = row.getAccordingTo();
|
||||
if(row.getStatusRemarks()!=null) statusRemarks = row.getStatusRemarks();
|
||||
if(row.getProperties()!=null) hashProperties = row.getProperties();
|
||||
if(row.getAuthor()!=null) author = row.getAuthor();
|
||||
if(row.getScientificNameAuthorship()!=null) author = row.getScientificNameAuthorship();
|
||||
|
||||
if(row.getParents()!=null){
|
||||
classificationString = getClassification(row.getParents());
|
||||
|
@ -141,7 +141,7 @@ public class TaxonomyRowDataSource implements DataSource {
|
|||
data.set(TaxonomyGridField.STATUSREFNAME.getId(), statusRefName);
|
||||
data.set(TaxonomyGridField.STATUSREFID.getId(), statusRedId);
|
||||
data.set(TaxonomyGridField.DATEMODIFIED.getId(), dateModified);
|
||||
data.set(TaxonomyGridField.AUTHOR.getId(), author);
|
||||
data.set(TaxonomyGridField.SCIENTIFICNAMEAUTHORSHIP.getId(), author);
|
||||
// data.set(TaxonomyGridField.MATCHING_ACCORDING_TO.getId(),matchingAccordingTo);
|
||||
data.set(TaxonomyGridField.STATUS_REMARKS.getId(),statusRemarks);
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ public class ResultRowTable extends HttpServlet {
|
|||
String matchingCredits= "";
|
||||
int occurencesCount = 0;
|
||||
|
||||
String author = "";
|
||||
String scientificNameAuthorship = "";
|
||||
String lsid = "";
|
||||
String credits = "";
|
||||
|
||||
|
@ -240,7 +240,7 @@ public class ResultRowTable extends HttpServlet {
|
|||
}
|
||||
|
||||
|
||||
if(row.getAuthor()!=null) author = row.getAuthor();
|
||||
if(row.getScientificNameAuthorship()!=null) scientificNameAuthorship = row.getScientificNameAuthorship();
|
||||
|
||||
if(row.getLsid()!=null) lsid = row.getLsid();
|
||||
|
||||
|
@ -317,8 +317,8 @@ public class ResultRowTable extends HttpServlet {
|
|||
" <td>"+lsid+"</td>" +
|
||||
"</tr>" +
|
||||
"<tr>" +
|
||||
" <td class=\"title\">"+SpeciesGridFields.AUTHOR.getName()+"</td>" +
|
||||
" <td>"+author+"</td>" +
|
||||
" <td class=\"title\">"+SpeciesGridFields.SCIENTIFICNAMEAUTHORSHIP.getName()+"</td>" +
|
||||
" <td>"+scientificNameAuthorship+"</td>" +
|
||||
"</tr>" +
|
||||
"<tr>" +
|
||||
" <td class=\"title\">"+SpeciesGridFields.CREDITS.getName()+"</td>" +
|
||||
|
|
|
@ -313,7 +313,7 @@ public class TaxonomyRowTable extends HttpServlet {
|
|||
String dateModified = "";
|
||||
String statusRemark = "";
|
||||
|
||||
String author = "";
|
||||
String scientificNameAuthorship = "";
|
||||
String lsid = "";
|
||||
String credits = "";
|
||||
|
||||
|
@ -329,7 +329,7 @@ public class TaxonomyRowTable extends HttpServlet {
|
|||
|
||||
if(row.getStatusRemarks()!=null) statusRemark = row.getStatusRemarks();
|
||||
|
||||
if(row.getAuthor()!=null) author = row.getAuthor();
|
||||
if(row.getScientificNameAuthorship()!=null) scientificNameAuthorship = row.getScientificNameAuthorship();
|
||||
|
||||
if(row.getLsid()!=null) lsid = row.getLsid();
|
||||
|
||||
|
@ -408,8 +408,8 @@ public class TaxonomyRowTable extends HttpServlet {
|
|||
" <td>"+lsid+"</td>" +
|
||||
"</tr>" +
|
||||
"<tr>" +
|
||||
" <td class=\"title\">"+TaxonomyGridField.AUTHOR.getName()+"</td>" +
|
||||
" <td>"+author+"</td>" +
|
||||
" <td class=\"title\">"+TaxonomyGridField.SCIENTIFICNAMEAUTHORSHIP.getName()+"</td>" +
|
||||
" <td>"+scientificNameAuthorship+"</td>" +
|
||||
"</tr>" +
|
||||
"<tr>" +
|
||||
" <td class=\"title\">"+TaxonomyGridField.CREDITS.getName()+"</td>" +
|
||||
|
|
|
@ -54,13 +54,12 @@ public class OccurrenceConverter implements Converter<OccurrencePoint, org.gcube
|
|||
}
|
||||
|
||||
|
||||
|
||||
//set author
|
||||
if(input.getAuthor()!=null && !input.getAuthor().isEmpty()){
|
||||
occurrence.setAuthor(StringEscapeUtils.escapeSql(input.getAuthor()));
|
||||
if(input.getScientificNameAuthorship()!=null && !input.getScientificNameAuthorship().isEmpty()){
|
||||
occurrence.setScientificNameAuthorship(StringEscapeUtils.escapeSql(input.getScientificNameAuthorship()));
|
||||
}
|
||||
else
|
||||
occurrence.setAuthor(ConstantsSpeciesDiscovery.NOT_FOUND);
|
||||
occurrence.setScientificNameAuthorship(ConstantsSpeciesDiscovery.NOT_FOUND);
|
||||
|
||||
//set credits
|
||||
if(input.getCredits()!=null && !input.getCredits().isEmpty()){
|
||||
|
@ -70,6 +69,13 @@ public class OccurrenceConverter implements Converter<OccurrencePoint, org.gcube
|
|||
occurrence.setCredits(ConstantsSpeciesDiscovery.NOT_FOUND);
|
||||
|
||||
|
||||
//set credits
|
||||
if(input.getIdentifiedBy()!=null && !input.getIdentifiedBy().isEmpty()){
|
||||
occurrence.setIdentifiedBy(StringEscapeUtils.escapeSql(input.getIdentifiedBy()));
|
||||
}
|
||||
else
|
||||
occurrence.setIdentifiedBy(ConstantsSpeciesDiscovery.NOT_FOUND);
|
||||
|
||||
|
||||
if(input.getDataSet()!=null){
|
||||
occurrence.setDataSet(cleanValueEscapeSql(input.getDataSet().getName()));
|
||||
|
|
|
@ -58,12 +58,12 @@ public class ResultItemConverter implements Converter<ResultItem, ResultRow> {
|
|||
}
|
||||
|
||||
//set author
|
||||
if(input.getAuthor()!=null && !input.getAuthor().isEmpty()){
|
||||
if(input.getScientificNameAuthorship()!=null && !input.getScientificNameAuthorship().isEmpty()){
|
||||
// row.setAuthor(StringEscapeUtils.escapeSql(input.getAuthor()));
|
||||
row.setAuthor(input.getAuthor());
|
||||
row.setScientificNameAuthorship(input.getScientificNameAuthorship());
|
||||
}
|
||||
else
|
||||
row.setAuthor(ConstantsSpeciesDiscovery.NOT_FOUND);
|
||||
row.setScientificNameAuthorship(ConstantsSpeciesDiscovery.NOT_FOUND);
|
||||
|
||||
//set credits
|
||||
if(input.getCredits()!=null && !input.getCredits().isEmpty()){
|
||||
|
|
|
@ -155,11 +155,11 @@ public class TaxonomyItemConverter implements Converter<TaxonomyItem, TaxonomyRo
|
|||
tax.setServiceId(input.getId());
|
||||
}
|
||||
|
||||
if(input.getAuthor()!=null && !input.getAuthor().isEmpty()){
|
||||
tax.setAuthor(input.getAuthor());
|
||||
if(input.getScientificNameAuthorship()!=null && !input.getScientificNameAuthorship().isEmpty()){
|
||||
tax.setScientificNameAuthorship(input.getScientificNameAuthorship());
|
||||
}
|
||||
else
|
||||
tax.setAuthor(ConstantsSpeciesDiscovery.NOT_FOUND);
|
||||
tax.setScientificNameAuthorship(ConstantsSpeciesDiscovery.NOT_FOUND);
|
||||
|
||||
if(input.getCredits()!=null && !input.getCredits().isEmpty()){
|
||||
tax.setCredits(input.getCredits());
|
||||
|
|
|
@ -68,7 +68,7 @@ public class IteratorPointInfo implements Stream<PointInfo> {
|
|||
listMetaData.add(new KeyValue(Occurrence.DATAPROVIDER, NormalizeString.validateUndefined(occrs.getDataProvider())));
|
||||
listMetaData.add(new KeyValue(Occurrence.DATASET, NormalizeString.validateUndefined(occrs.getDataSet())));
|
||||
|
||||
listMetaData.add(new KeyValue(Occurrence.AUTHOR, NormalizeString.validateUndefined(occrs.getAuthor())));
|
||||
listMetaData.add(new KeyValue(Occurrence.SCIENTIFICNAMEAUTHORSHIP, NormalizeString.validateUndefined(occrs.getScientificNameAuthorship())));
|
||||
listMetaData.add(new KeyValue(Occurrence.LSID, NormalizeString.validateUndefined(occrs.getLsid())));
|
||||
listMetaData.add(new KeyValue(Occurrence.CREDITS, NormalizeString.validateUndefined(occrs.getCredits())));
|
||||
|
||||
|
|
|
@ -24,10 +24,11 @@ public class OccurenceCSVConverter implements Converter<Occurrence, List<String>
|
|||
"dataProvider",
|
||||
"dataSource",
|
||||
|
||||
"author",
|
||||
"scientificNameAuthorship",
|
||||
// "lsid",
|
||||
"credits",
|
||||
|
||||
"identifiedBy",
|
||||
"recordedBy",
|
||||
"eventDate",
|
||||
"modified",
|
||||
|
@ -56,10 +57,11 @@ public class OccurenceCSVConverter implements Converter<Occurrence, List<String>
|
|||
fields.add(cleanValue(input.getDataProvider()));
|
||||
fields.add(cleanValue(input.getDataSource()));
|
||||
|
||||
fields.add(cleanValue(input.getAuthor()));
|
||||
fields.add(cleanValue(input.getScientificNameAuthorship()));
|
||||
// fields.add(cleanValue(input.getLsid()));
|
||||
fields.add(cleanValue(input.getCredits()));
|
||||
|
||||
fields.add(cleanValue(input.getIdentifiedBy()));
|
||||
fields.add(cleanValue(input.getRecordedBy()));
|
||||
fields.add(cleanValue(input.getEventDate()));
|
||||
fields.add(cleanValue(input.getModified()));
|
||||
|
|
|
@ -31,6 +31,8 @@ public class Occurrence implements Serializable, FetchingElement {
|
|||
public final static String COLLECTION_CODE = "collectionCode";
|
||||
public final static String CATALOGUE_NUMBER = "catalogueNumber";
|
||||
public final static String RECORD_BY = "recordedBy";
|
||||
public final static String IDENTIFIED_BY = "identifiedBy";
|
||||
|
||||
public final static String EVENT_DATE = "eventDate";
|
||||
public final static String MODIFIED = "modified";
|
||||
public final static String SCIENTIFICNAME = "scientificName";
|
||||
|
@ -54,7 +56,7 @@ public class Occurrence implements Serializable, FetchingElement {
|
|||
|
||||
public final static String SERVICE_ID_FIELD = "serviceIdField";
|
||||
|
||||
public final static String AUTHOR = "author"; //USED
|
||||
public final static String SCIENTIFICNAMEAUTHORSHIP = "scientificNameAuthorship"; //USED
|
||||
public final static String CREDITS = "credits"; //USED
|
||||
public final static String LSID = "lsid"; //USED
|
||||
public final static String PROPERTIES = "properties"; //TODO
|
||||
|
@ -68,6 +70,7 @@ public class Occurrence implements Serializable, FetchingElement {
|
|||
protected String collectionCode;
|
||||
protected String catalogueNumber;
|
||||
protected String recordedBy;
|
||||
protected String identifiedBy;
|
||||
protected String eventDate;
|
||||
protected String modified;
|
||||
protected String scientificName;
|
||||
|
@ -86,7 +89,7 @@ public class Occurrence implements Serializable, FetchingElement {
|
|||
protected String dataProvider;
|
||||
protected String dataSet;
|
||||
protected String dataSource;
|
||||
protected String author;
|
||||
protected String scientificNameAuthorship;
|
||||
protected String credits;
|
||||
protected String lsid;
|
||||
|
||||
|
@ -399,14 +402,6 @@ public class Occurrence implements Serializable, FetchingElement {
|
|||
return dataProvider;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getCredits() {
|
||||
return credits;
|
||||
}
|
||||
|
@ -436,6 +431,23 @@ public class Occurrence implements Serializable, FetchingElement {
|
|||
this.properties = properties;
|
||||
}
|
||||
|
||||
public String getScientificNameAuthorship() {
|
||||
return scientificNameAuthorship;
|
||||
}
|
||||
|
||||
public void setScientificNameAuthorship(String scientificNameAuthorship) {
|
||||
this.scientificNameAuthorship = scientificNameAuthorship;
|
||||
}
|
||||
|
||||
|
||||
public String getIdentifiedBy() {
|
||||
return identifiedBy;
|
||||
}
|
||||
|
||||
public void setIdentifiedBy(String identifiedBy) {
|
||||
this.identifiedBy = identifiedBy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
@ -449,6 +461,8 @@ public class Occurrence implements Serializable, FetchingElement {
|
|||
builder.append(catalogueNumber);
|
||||
builder.append(", recordedBy=");
|
||||
builder.append(recordedBy);
|
||||
builder.append(", identifiedBy=");
|
||||
builder.append(identifiedBy);
|
||||
builder.append(", eventDate=");
|
||||
builder.append(eventDate);
|
||||
builder.append(", modified=");
|
||||
|
@ -485,8 +499,8 @@ public class Occurrence implements Serializable, FetchingElement {
|
|||
builder.append(dataSet);
|
||||
builder.append(", dataSource=");
|
||||
builder.append(dataSource);
|
||||
builder.append(", author=");
|
||||
builder.append(author);
|
||||
builder.append(", scientificNameAuthorship=");
|
||||
builder.append(scientificNameAuthorship);
|
||||
builder.append(", credits=");
|
||||
builder.append(credits);
|
||||
builder.append(", lsid=");
|
||||
|
@ -497,7 +511,6 @@ public class Occurrence implements Serializable, FetchingElement {
|
|||
builder.append(existsProperties);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class ResultRow implements FetchingElement, SelectableElement, Serializab
|
|||
public static final String GENUS_ID = "genusID";
|
||||
public static final String SPECIES_ID = "speciesID";
|
||||
|
||||
public final static String AUTHOR = "author"; //USED
|
||||
public final static String SCIENTIFICNAMEAUTHORSHIP = "scientificNameAuthorship"; //USED
|
||||
public final static String CREDITS = "credits"; //USED
|
||||
public final static String LSID = "lsid"; //USED
|
||||
public final static String PROPERTIES = "properties"; //USED
|
||||
|
@ -105,7 +105,7 @@ public class ResultRow implements FetchingElement, SelectableElement, Serializab
|
|||
protected String familyID;
|
||||
protected String genusID;
|
||||
protected String speciesID;
|
||||
protected String author;
|
||||
protected String scientificNameAuthorship;
|
||||
protected String credits;
|
||||
protected String lsid;
|
||||
// protected String propertiesAsXml;
|
||||
|
@ -496,14 +496,6 @@ public class ResultRow implements FetchingElement, SelectableElement, Serializab
|
|||
}
|
||||
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getCredits() {
|
||||
return credits;
|
||||
}
|
||||
|
@ -567,7 +559,18 @@ public class ResultRow implements FetchingElement, SelectableElement, Serializab
|
|||
public void setProperties(List<ItemParameter> properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getScientificNameAuthorship() {
|
||||
return scientificNameAuthorship;
|
||||
}
|
||||
|
||||
|
||||
public void setScientificNameAuthorship(String scientificNameAuthorship) {
|
||||
this.scientificNameAuthorship = scientificNameAuthorship;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
@ -633,8 +636,8 @@ public class ResultRow implements FetchingElement, SelectableElement, Serializab
|
|||
builder.append(genusID);
|
||||
builder.append(", speciesID=");
|
||||
builder.append(speciesID);
|
||||
builder.append(", author=");
|
||||
builder.append(author);
|
||||
builder.append(", scientificNameAuthorship=");
|
||||
builder.append(scientificNameAuthorship);
|
||||
builder.append(", credits=");
|
||||
builder.append(credits);
|
||||
builder.append(", lsid=");
|
||||
|
@ -646,5 +649,4 @@ public class ResultRow implements FetchingElement, SelectableElement, Serializab
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class TaxonomyRow implements FetchingElement, Serializable, TaxonomyInter
|
|||
public final static String SERVICE_ID_FIELD = "serviceIdField";
|
||||
public final static String STATUS_REMARKS = "statusRemarks";
|
||||
|
||||
public final static String AUTHOR = "author"; //USED
|
||||
public final static String SCIENTIFICNAMEAUTHORSHIP = "scientificNameAuthorship"; //USED
|
||||
public final static String CREDITS = "credits"; //USED
|
||||
public final static String LSID = "lsid"; //USED
|
||||
public final static String PROPERTIES = "properties"; //TODO
|
||||
|
@ -64,7 +64,7 @@ public class TaxonomyRow implements FetchingElement, Serializable, TaxonomyInter
|
|||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
protected int id;
|
||||
protected String author;
|
||||
protected String scientificNameAuthorship;
|
||||
protected String credits;
|
||||
protected String lsid;
|
||||
|
||||
|
@ -377,15 +377,6 @@ public class TaxonomyRow implements FetchingElement, Serializable, TaxonomyInter
|
|||
this.statusRemarks = statusRemarks;
|
||||
}
|
||||
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getCredits() {
|
||||
return credits;
|
||||
}
|
||||
|
@ -434,13 +425,31 @@ public class TaxonomyRow implements FetchingElement, Serializable, TaxonomyInter
|
|||
this.parentIndex = parentIndex;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* Comparable on insertion order
|
||||
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(TaxonomyRow o) {
|
||||
return parentIndex - o.getParentIndex();
|
||||
}
|
||||
|
||||
public String getScientificNameAuthorship() {
|
||||
return scientificNameAuthorship;
|
||||
}
|
||||
|
||||
public void setScientificNameAuthorship(String scientificNameAuthorship) {
|
||||
this.scientificNameAuthorship = scientificNameAuthorship;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("TaxonomyRow [id=");
|
||||
builder.append(id);
|
||||
builder.append(", author=");
|
||||
builder.append(author);
|
||||
builder.append(", scientificNameAuthorship=");
|
||||
builder.append(scientificNameAuthorship);
|
||||
builder.append(", credits=");
|
||||
builder.append(credits);
|
||||
builder.append(", lsid=");
|
||||
|
@ -504,13 +513,5 @@ public class TaxonomyRow implements FetchingElement, Serializable, TaxonomyInter
|
|||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* Comparable on insertion order
|
||||
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(TaxonomyRow o) {
|
||||
return parentIndex - o.getParentIndex();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,13 +7,22 @@ import static org.gcube.data.spd.client.plugins.AbstractPlugin.manager;
|
|||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.gcube.application.framework.core.session.SessionManager;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.data.spd.client.proxies.Manager;
|
||||
import org.gcube.data.spd.model.exceptions.InvalidQueryException;
|
||||
import org.gcube.data.spd.model.products.ResultElement;
|
||||
import org.gcube.data.spd.model.products.ResultItem;
|
||||
import org.gcube.data.spd.stubs.exceptions.UnsupportedCapabilityException;
|
||||
import org.gcube.data.spd.stubs.exceptions.UnsupportedPluginException;
|
||||
import org.gcube.data.streams.Stream;
|
||||
import org.gcube.portlets.user.speciesdiscovery.server.service.ResultItemConverter;
|
||||
import org.gcube.portlets.user.speciesdiscovery.server.service.StreamIterator;
|
||||
import org.gcube.portlets.user.speciesdiscovery.server.stream.CastConverter;
|
||||
import org.gcube.portlets.user.speciesdiscovery.server.stream.CloseableIterator;
|
||||
import org.gcube.portlets.user.speciesdiscovery.server.stream.ConversionIterator;
|
||||
import org.gcube.portlets.user.speciesdiscovery.shared.ResultRow;
|
||||
|
||||
/**
|
||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
||||
|
@ -27,11 +36,15 @@ public class ServiceQuery {
|
|||
* @throws InvalidQueryException
|
||||
* @throws UnsupportedCapabilityException
|
||||
*/
|
||||
|
||||
private static String username = "test.user";
|
||||
|
||||
public static void main(String[] args) throws InvalidQueryException, UnsupportedPluginException, UnsupportedCapabilityException {
|
||||
String scope = "/gcube/devsec";
|
||||
// String scope = "/d4science.research-infrastructures.eu/gCubeApps/BiodiversityResearchEnvironment"; //Production
|
||||
ScopeProvider.instance.set(scope);
|
||||
|
||||
ASLSession session = SessionManager.getInstance().getASLSession("123", username);
|
||||
|
||||
Manager call = manager().withTimeout(3, TimeUnit.MINUTES).build();
|
||||
|
||||
|
@ -45,17 +58,45 @@ public class ServiceQuery {
|
|||
|
||||
System.out.println("start query...");
|
||||
|
||||
Stream<ResultElement> results = call.search("SEARCH BY SN 'sarda sarda' RETURN Product");
|
||||
Stream<ResultElement> results = call.search("SEARCH BY SN 'Latimeria chalumnae' IN GBIF RETURN Product HAVING xpath(\"//product[type='Occurrence' and count>0]\")");
|
||||
|
||||
// Stream<ResultElement> results = call.search("SEARCH BY SN 'Palinurus elephas' IN WoRMS RETURN Taxon");
|
||||
|
||||
StreamIterator<ResultElement> input = new StreamIterator<ResultElement>(results);
|
||||
|
||||
|
||||
System.out.println("Results from service...");
|
||||
int i=0;
|
||||
if (results.hasNext()) {
|
||||
while(results.hasNext()) {
|
||||
ResultElement elem = results.next();
|
||||
System.out.println(++i +") el: "+elem.getId());
|
||||
|
||||
System.out.println(++i +") el: "+elem.getId() +" type: "+elem.getType().name());
|
||||
}
|
||||
|
||||
|
||||
System.out.println("Results from conversion...");
|
||||
ConversionIterator<ResultElement, ResultItem> caster = buildCaster(input);
|
||||
|
||||
//from ResultItem to ResultRow
|
||||
ResultItemConverter converter = new ResultItemConverter(session);
|
||||
ConversionIterator<ResultItem, ResultRow> inputConverter = new ConversionIterator<ResultItem, ResultRow>(caster, converter);
|
||||
|
||||
while (inputConverter.hasNext()) {
|
||||
ResultRow row = inputConverter.next();
|
||||
|
||||
System.out.println(++i +") row: "+row);
|
||||
|
||||
}
|
||||
|
||||
|
||||
results.close();
|
||||
System.out.println("DONE");
|
||||
}
|
||||
|
||||
protected static <I,O> ConversionIterator<I, O> buildCaster(CloseableIterator<I> input)
|
||||
{
|
||||
CastConverter<I, O> elementConverter = new CastConverter<I, O>();
|
||||
ConversionIterator<I, O> caster = new ConversionIterator<I, O>(input, elementConverter);
|
||||
return caster;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in New Issue