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:
parent
0ac739e926
commit
917fd74330
|
@ -6,9 +6,9 @@ import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
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 ...).
|
* 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.
|
* that the catalogue creates for its inner resources.
|
||||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,7 +23,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
public class Common extends Base{
|
public class Common extends Base{
|
||||||
|
|
||||||
public static final String PRODUCT_TYPE_KEY = "Product type"; // stock, fishery
|
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")
|
@JsonProperty("data_owner")
|
||||||
@CustomField(key="Data owner")
|
@CustomField(key="Data owner")
|
||||||
|
@ -31,8 +31,6 @@ public class Common extends Base{
|
||||||
|
|
||||||
@JsonProperty("database_sources")
|
@JsonProperty("database_sources")
|
||||||
@CkanResource
|
@CkanResource
|
||||||
// @NotNull(message="database_source cannot be null")
|
|
||||||
// @Size(min=1, message="database_source cannot be empty")
|
|
||||||
@Tag
|
@Tag
|
||||||
@Valid
|
@Valid
|
||||||
private List<Resource<Sources>> databaseSources;
|
private List<Resource<Sources>> databaseSources;
|
||||||
|
@ -43,20 +41,15 @@ public class Common extends Base{
|
||||||
private List<Resource<String>> sourceOfInformation;
|
private List<Resource<String>> sourceOfInformation;
|
||||||
|
|
||||||
@JsonProperty("refers_to")
|
@JsonProperty("refers_to")
|
||||||
// @NotNull(message="refers_to cannot be null")
|
|
||||||
// @Size(min=1, message="refers_to cannot be empty")
|
|
||||||
@Valid
|
@Valid
|
||||||
private List<RefersToBean> refersTo;
|
private List<RefersToBean> refersTo;
|
||||||
|
|
||||||
@JsonProperty("short_title")
|
@JsonProperty("short_title")
|
||||||
@CustomField(key="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;
|
private String shortTitle;
|
||||||
|
|
||||||
@JsonProperty("traceability_flag")
|
@JsonProperty("traceability_flag")
|
||||||
@CustomField(key="Traceability Flag")
|
@CustomField(key="Traceability Flag")
|
||||||
// @NotNull(message="traceability_flag cannot be null")
|
|
||||||
private Boolean traceabilityFlag;
|
private Boolean traceabilityFlag;
|
||||||
|
|
||||||
@JsonProperty("status")
|
@JsonProperty("status")
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.data_catalogue.grsf_publish_ws.services;
|
||||||
import java.beans.PropertyDescriptor;
|
import java.beans.PropertyDescriptor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -152,7 +153,6 @@ public class CommonServiceUtils {
|
||||||
|
|
||||||
for (int i = (asList.size() - elementsToConsider); i < asList.size(); i++) {
|
for (int i = (asList.size() - elementsToConsider); i < asList.size(); i++) {
|
||||||
String finalTag = asList.get(i).toString().trim().replaceAll(REGEX_TAGS, "");
|
String finalTag = asList.get(i).toString().trim().replaceAll(REGEX_TAGS, "");
|
||||||
|
|
||||||
tags.add(finalTag);
|
tags.add(finalTag);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
@ -234,11 +234,13 @@ public class CommonServiceUtils {
|
||||||
Object f = new PropertyDescriptor(field.getName(), current).getReadMethod().invoke(record);
|
Object f = new PropertyDescriptor(field.getName(), current).getReadMethod().invoke(record);
|
||||||
String keyField = field.getAnnotation(CustomField.class).key();
|
String keyField = field.getAnnotation(CustomField.class).key();
|
||||||
if(f != null){
|
if(f != null){
|
||||||
List<String> valuesForKey = new ArrayList<String>();
|
Set<String> valuesForKey = null;
|
||||||
|
|
||||||
// check if the map already contains this key
|
// check if the map already contains this key
|
||||||
if(extras.containsKey(keyField))
|
if(extras.containsKey(keyField))
|
||||||
valuesForKey = extras.get(keyField);
|
valuesForKey = new HashSet(extras.get(keyField));
|
||||||
|
else
|
||||||
|
valuesForKey = new HashSet<String>();
|
||||||
|
|
||||||
if(f instanceof List<?>){
|
if(f instanceof List<?>){
|
||||||
logger.debug("The object " + field.getName() + " is a list and is annotated with @CustomField. Adding ...");
|
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
|
// add to the map
|
||||||
extras.put(keyField, valuesForKey);
|
extras.put(keyField, new ArrayList<String>(valuesForKey));
|
||||||
}
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("Failed to read value for field " + field.getName() + " skipping", e);
|
logger.error("Failed to read value for field " + field.getName() + " skipping", e);
|
||||||
|
|
|
@ -15,20 +15,11 @@ public enum Exploitation_Rate {
|
||||||
Uncertain_Not_assessed("Uncertain/Not assessed");
|
Uncertain_Not_assessed("Uncertain/Not assessed");
|
||||||
|
|
||||||
private String subGroupNameOrig;
|
private String subGroupNameOrig;
|
||||||
private String subGroupNameOnCkan;
|
|
||||||
|
|
||||||
private Exploitation_Rate(String origName) {
|
private Exploitation_Rate(String origName) {
|
||||||
this.subGroupNameOrig = origName;
|
this.subGroupNameOrig = origName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the name the group has on ckan
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getNameCkan(){
|
|
||||||
return subGroupNameOnCkan;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the original name
|
* Return the original name
|
||||||
* @return
|
* @return
|
||||||
|
|
|
@ -15,7 +15,7 @@ public enum Production_System_Type {
|
||||||
Artisanal("Artisanal"),
|
Artisanal("Artisanal"),
|
||||||
Semi_Industrial("Semi-industrial"),
|
Semi_Industrial("Semi-industrial"),
|
||||||
Industrial("Industrial"),
|
Industrial("Industrial"),
|
||||||
Exploratory_fishery("Exploratory_fishery"),
|
Exploratory_fishery("Exploratory fishery"),
|
||||||
Unspecified("Unspecified");
|
Unspecified("Unspecified");
|
||||||
|
|
||||||
private String subGroupNameOrig;
|
private String subGroupNameOrig;
|
||||||
|
|
Loading…
Reference in New Issue