removed grsf_domain, since now system:type reports the same information

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@154369 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-09-21 12:06:30 +00:00
parent 51cee64f82
commit b57e6c6f6d
3 changed files with 19 additions and 20 deletions

View File

@ -13,6 +13,7 @@ import org.gcube.data_catalogue.grsf_publish_ws.json.input.utils.RefersToBean;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.utils.Resource; import org.gcube.data_catalogue.grsf_publish_ws.json.input.utils.Resource;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.utils.SimilarRecordBean; import org.gcube.data_catalogue.grsf_publish_ws.json.input.utils.SimilarRecordBean;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.utils.TimeSeriesBean; import org.gcube.data_catalogue.grsf_publish_ws.json.input.utils.TimeSeriesBean;
import org.gcube.data_catalogue.grsf_publish_ws.utils.CommonServiceUtils;
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;
@ -26,7 +27,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
@JsonIgnoreProperties(value = {"grsf_type", "source"}) @JsonIgnoreProperties(value = {"grsf_type", "source"})
public class Common extends Base{ public class Common extends Base{
public static final String GRSF_DOMAIN_KEY = "GRSF Domain"; // stock, fishery
public static final String GRSF_DATABASE_SOURCE = "Database Source"; public static final String GRSF_DATABASE_SOURCE = "Database Source";
// it is added in case of GRSF record // it is added in case of GRSF record
@ -63,9 +63,8 @@ public class Common extends Base{
private Status status; private Status status;
// automatically compiled // automatically compiled
@JsonProperty("grsf_domain") @CustomField(key=CommonServiceUtils.SYSTEM_TYPE)
@CustomField(key=GRSF_DOMAIN_KEY) private String systemType;
private String grsfType;
@JsonProperty("catches") @JsonProperty("catches")
@CustomField(key="Catches") @CustomField(key="Catches")
@ -114,7 +113,7 @@ public class Common extends Base{
List<Resource<Sources>> databaseSources, List<Resource<Sources>> databaseSources,
List<Resource<String>> sourceOfInformation, List<Resource<String>> sourceOfInformation,
List<RefersToBean> refersTo, String shortName, List<RefersToBean> refersTo, String shortName,
Boolean traceabilityFlag, Status status, String grsfType, Boolean traceabilityFlag, Status status, String systemType,
List<TimeSeriesBean<String, String>> catches, List<TimeSeriesBean<String, String>> catches,
List<TimeSeriesBean<String, String>> landings, List<TimeSeriesBean<String, String>> landings,
List<String> species, List<SimilarRecordBean> similarGRSFRecords, List<String> species, List<SimilarRecordBean> similarGRSFRecords,
@ -127,7 +126,7 @@ public class Common extends Base{
this.shortName = shortName; this.shortName = shortName;
this.traceabilityFlag = traceabilityFlag; this.traceabilityFlag = traceabilityFlag;
this.status = status; this.status = status;
this.grsfType = grsfType; this.systemType = systemType;
this.catches = catches; this.catches = catches;
this.landings = landings; this.landings = landings;
this.species = species; this.species = species;
@ -135,12 +134,12 @@ public class Common extends Base{
this.similarSourceRecords = similarSourceRecords; this.similarSourceRecords = similarSourceRecords;
} }
public String getGrsfType() { public String getSystemType() {
return grsfType; return systemType;
} }
public void setGrsfType(String grsfType) { public void setSystemType(String systemType) {
this.grsfType = grsfType; this.systemType = systemType;
} }
public Boolean getTraceabilityFlag() { public Boolean getTraceabilityFlag() {
@ -248,10 +247,11 @@ public class Common extends Base{
+ databaseSources + ", sourceOfInformation=" + databaseSources + ", sourceOfInformation="
+ sourceOfInformation + ", refersTo=" + refersTo + sourceOfInformation + ", refersTo=" + refersTo
+ ", shortName=" + shortName + ", traceabilityFlag=" + ", shortName=" + shortName + ", traceabilityFlag="
+ traceabilityFlag + ", status=" + status + ", grsfType=" + traceabilityFlag + ", status=" + status + ", systemType="
+ grsfType + ", catches=" + catches + ", landings=" + landings + systemType + ", catches=" + catches + ", landings="
+ ", species=" + species + ", similarGRSFRecords=" + landings + ", species=" + species + ", similarGRSFRecords="
+ similarGRSFRecords + ", similarSourceRecords=" + similarGRSFRecords + ", similarSourceRecords="
+ similarSourceRecords + "]"; + similarSourceRecords + "]";
} }
} }

View File

@ -444,16 +444,14 @@ public class CommonServiceUtils {
} }
} }
// set the grsf type: fishery or stock
record.setGrsfType(productType.getOrigName());
// evaluate the custom fields/tags, resources and groups // evaluate the custom fields/tags, resources and groups
groups.add(sourceInPath.getOrigName().toLowerCase() + "-" + productType.getOrigName().toLowerCase()); //e.g. grsf-fishery groups.add(sourceInPath.getOrigName().toLowerCase() + "-" + productType.getOrigName().toLowerCase()); //e.g. grsf-fishery
boolean skipTags = !sourceInPath.equals(Sources.GRSF); // no tags for the Original records boolean skipTags = !sourceInPath.equals(Sources.GRSF); // no tags for the Original records
CommonServiceUtils.getTagsGroupsResourcesExtrasByRecord(tags, skipTags, groups, false, resources, false, customFields, record, username, sourceInPath); CommonServiceUtils.getTagsGroupsResourcesExtrasByRecord(tags, skipTags, groups, false, resources, false, customFields, record, username, sourceInPath);
// set the system type type: fishery or stock
record.setSystemType(productType.equals(Product_Type.STOCK)? SYSTEM_TYPE_STOCK : SYSTEM_TYPE_FISHERY);
// add the SYSTEM_TYPE
customFields.put(CommonServiceUtils.SYSTEM_TYPE, productType.equals(Product_Type.STOCK)? Arrays.asList(SYSTEM_TYPE_STOCK) : Arrays.asList(SYSTEM_TYPE_FISHERY));
} }
/** /**

View File

@ -26,6 +26,7 @@ import org.gcube.data_catalogue.grsf_publish_ws.json.input.record.Common;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.record.FisheryRecord; import org.gcube.data_catalogue.grsf_publish_ws.json.input.record.FisheryRecord;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.record.StockRecord; import org.gcube.data_catalogue.grsf_publish_ws.json.input.record.StockRecord;
import org.gcube.data_catalogue.grsf_publish_ws.utils.CSVUtils; import org.gcube.data_catalogue.grsf_publish_ws.utils.CSVUtils;
import org.gcube.data_catalogue.grsf_publish_ws.utils.CommonServiceUtils;
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.cache.CacheImpl; import org.gcube.data_catalogue.grsf_publish_ws.utils.cache.CacheImpl;
import org.gcube.data_catalogue.grsf_publish_ws.utils.cache.CacheInterface; import org.gcube.data_catalogue.grsf_publish_ws.utils.cache.CacheInterface;
@ -156,8 +157,8 @@ public class ManageTimeSeriesThread extends Thread{
// - type of files (e.g., csv) // - type of files (e.g., csv)
// -files (e.g, kbuuid.csv) // -files (e.g, kbuuid.csv)
String recordTypeFolderName = record.getGrsfType().toLowerCase(); String recordTypeFolderName = record.getSystemType().equals(CommonServiceUtils.SYSTEM_TYPE_STOCK)? "stock" :"fishery";
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();
String csvFileName = replaceIllegalChars(productName, " "); String csvFileName = replaceIllegalChars(productName, " ");
csvFileName = generateCSVFileName(csvFileName); csvFileName = generateCSVFileName(csvFileName);
logger.debug("CSV file name (without custom key) is going to be " + csvFileName); logger.debug("CSV file name (without custom key) is going to be " + csvFileName);