some minor changes: Product Type changed to GRSF Type, Record Type changed to Source
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@142718 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
90a19689f5
commit
3c9b149d54
|
@ -8,7 +8,6 @@ import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.CkanResource;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.CustomField;
|
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.CustomField;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Group;
|
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Group;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Tag;
|
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Tag;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Record_Type;
|
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Sources;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Sources;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Status;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Status;
|
||||||
|
|
||||||
|
@ -19,12 +18,12 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
* Information that both Stock and Fishery records must contain.
|
* Information that both Stock and Fishery records must contain.
|
||||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
*/
|
*/
|
||||||
@JsonIgnoreProperties(value = {"product_type"})
|
@JsonIgnoreProperties(value = {"grsf_type", "source"})
|
||||||
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 GRSF_TYPE_KEY = "GRSF type"; // stock, fishery
|
||||||
public static final String RECORD_TYPE_KEY = "Record type"; // aggregated, source
|
public static final String SOURCE_KEY = "Source"; // in case it is a RAM/FIRMS/FishSource record it is not added
|
||||||
|
// it is added in case of GRSF record
|
||||||
@JsonProperty("data_owner")
|
@JsonProperty("data_owner")
|
||||||
@CustomField(key="Data owner")
|
@CustomField(key="Data owner")
|
||||||
@Tag
|
@Tag
|
||||||
|
@ -64,16 +63,16 @@ public class Common extends Base{
|
||||||
private Long reportingYear;
|
private Long reportingYear;
|
||||||
|
|
||||||
// automatically compiled
|
// automatically compiled
|
||||||
@JsonProperty("product_type")
|
@JsonProperty("grsf_type")
|
||||||
@CustomField(key=PRODUCT_TYPE_KEY)
|
@CustomField(key=GRSF_TYPE_KEY)
|
||||||
//@Tag
|
//@Tag
|
||||||
//@Group
|
//@Group
|
||||||
private String productType;
|
private String grsfType;
|
||||||
|
|
||||||
// automatically compiled
|
// automatically compiled
|
||||||
@JsonProperty("record_type")
|
@JsonProperty("source")
|
||||||
@CustomField(key=RECORD_TYPE_KEY)
|
@CustomField(key=SOURCE_KEY)
|
||||||
private Record_Type recordType;
|
private String sourceType;
|
||||||
|
|
||||||
public Common() {
|
public Common() {
|
||||||
super();
|
super();
|
||||||
|
@ -84,7 +83,7 @@ public class Common extends Base{
|
||||||
List<Resource<String>> sourceOfInformation,
|
List<Resource<String>> sourceOfInformation,
|
||||||
List<RefersToBean> refersTo, String shortTitle,
|
List<RefersToBean> refersTo, String shortTitle,
|
||||||
Boolean traceabilityFlag, Status status, Long reportingYear,
|
Boolean traceabilityFlag, Status status, Long reportingYear,
|
||||||
String productType, Record_Type recordType) {
|
String grsfType, String sourceType) {
|
||||||
super();
|
super();
|
||||||
this.dataOwner = dataOwner;
|
this.dataOwner = dataOwner;
|
||||||
this.databaseSources = databaseSources;
|
this.databaseSources = databaseSources;
|
||||||
|
@ -94,18 +93,30 @@ public class Common extends Base{
|
||||||
this.traceabilityFlag = traceabilityFlag;
|
this.traceabilityFlag = traceabilityFlag;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.reportingYear = reportingYear;
|
this.reportingYear = reportingYear;
|
||||||
this.productType = productType;
|
this.grsfType = grsfType;
|
||||||
this.recordType = recordType;
|
this.sourceType = sourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Record_Type getRecordType() {
|
public String getGrsfType() {
|
||||||
return recordType;
|
return grsfType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRecordType(Record_Type recordType) {
|
|
||||||
this.recordType = recordType;
|
public void setGrsfType(String grsfType) {
|
||||||
|
this.grsfType = grsfType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getSourceType() {
|
||||||
|
return sourceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setSourceType(String sourceType) {
|
||||||
|
this.sourceType = sourceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Boolean getTraceabilityFlag() {
|
public Boolean getTraceabilityFlag() {
|
||||||
return traceabilityFlag;
|
return traceabilityFlag;
|
||||||
}
|
}
|
||||||
|
@ -142,14 +153,6 @@ public class Common extends Base{
|
||||||
this.sourceOfInformation = sourceOfInformation;
|
this.sourceOfInformation = sourceOfInformation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProductType() {
|
|
||||||
return productType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductType(String productType) {
|
|
||||||
this.productType = productType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDataOwner() {
|
public String getDataOwner() {
|
||||||
return dataOwner;
|
return dataOwner;
|
||||||
}
|
}
|
||||||
|
@ -182,6 +185,7 @@ public class Common extends Base{
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Common [dataOwner=" + dataOwner + ", databaseSources="
|
return "Common [dataOwner=" + dataOwner + ", databaseSources="
|
||||||
|
@ -189,8 +193,7 @@ public class Common extends Base{
|
||||||
+ sourceOfInformation + ", refersTo=" + refersTo
|
+ sourceOfInformation + ", refersTo=" + refersTo
|
||||||
+ ", shortTitle=" + shortTitle + ", traceabilityFlag="
|
+ ", shortTitle=" + shortTitle + ", traceabilityFlag="
|
||||||
+ traceabilityFlag + ", status=" + status + ", reportingYear="
|
+ traceabilityFlag + ", status=" + status + ", reportingYear="
|
||||||
+ reportingYear + ", productType=" + productType
|
+ reportingYear + ", grsfType=" + grsfType + ", sourceType="
|
||||||
+ ", recordType=" + recordType + "]";
|
+ sourceType + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ public class StockRecord extends Common{
|
||||||
|
|
||||||
@JsonProperty("management_entity")
|
@JsonProperty("management_entity")
|
||||||
@CustomField(key="Management entity")
|
@CustomField(key="Management entity")
|
||||||
|
@Tag
|
||||||
private String managementEntity;
|
private String managementEntity;
|
||||||
|
|
||||||
@JsonProperty("assessment_methods")
|
@JsonProperty("assessment_methods")
|
||||||
|
|
|
@ -32,11 +32,11 @@ import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.DeleteProductBean;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.DeleteProductBean;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.FisheryRecord;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.FisheryRecord;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.RefersToBean;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.RefersToBean;
|
||||||
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.Resource;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.output.ResponseBean;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.output.ResponseBean;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.output.ResponseCreationBean;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.output.ResponseCreationBean;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Product_Type;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Product_Type;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Record_Type;
|
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Sources;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Sources;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.threads.AssociationToGroupThread;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.threads.AssociationToGroupThread;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.threads.ManageTimeSeriesThread;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.threads.ManageTimeSeriesThread;
|
||||||
|
@ -159,14 +159,20 @@ public class GrsfPublisherFisheryService {
|
||||||
// Status field is needed only in the Manage context for GRSF records
|
// Status field is needed only in the Manage context for GRSF records
|
||||||
if(context.equals((String)contextServlet.getInitParameter(HelperMethods.MANAGE_CONTEX_KEY))){
|
if(context.equals((String)contextServlet.getInitParameter(HelperMethods.MANAGE_CONTEX_KEY))){
|
||||||
if(sourceInPath.equals(Sources.GRSF)){
|
if(sourceInPath.equals(Sources.GRSF)){
|
||||||
record.setRecordType(Record_Type.AGGREGATED);
|
//Evaluate the sources
|
||||||
|
List<Resource<Sources>> recordSources = record.getDatabaseSources();
|
||||||
|
String sources = "";
|
||||||
|
for (Resource<Sources> resource : recordSources) {
|
||||||
|
sources += resource.getName() + ", ";
|
||||||
|
}
|
||||||
|
sources = sources.endsWith(", ") ? sources.substring(0, sources.length() -2) : sources;
|
||||||
|
record.setSourceType(sources);
|
||||||
CommonServiceUtils.validateAggregatedRecord(record);
|
CommonServiceUtils.validateAggregatedRecord(record);
|
||||||
}else
|
}
|
||||||
record.setRecordType(Record_Type.SOURCE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the type
|
// set the type
|
||||||
record.setProductType(Product_Type.FISHERY.getOrigName());
|
record.setGrsfType(Product_Type.FISHERY.getOrigName());
|
||||||
|
|
||||||
// product system type is a list of values for sources records, so remove it (so that no group is generated)
|
// product system type is a list of values for sources records, so remove it (so that no group is generated)
|
||||||
if(!sourceInPath.equals(Sources.GRSF))
|
if(!sourceInPath.equals(Sources.GRSF))
|
||||||
|
|
|
@ -31,12 +31,12 @@ import org.gcube.common.authorization.library.utils.Caller;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.DeleteProductBean;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.DeleteProductBean;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.RefersToBean;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.RefersToBean;
|
||||||
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.Resource;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.StockRecord;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.StockRecord;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.output.ResponseBean;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.output.ResponseBean;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.output.ResponseCreationBean;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.output.ResponseCreationBean;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Product_Type;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Product_Type;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Record_Type;
|
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Sources;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Sources;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.threads.AssociationToGroupThread;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.threads.AssociationToGroupThread;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.threads.ManageTimeSeriesThread;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.threads.ManageTimeSeriesThread;
|
||||||
|
@ -152,14 +152,20 @@ public class GrsfPublisherStockService {
|
||||||
// Status field is needed only in the Manage context for GRSF records
|
// Status field is needed only in the Manage context for GRSF records
|
||||||
if(context.equals((String)contextServlet.getInitParameter(HelperMethods.MANAGE_CONTEX_KEY))){
|
if(context.equals((String)contextServlet.getInitParameter(HelperMethods.MANAGE_CONTEX_KEY))){
|
||||||
if(sourceInPath.equals(Sources.GRSF)){
|
if(sourceInPath.equals(Sources.GRSF)){
|
||||||
record.setRecordType(Record_Type.AGGREGATED);
|
//Evaluate the sources
|
||||||
|
List<Resource<Sources>> recordSources = record.getDatabaseSources();
|
||||||
|
String sources = "";
|
||||||
|
for (Resource<Sources> resource : recordSources) {
|
||||||
|
sources += resource.getName() + ", ";
|
||||||
|
}
|
||||||
|
sources = sources.endsWith(", ") ? sources.substring(0, sources.length() -2) : sources;
|
||||||
|
record.setSourceType(sources);
|
||||||
CommonServiceUtils.validateAggregatedRecord(record);
|
CommonServiceUtils.validateAggregatedRecord(record);
|
||||||
}else
|
}
|
||||||
record.setRecordType(Record_Type.SOURCE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the type
|
// set the type
|
||||||
record.setProductType(Product_Type.STOCK.getOrigName());
|
record.setGrsfType(Product_Type.STOCK.getOrigName());
|
||||||
|
|
||||||
// evaluate the custom fields/tags, resources and groups
|
// evaluate the custom fields/tags, resources and groups
|
||||||
Map<String, List<String>> customFields = record.getExtrasFields();
|
Map<String, List<String>> customFields = record.getExtrasFields();
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
package org.gcube.data_catalogue.grsf_publish_ws.utils.groups;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The type of record, i.e. Aggregated or Original
|
|
||||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
|
||||||
*/
|
|
||||||
public enum Record_Type {
|
|
||||||
|
|
||||||
AGGREGATED("Aggregated"),
|
|
||||||
SOURCE("Source");
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
private Record_Type(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRecordType(){
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -158,7 +158,7 @@ public class ManageTimeSeriesThread extends Thread{
|
||||||
// - type of files (e.g., csv)
|
// - type of files (e.g., csv)
|
||||||
// -files (csv)
|
// -files (csv)
|
||||||
|
|
||||||
String recordTypeFolderName = record.getProductType().toLowerCase();
|
String recordTypeFolderName = record.getGrsfType().toLowerCase();
|
||||||
String productName = record.getClass().equals(StockRecord.class) ? ((StockRecord)record).getStockName() : ((FisheryRecord)record).getFisheryName();
|
String productName = record.getClass().equals(StockRecord.class) ? ((StockRecord)record).getStockName() : ((FisheryRecord)record).getFisheryName();
|
||||||
char firstLetter = productName.charAt(0);
|
char firstLetter = productName.charAt(0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue