minor fixes. Abundance level and Exploration rate (standard) are used for tagging purposes only. The related groups will not be present

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@139828 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-12-08 20:57:08 +00:00
parent 0ac739e926
commit 917fd74330
6 changed files with 11 additions and 25 deletions

View File

@ -6,9 +6,9 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* TimeSeries annotation. A list annotated with such field is transformed in a catalogue resources.
* TimeSeries annotation. A list annotated with such field is transformed in a catalogue resource.
* Its elements should look like as (year, value1, value2 ...).
* The list is put in a csv file which is in turn uploaded on a shared folder, to replace the url
* The list is put in a csv file which is in turn uploaded on a shared vre folder, to replace the url
* that the catalogue creates for its inner resources.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/

View File

@ -23,7 +23,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class Common extends Base{
public static final String PRODUCT_TYPE_KEY = "Product type"; // stock, fishery
public static final String RECORD_TYPE_KEY = "Record type"; // aggregated, original
public static final String RECORD_TYPE_KEY = "Record type"; // aggregated, source
@JsonProperty("data_owner")
@CustomField(key="Data owner")
@ -31,8 +31,6 @@ public class Common extends Base{
@JsonProperty("database_sources")
@CkanResource
// @NotNull(message="database_source cannot be null")
// @Size(min=1, message="database_source cannot be empty")
@Tag
@Valid
private List<Resource<Sources>> databaseSources;
@ -43,20 +41,15 @@ public class Common extends Base{
private List<Resource<String>> sourceOfInformation;
@JsonProperty("refers_to")
// @NotNull(message="refers_to cannot be null")
// @Size(min=1, message="refers_to cannot be empty")
@Valid
private List<RefersToBean> refersTo;
@JsonProperty("short_title")
@CustomField(key="Short Title")
// @NotNull(message="short_title cannot be null")
// @Size(min=1, message="short_title cannot be empty")
private String shortTitle;
@JsonProperty("traceability_flag")
@CustomField(key="Traceability Flag")
// @NotNull(message="traceability_flag cannot be null")
private Boolean traceabilityFlag;
@JsonProperty("status")

View File

@ -321,7 +321,7 @@ public class StockRecord extends Common{
List<TimeSeriesBean<String, String>> exploitationRate) {
this.exploitationRate = exploitationRate;
}
@Override
public String toString() {
return "StockRecord [stockName=" + stockName + ", stockID=" + stockID

View File

@ -3,6 +3,7 @@ package org.gcube.data_catalogue.grsf_publish_ws.services;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -152,7 +153,6 @@ public class CommonServiceUtils {
for (int i = (asList.size() - elementsToConsider); i < asList.size(); i++) {
String finalTag = asList.get(i).toString().trim().replaceAll(REGEX_TAGS, "");
tags.add(finalTag);
}
}else{
@ -234,11 +234,13 @@ public class CommonServiceUtils {
Object f = new PropertyDescriptor(field.getName(), current).getReadMethod().invoke(record);
String keyField = field.getAnnotation(CustomField.class).key();
if(f != null){
List<String> valuesForKey = new ArrayList<String>();
Set<String> valuesForKey = null;
// check if the map already contains this key
if(extras.containsKey(keyField))
valuesForKey = extras.get(keyField);
valuesForKey = new HashSet(extras.get(keyField));
else
valuesForKey = new HashSet<String>();
if(f instanceof List<?>){
logger.debug("The object " + field.getName() + " is a list and is annotated with @CustomField. Adding ...");
@ -270,7 +272,7 @@ public class CommonServiceUtils {
}
// add to the map
extras.put(keyField, valuesForKey);
extras.put(keyField, new ArrayList<String>(valuesForKey));
}
}catch(Exception e){
logger.error("Failed to read value for field " + field.getName() + " skipping", e);

View File

@ -15,20 +15,11 @@ public enum Exploitation_Rate {
Uncertain_Not_assessed("Uncertain/Not assessed");
private String subGroupNameOrig;
private String subGroupNameOnCkan;
private Exploitation_Rate(String origName) {
this.subGroupNameOrig = origName;
}
/**
* Return the name the group has on ckan
* @return
*/
public String getNameCkan(){
return subGroupNameOnCkan;
}
/**
* Return the original name
* @return

View File

@ -15,7 +15,7 @@ public enum Production_System_Type {
Artisanal("Artisanal"),
Semi_Industrial("Semi-industrial"),
Industrial("Industrial"),
Exploratory_fishery("Exploratory_fishery"),
Exploratory_fishery("Exploratory fishery"),
Unspecified("Unspecified");
private String subGroupNameOrig;