some model changes
fao_state added (it's a new time series) catches/landings separated reference_year added reporting_year is now a list narrative_state_and_trend changed (is a time series) species is a series with code, system and name (no longer species code and name separated) assessment_distribution_area is now a list with objects having code, system, name assessment_methods changed as list having name, reference_year and reporting_year_or_assessment git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@150670 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
679e6097d8
commit
00e2a6c6fc
|
@ -61,7 +61,11 @@ public class Common extends Base{
|
|||
|
||||
@JsonProperty("reporting_year")
|
||||
@CustomField(key="Reporting year")
|
||||
private Long reportingYear;
|
||||
private List<Long> reportingYear;
|
||||
|
||||
@JsonProperty("reference_year")
|
||||
@CustomField(key="Reference year")
|
||||
private List<Long> referenceYear;
|
||||
|
||||
// automatically compiled
|
||||
@JsonProperty("grsf_type")
|
||||
|
@ -75,21 +79,27 @@ public class Common extends Base{
|
|||
@CustomField(key=SOURCE_KEY)
|
||||
private String sourceType;
|
||||
|
||||
@JsonProperty("catches_or_landings")
|
||||
@CustomField(key="Catches or landings")
|
||||
@JsonProperty("catches")
|
||||
@CustomField(key="Catches")
|
||||
@TimeSeries
|
||||
@Valid
|
||||
private List<TimeSeriesBean<String, String>> catchesOrLandings;
|
||||
private List<TimeSeriesBean<String, String>> catches;
|
||||
|
||||
@JsonProperty("species_name")
|
||||
@CustomField(key="Species Scientific Name")
|
||||
@Tag
|
||||
private List<String> speciesName;
|
||||
@JsonProperty("landings")
|
||||
@CustomField(key="Landings")
|
||||
@TimeSeries
|
||||
@Valid
|
||||
private List<TimeSeriesBean<String, String>> landings;
|
||||
|
||||
@JsonProperty("species_code")
|
||||
@CustomField(key="Species code")
|
||||
@Tag
|
||||
private List<String> speciesCode;
|
||||
@JsonProperty("species")
|
||||
@CustomField(key="species")
|
||||
private List<String> species;
|
||||
|
||||
@JsonProperty("fao_state")
|
||||
@CustomField(key="Fao State")
|
||||
@TimeSeries
|
||||
@Valid
|
||||
private List<TimeSeriesBean<String, Void>> faoState;
|
||||
|
||||
public Common() {
|
||||
super();
|
||||
|
@ -104,19 +114,22 @@ public class Common extends Base{
|
|||
* @param traceabilityFlag
|
||||
* @param status
|
||||
* @param reportingYear
|
||||
* @param referenceYear
|
||||
* @param grsfType
|
||||
* @param sourceType
|
||||
* @param catchesOrLandings
|
||||
* @param speciesName
|
||||
* @param speciesCode
|
||||
* @param catches
|
||||
* @param landings
|
||||
* @param species
|
||||
* @param faoState
|
||||
*/
|
||||
public Common(String dataOwner, List<Resource<Sources>> databaseSources,
|
||||
List<Resource<String>> sourceOfInformation,
|
||||
List<RefersToBean> refersTo, String shortTitle,
|
||||
Boolean traceabilityFlag, Status status, Long reportingYear,
|
||||
String grsfType, String sourceType,
|
||||
List<TimeSeriesBean<String, String>> catchesOrLandings,
|
||||
List<String> speciesName, List<String> speciesCode) {
|
||||
Boolean traceabilityFlag, Status status, List<Long> reportingYear,
|
||||
List<Long> referenceYear, String grsfType, String sourceType,
|
||||
List<TimeSeriesBean<String, String>> catches,
|
||||
List<TimeSeriesBean<String, String>> landings,
|
||||
List<String> species, List<TimeSeriesBean<String, Void>> faoState) {
|
||||
super();
|
||||
this.dataOwner = dataOwner;
|
||||
this.databaseSources = databaseSources;
|
||||
|
@ -126,11 +139,13 @@ public class Common extends Base{
|
|||
this.traceabilityFlag = traceabilityFlag;
|
||||
this.status = status;
|
||||
this.reportingYear = reportingYear;
|
||||
this.referenceYear = referenceYear;
|
||||
this.grsfType = grsfType;
|
||||
this.sourceType = sourceType;
|
||||
this.catchesOrLandings = catchesOrLandings;
|
||||
this.speciesName = speciesName;
|
||||
this.speciesCode = speciesCode;
|
||||
this.catches = catches;
|
||||
this.landings = landings;
|
||||
this.species = species;
|
||||
this.faoState = faoState;
|
||||
}
|
||||
|
||||
public String getGrsfType() {
|
||||
|
@ -165,11 +180,11 @@ public class Common extends Base{
|
|||
this.refersTo = refersTo;
|
||||
}
|
||||
|
||||
public Long getReportingYear() {
|
||||
public List<Long> getReportingYear() {
|
||||
return reportingYear;
|
||||
}
|
||||
|
||||
public void setReportingYear(Long reportingYear) {
|
||||
public void setReportingYear(List<Long> reportingYear) {
|
||||
this.reportingYear = reportingYear;
|
||||
}
|
||||
|
||||
|
@ -221,30 +236,44 @@ public class Common extends Base{
|
|||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
public List<TimeSeriesBean<String, String>> getCatchesOrLandings() {
|
||||
return catchesOrLandings;
|
||||
public List<String> getSpecies() {
|
||||
return species;
|
||||
}
|
||||
|
||||
public void setCatchesOrLandings(
|
||||
List<TimeSeriesBean<String, String>> catchesOrLandings) {
|
||||
this.catchesOrLandings = catchesOrLandings;
|
||||
public void setSpecies(List<String> species) {
|
||||
this.species = species;
|
||||
}
|
||||
|
||||
public List<String> getSpeciesName() {
|
||||
return speciesName;
|
||||
public List<TimeSeriesBean<String, String>> getCatches() {
|
||||
return catches;
|
||||
}
|
||||
|
||||
public void setSpeciesName(List<String> speciesName) {
|
||||
this.speciesName = speciesName;
|
||||
public void setCatches(List<TimeSeriesBean<String, String>> catches) {
|
||||
this.catches = catches;
|
||||
}
|
||||
|
||||
public List<String> getSpeciesCode() {
|
||||
return speciesCode;
|
||||
public List<TimeSeriesBean<String, String>> getLandings() {
|
||||
return landings;
|
||||
}
|
||||
|
||||
public void setSpeciesCode(List<String> speciesCode) {
|
||||
this.speciesCode = speciesCode;
|
||||
public void setLandings(List<TimeSeriesBean<String, String>> landings) {
|
||||
this.landings = landings;
|
||||
}
|
||||
|
||||
public List<Long> getReferenceYear() {
|
||||
return referenceYear;
|
||||
}
|
||||
|
||||
public void setReferenceYear(List<Long> referenceYear) {
|
||||
this.referenceYear = referenceYear;
|
||||
}
|
||||
|
||||
public List<TimeSeriesBean<String, Void>> getFaoState() {
|
||||
return faoState;
|
||||
}
|
||||
|
||||
public void setFaoState(List<TimeSeriesBean<String, Void>> faoState) {
|
||||
this.faoState = faoState;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -254,10 +283,10 @@ public class Common extends Base{
|
|||
+ sourceOfInformation + ", refersTo=" + refersTo
|
||||
+ ", shortTitle=" + shortTitle + ", traceabilityFlag="
|
||||
+ traceabilityFlag + ", status=" + status + ", reportingYear="
|
||||
+ reportingYear + ", grsfType=" + grsfType + ", sourceType="
|
||||
+ sourceType + ", catchesOrLandings=" + catchesOrLandings
|
||||
+ ", speciesName=" + speciesName + ", speciesCode="
|
||||
+ speciesCode + "]";
|
||||
+ reportingYear + ", referenceYear=" + referenceYear
|
||||
+ ", grsfType=" + grsfType + ", sourceType=" + sourceType
|
||||
+ ", catches=" + catches + ", landings=" + landings
|
||||
+ ", species=" + species + ", faoState=" + faoState + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,14 +34,8 @@ public class StockRecord extends Common{
|
|||
@CustomField(key="Stock id")
|
||||
private String stockId;
|
||||
|
||||
// @JsonProperty("species")
|
||||
// @CustomField(key="Species")
|
||||
// @Tag
|
||||
// private List<String> species;
|
||||
|
||||
@JsonProperty("assessment_distribution_area")
|
||||
@CustomField(key="Assessment distribution area")
|
||||
@Tag
|
||||
private List<String> area;
|
||||
|
||||
@JsonProperty("exploiting_fishery")
|
||||
|
@ -55,7 +49,7 @@ public class StockRecord extends Common{
|
|||
|
||||
@JsonProperty("assessment_methods")
|
||||
@CustomField(key="Assessment methods")
|
||||
private String assessmentMethods;
|
||||
private List<String> assessmentMethods;
|
||||
|
||||
@JsonProperty("state_of_marine_resource")
|
||||
@CustomField(key="State of marine resources")
|
||||
|
@ -99,9 +93,9 @@ public class StockRecord extends Common{
|
|||
@Valid
|
||||
private List<TimeSeriesBean<String, String>> fishingPressure;
|
||||
|
||||
@JsonProperty("narrative_state_and_trend")
|
||||
@CustomField(key="Narrative state and trend")
|
||||
private String narrativeStateAndTrend;
|
||||
@JsonProperty("narrative_state")
|
||||
@CustomField(key="Narrative state")
|
||||
private List<TimeSeriesBean<String, Void>> narrativeState;
|
||||
|
||||
@JsonProperty("scientific_advice")
|
||||
@CustomField(key="Scientific advice")
|
||||
|
@ -123,7 +117,6 @@ public class StockRecord extends Common{
|
|||
|
||||
@JsonProperty("type")
|
||||
@CustomField(key="Type")
|
||||
//@Tag
|
||||
@Group
|
||||
private Stock_Type type;
|
||||
|
||||
|
@ -132,10 +125,8 @@ public class StockRecord extends Common{
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a Stock element.
|
||||
* @param stockName
|
||||
* @param stockID
|
||||
* @param species
|
||||
* @param stockId
|
||||
* @param area
|
||||
* @param exploitingFishery
|
||||
* @param managementEntity
|
||||
|
@ -145,10 +136,11 @@ public class StockRecord extends Common{
|
|||
* @param exploitationRate
|
||||
* @param abundanceLevelStandard
|
||||
* @param abundanceLevel
|
||||
* @param narrativeStateAndTrend
|
||||
* @param fishingPressureStandard
|
||||
* @param fishingPressure
|
||||
* @param narrativeState
|
||||
* @param scientificAdvice
|
||||
* @param reportingEntity
|
||||
* @param reportingYear
|
||||
* @param assessor
|
||||
* @param stockUri
|
||||
* @param waterArea
|
||||
* @param type
|
||||
|
@ -156,23 +148,23 @@ public class StockRecord extends Common{
|
|||
public StockRecord(
|
||||
String stockName,
|
||||
String stockId,
|
||||
//List<String> species,
|
||||
List<String> area,
|
||||
List<String> exploitingFishery,
|
||||
String managementEntity,
|
||||
String assessmentMethods,
|
||||
List<String> assessmentMethods,
|
||||
String stateOfMarineResource,
|
||||
List<TimeSeriesBean<Exploitation_Rate, Void>> exploitationRateStandard,
|
||||
List<TimeSeriesBean<String, String>> exploitationRate,
|
||||
List<TimeSeriesBean<Abundance_Level, Void>> abundanceLevelStandard,
|
||||
List<TimeSeriesBean<String, String>> abundanceLevel,
|
||||
String narrativeStateAndTrend, String scientificAdvice,
|
||||
String assessor, Long reportingYear, String stockUri,
|
||||
List<TimeSeriesBean<String, Void>> fishingPressureStandard,
|
||||
List<TimeSeriesBean<String, String>> fishingPressure,
|
||||
List<TimeSeriesBean<String, Void>> narrativeState,
|
||||
String scientificAdvice, String assessor, String stockUri,
|
||||
List<String> waterArea, Stock_Type type) {
|
||||
super();
|
||||
this.stockName = stockName;
|
||||
this.stockId = stockId;
|
||||
//this.species = species;
|
||||
this.area = area;
|
||||
this.exploitingFishery = exploitingFishery;
|
||||
this.managementEntity = managementEntity;
|
||||
|
@ -182,7 +174,9 @@ public class StockRecord extends Common{
|
|||
this.exploitationRate = exploitationRate;
|
||||
this.abundanceLevelStandard = abundanceLevelStandard;
|
||||
this.abundanceLevel = abundanceLevel;
|
||||
this.narrativeStateAndTrend = narrativeStateAndTrend;
|
||||
this.fishingPressureStandard = fishingPressureStandard;
|
||||
this.fishingPressure = fishingPressure;
|
||||
this.narrativeState = narrativeState;
|
||||
this.scientificAdvice = scientificAdvice;
|
||||
this.assessor = assessor;
|
||||
this.stockUri = stockUri;
|
||||
|
@ -190,6 +184,10 @@ public class StockRecord extends Common{
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
public void setAssessmentMethods(List<String> assessmentMethods) {
|
||||
this.assessmentMethods = assessmentMethods;
|
||||
}
|
||||
|
||||
public Stock_Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
@ -230,14 +228,6 @@ public class StockRecord extends Common{
|
|||
this.stockId = stockId;
|
||||
}
|
||||
|
||||
// public List<String> getSpecies() {
|
||||
// return species;
|
||||
// }
|
||||
//
|
||||
// public void setSpecies(List<String> species) {
|
||||
// this.species = species;
|
||||
// }
|
||||
|
||||
public List<String> getArea() {
|
||||
return area;
|
||||
}
|
||||
|
@ -280,14 +270,6 @@ public class StockRecord extends Common{
|
|||
this.managementEntity = managementEntity;
|
||||
}
|
||||
|
||||
public String getAssessmentMethods() {
|
||||
return assessmentMethods;
|
||||
}
|
||||
|
||||
public void setAssessmentMethods(String assessmentMethods) {
|
||||
this.assessmentMethods = assessmentMethods;
|
||||
}
|
||||
|
||||
public String getStateOfMarineResource() {
|
||||
return stateOfMarineResource;
|
||||
}
|
||||
|
@ -323,12 +305,12 @@ public class StockRecord extends Common{
|
|||
this.abundanceLevel = abundanceLevel;
|
||||
}
|
||||
|
||||
public String getNarrativeStateAndTrend() {
|
||||
return narrativeStateAndTrend;
|
||||
public List<TimeSeriesBean<String, Void>> getNarrativeState() {
|
||||
return narrativeState;
|
||||
}
|
||||
|
||||
public void setNarrativeStateAndTrend(String narrativeStateAndTrend) {
|
||||
this.narrativeStateAndTrend = narrativeStateAndTrend;
|
||||
public void setNarrativeState(List<TimeSeriesBean<String, Void>> narrativeState) {
|
||||
this.narrativeState = narrativeState;
|
||||
}
|
||||
|
||||
public String getScientificAdvice() {
|
||||
|
@ -368,11 +350,10 @@ public class StockRecord extends Common{
|
|||
+ ", abundanceLevelStandard=" + abundanceLevelStandard
|
||||
+ ", abundanceLevel=" + abundanceLevel
|
||||
+ ", fishingPressureStandard=" + fishingPressureStandard
|
||||
+ ", fishingPressure=" + fishingPressure
|
||||
+ ", narrativeStateAndTrend=" + narrativeStateAndTrend
|
||||
+ ", scientificAdvice=" + scientificAdvice + ", assessor="
|
||||
+ assessor + ", stockUri=" + stockUri + ", waterArea="
|
||||
+ waterArea + ", type=" + type + "]";
|
||||
+ ", fishingPressure=" + fishingPressure + ", narrativeState="
|
||||
+ narrativeState + ", scientificAdvice=" + scientificAdvice
|
||||
+ ", assessor=" + assessor + ", stockUri=" + stockUri
|
||||
+ ", waterArea=" + waterArea + ", type=" + type + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -87,10 +87,9 @@ public class CommonServiceUtils {
|
|||
if(record.getClass().equals(StockRecord.class)){
|
||||
|
||||
StockRecord stock = (StockRecord) record;
|
||||
List<String> speciesNames = stock.getSpeciesName();
|
||||
List<String> speciesCodes = stock.getSpeciesCode();
|
||||
if(speciesNames == null || speciesNames.isEmpty() || speciesCodes == null || speciesCodes.isEmpty())
|
||||
throw new Exception("species name/code cannot be null/empty in a GRSF record");
|
||||
List<String> species = stock.getSpecies();
|
||||
if(species == null || species.isEmpty())
|
||||
throw new Exception("species cannot be null/empty in a GRSF record");
|
||||
}
|
||||
|
||||
// check if it is a stock and perform related checks
|
||||
|
|
|
@ -291,14 +291,14 @@ public class GrsfPublisherFisheryService {
|
|||
|
||||
// write a post if the product has been published in grsf context
|
||||
if(context.equals((String)contextServlet.getInitParameter(HelperMethods.PUBLIC_CONTEX_KEY))){
|
||||
new WritePostCatalogueManagerThread(
|
||||
/*new WritePostCatalogueManagerThread(
|
||||
context,
|
||||
token,
|
||||
futureTitle,
|
||||
itemUrl,
|
||||
false,
|
||||
new ArrayList<String>(),
|
||||
authorFullname).start();
|
||||
authorFullname).start();*/
|
||||
|
||||
logger.info("Thread to write a post about the new product has been launched");
|
||||
}
|
||||
|
|
|
@ -288,7 +288,7 @@ public class GrsfPublisherStockService {
|
|||
|
||||
// write a post if the product has been published in grsf context
|
||||
if(context.equals((String)contextServlet.getInitParameter(HelperMethods.PUBLIC_CONTEX_KEY))){
|
||||
new WritePostCatalogueManagerThread(
|
||||
/*new WritePostCatalogueManagerThread(
|
||||
context,
|
||||
token,
|
||||
futureTitle,
|
||||
|
@ -296,7 +296,7 @@ public class GrsfPublisherStockService {
|
|||
false,
|
||||
new ArrayList<String>(),
|
||||
authorFullname).start();
|
||||
logger.info("Thread to write a post about the new product has been launched");
|
||||
logger.info("Thread to write a post about the new product has been launched");*/
|
||||
}
|
||||
|
||||
}else
|
||||
|
|
|
@ -17,7 +17,7 @@ public class CacheImpl <K, V> implements CacheInterface<K, V> {
|
|||
/**
|
||||
* The hashmap
|
||||
*/
|
||||
private Map<K, CacheValueBean<V>> userSpaceMap;
|
||||
private Map<K, CacheValueBean<V>> cache;
|
||||
|
||||
/**
|
||||
* Cache entry expires after EXPIRED_AFTER ms
|
||||
|
@ -26,16 +26,16 @@ public class CacheImpl <K, V> implements CacheInterface<K, V> {
|
|||
|
||||
public CacheImpl(long timeout){
|
||||
ttl = timeout;
|
||||
userSpaceMap = new ConcurrentHashMap<>();
|
||||
cache = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public V get(K key) {
|
||||
|
||||
if(userSpaceMap.containsKey(key)){
|
||||
CacheValueBean<V> bean = userSpaceMap.get(key);
|
||||
if(cache.containsKey(key)){
|
||||
CacheValueBean<V> bean = cache.get(key);
|
||||
if(CacheUtilities.expired(bean.getTTL(), ttl)){
|
||||
userSpaceMap.remove(key);
|
||||
cache.remove(key);
|
||||
logger.debug("Amount of space in the infrastructure used expired for key " + key + ", returning null");
|
||||
}
|
||||
else
|
||||
|
@ -47,7 +47,7 @@ public class CacheImpl <K, V> implements CacheInterface<K, V> {
|
|||
@Override
|
||||
public boolean insert(K key, V obj) {
|
||||
CacheValueBean<V> newBean = new CacheValueBean<V>(obj, System.currentTimeMillis());
|
||||
userSpaceMap.put(key, newBean);
|
||||
cache.put(key, newBean);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,16 +27,16 @@
|
|||
<context-param>
|
||||
<description>Context of pending products under manage activities</description>
|
||||
<param-name>ManageVRE</param-name>
|
||||
<param-value>/d4science.research-infrastructures.eu/FARM/GRSF_Admin</param-value>
|
||||
<!-- <param-value>/gcube/devNext/NextNext</param-value> -->
|
||||
<!-- <param-value>/d4science.research-infrastructures.eu/FARM/GRSF_Admin</param-value> -->
|
||||
<param-value>/gcube/devNext/NextNext</param-value>
|
||||
<!-- <param-value>/gcube/preprod/Dorne</param-value> -->
|
||||
</context-param>
|
||||
|
||||
<context-param>
|
||||
<description>Context of products no longer under manage activities</description>
|
||||
<param-name>PublicVRE</param-name>
|
||||
<param-value>/d4science.research-infrastructures.eu/FARM/GRSF</param-value>
|
||||
<!-- <param-value>/gcube/devNext/NextNext</param-value> -->
|
||||
<!-- <param-value>/d4science.research-infrastructures.eu/FARM/GRSF</param-value> -->
|
||||
<param-value>/gcube/devNext/NextNext</param-value>
|
||||
<!-- <param-value>/gcube/preprod/preVRE</param-value> -->
|
||||
</context-param>
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import java.lang.reflect.Field;
|
|||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -289,39 +288,6 @@ public class JTests {
|
|||
instance.uploadResourceFile(csvFile, datasetName, instance.getApiKeyFromUsername("costantino.perciante"), "random_name.csv", null);
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void testlist() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException{
|
||||
|
||||
FisheryRecord record = new FisheryRecord();
|
||||
ArrayList<TimeSeriesBean<String, String>> list = new ArrayList<TimeSeriesBean<String,String>>();
|
||||
list.add(new TimeSeriesBean<String, String>("as", 65445L, "asd"));
|
||||
record.setCatchesOrLandings(list);
|
||||
Class<?> current = record.getClass();
|
||||
do{
|
||||
Field[] fields = current.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
if (Collection.class.isAssignableFrom(field.getType())) {
|
||||
// if the list is not null, get an element
|
||||
Object f = new PropertyDescriptor(field.getName(), current).getReadMethod().invoke(record);
|
||||
if(f != null){
|
||||
List asList = (List)f;
|
||||
if(!asList.isEmpty())
|
||||
if(asList.get(0).getClass().equals(TimeSeriesBean.class)){
|
||||
logger.debug("Name is " + field.getName());
|
||||
CustomField customAnnotation = field.getAnnotation(CustomField.class);
|
||||
if(customAnnotation != null)
|
||||
logger.debug("Name is " + customAnnotation.key());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
while((current = current.getSuperclass())!=null); // iterate from the inherited class up to the Object.class
|
||||
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void sharedVREFolderWriteTest() throws Exception{
|
||||
|
||||
|
|
Loading…
Reference in New Issue