From b57e6c6f6d2feee1585f26c551088e505dc2a080 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Thu, 21 Sep 2017 12:06:30 +0000 Subject: [PATCH] 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 --- .../json/input/record/Common.java | 26 +++++++++---------- .../utils/CommonServiceUtils.java | 8 +++--- .../utils/threads/ManageTimeSeriesThread.java | 5 ++-- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/input/record/Common.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/input/record/Common.java index 1b54741..08676c9 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/input/record/Common.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/input/record/Common.java @@ -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.SimilarRecordBean; 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.Status; @@ -26,7 +27,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; @JsonIgnoreProperties(value = {"grsf_type", "source"}) 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"; // it is added in case of GRSF record @@ -63,9 +63,8 @@ public class Common extends Base{ private Status status; // automatically compiled - @JsonProperty("grsf_domain") - @CustomField(key=GRSF_DOMAIN_KEY) - private String grsfType; + @CustomField(key=CommonServiceUtils.SYSTEM_TYPE) + private String systemType; @JsonProperty("catches") @CustomField(key="Catches") @@ -114,7 +113,7 @@ public class Common extends Base{ List> databaseSources, List> sourceOfInformation, List refersTo, String shortName, - Boolean traceabilityFlag, Status status, String grsfType, + Boolean traceabilityFlag, Status status, String systemType, List> catches, List> landings, List species, List similarGRSFRecords, @@ -127,7 +126,7 @@ public class Common extends Base{ this.shortName = shortName; this.traceabilityFlag = traceabilityFlag; this.status = status; - this.grsfType = grsfType; + this.systemType = systemType; this.catches = catches; this.landings = landings; this.species = species; @@ -135,12 +134,12 @@ public class Common extends Base{ this.similarSourceRecords = similarSourceRecords; } - public String getGrsfType() { - return grsfType; + public String getSystemType() { + return systemType; } - public void setGrsfType(String grsfType) { - this.grsfType = grsfType; + public void setSystemType(String systemType) { + this.systemType = systemType; } public Boolean getTraceabilityFlag() { @@ -248,10 +247,11 @@ public class Common extends Base{ + databaseSources + ", sourceOfInformation=" + sourceOfInformation + ", refersTo=" + refersTo + ", shortName=" + shortName + ", traceabilityFlag=" - + traceabilityFlag + ", status=" + status + ", grsfType=" - + grsfType + ", catches=" + catches + ", landings=" + landings - + ", species=" + species + ", similarGRSFRecords=" + + traceabilityFlag + ", status=" + status + ", systemType=" + + systemType + ", catches=" + catches + ", landings=" + + landings + ", species=" + species + ", similarGRSFRecords=" + similarGRSFRecords + ", similarSourceRecords=" + similarSourceRecords + "]"; } + } \ No newline at end of file diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/CommonServiceUtils.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/CommonServiceUtils.java index 7058e2a..556e9e6 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/CommonServiceUtils.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/CommonServiceUtils.java @@ -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 groups.add(sourceInPath.getOrigName().toLowerCase() + "-" + productType.getOrigName().toLowerCase()); //e.g. grsf-fishery boolean skipTags = !sourceInPath.equals(Sources.GRSF); // no tags for the Original records 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)); } /** diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/threads/ManageTimeSeriesThread.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/threads/ManageTimeSeriesThread.java index 9a0ed84..69248ae 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/threads/ManageTimeSeriesThread.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/threads/ManageTimeSeriesThread.java @@ -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.StockRecord; 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.cache.CacheImpl; 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) // -files (e.g, kbuuid.csv) - String recordTypeFolderName = record.getGrsfType().toLowerCase(); - String productName = record.getClass().equals(StockRecord.class) ? ((StockRecord)record).getStockName() : ((FisheryRecord)record).getFisheryName(); + 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 csvFileName = replaceIllegalChars(productName, " "); csvFileName = generateCSVFileName(csvFileName); logger.debug("CSV file name (without custom key) is going to be " + csvFileName);