diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 6caf699..396fdd0 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -3,6 +3,9 @@ + + uses + 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 c19e61c..a03fc0b 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 @@ -433,20 +433,22 @@ public class CommonServiceUtils { CommonServiceUtils.validateAggregatedRecord(record); } } + + // set the domain + record.setDomain(productType.getOrigName()); + + // set system type (it is equal to the GRSF Type for GRSF records, "Legacy" for source records) + record.setSystemType(sourceInPath.equals(Sources.GRSF) ? + productType.equals(Product_Type.FISHERY) ? ((FisheryRecord)record).getType().getOrigName() : ((StockRecord)record).getType().getOrigName() + : Constants.SYSTEM_TYPE_FOR_SOURCES_VALUE); + + logger.debug("Domain is " + productType.getOrigName() + " and system type " + record.getSystemType()); // 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 domain - record.setDomain(productType.getOrigName()); - - // set system type (it is equal to the GRSF Type for GRSF records, "Source" for source records) - record.setSystemType(sourceInPath.equals(Sources.GRSF) ? - productType.equals(Product_Type.FISHERY) ? ((FisheryRecord)record).getType().getOrigName() : ((StockRecord)record).getType().getOrigName() - : Constants.SYSTEM_TYPE_FOR_SOURCES_VALUE); - } /** diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/csv/CSVUtils.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/csv/CSVUtils.java index 2a4913b..75017d5 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/csv/CSVUtils.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/csv/CSVUtils.java @@ -145,17 +145,21 @@ public class CSVUtils { bw.close(); // Add names of the sources to the file's name - for (String source : sources) { - relevantSources[0] += source + "_"; + if(sources.isEmpty()){ + relevantSources[0] = ""; + }else{ + for (String source : sources) { + relevantSources[0] += source + "_"; + } + relevantSources[0] = relevantSources[0].substring(0, relevantSources[0].length() - 1); } - relevantSources[0] = relevantSources[0].substring(0, relevantSources[0].length() - 1); // on exit delete it... file.deleteOnExit(); - + // file created logger.debug("CSV file created correctly on this machine!"); - + return file; } catch(Exception e){