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.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<Resource<Sources>> databaseSources,
List<Resource<String>> sourceOfInformation,
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>> landings,
List<String> species, List<SimilarRecordBean> 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 + "]";
}
}

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
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));
}
/**

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.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);