diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index cd6b5cc..396fdd0 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -3,7 +3,7 @@ - + uses diff --git a/pom.xml b/pom.xml index c1a6b3a..5087ce1 100644 --- a/pom.xml +++ b/pom.xml @@ -51,7 +51,7 @@ org.gcube.data-catalogue grsf-common-library - 1-0-0-SNAPSHOT + [1-0-0-SNAPSHOT, 2.0.0-SNAPSHOT) diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherFisheryService.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherFisheryService.java index 4f30991..4e3374e 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherFisheryService.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherFisheryService.java @@ -516,10 +516,16 @@ public class GrsfPublisherFisheryService { if(id != null){ logger.info("Item updated!"); + + String description = Constants.SHORT_NAME_CUSTOM_KEY + ": " + record.getShortName() + "\n"; + + if(sourceInPath.equals(Sources.GRSF)) + description += ", " + Constants.GRSF_SEMANTIC_IDENTIFIER_CUSTOM_KEY + ": " + record.getFisheryId() + "\n"; + CommonServiceUtils.actionsPostCreateOrUpdate( id, name, record, apiKey, username, organization, itemUrl, responseBean, catalogue, namespaces, groups, context, token, title, authorFullname, - contextServlet, false, null); + contextServlet, true, description); status = Status.OK; }else{ throw new Exception("There was an error during the item updated, sorry"); diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherStockService.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherStockService.java index 9693ef4..7c64de8 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherStockService.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherStockService.java @@ -514,10 +514,15 @@ public class GrsfPublisherStockService { if(id != null){ logger.info("Item updated!"); + + String description = Constants.SHORT_NAME_CUSTOM_KEY + ": " + record.getShortName() + "\n"; + + if(sourceInPath.equals(Sources.GRSF)) + description += ", " + Constants.GRSF_SEMANTIC_IDENTIFIER_CUSTOM_KEY + ": " + record.getStockId() + "\n"; CommonServiceUtils.actionsPostCreateOrUpdate( recordPublished.getId(), name, record, apiKey, username, organization, itemUrl, responseBean, catalogue, namespaces, groups, context, token, - title, authorFullname, contextServlet, true, null); + title, authorFullname, contextServlet, true, description); status = Status.OK; }else{ 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 f2c18ec..a8f27c0 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 @@ -507,20 +507,23 @@ public class CommonServiceUtils { final String datasetId, final String futureName, final Common record, final String apiKey, final String username, final String organization, String itemUrl, ResponseCreationBean responseBean, final DataCatalogue catalogue, Map namespaces, final Set groups, final String context, - final String token, final String futureTitle, final String authorFullname, final ServletContext contextServlet, final boolean isUpdated, String description) throws InterruptedException { + final String token, final String futureTitle, final String authorFullname, final ServletContext contextServlet, final boolean isUpdated, + String description) throws InterruptedException { - // on create, we need to add the item url and set the description + // on create, we need to add the item url... the description can be set on create and update instead if(!isUpdated){ itemUrl = catalogue.getUnencryptedUrlFromDatasetIdOrName(futureName); Map> addField = new HashMap>(); String modifiedUUIDKey = namespaces.containsKey(Constants.ITEM_URL_FIELD) ? namespaces.get(Constants.ITEM_URL_FIELD) : Constants.ITEM_URL_FIELD; addField.put(modifiedUUIDKey, Arrays.asList(itemUrl)); catalogue.patchProductCustomFields(datasetId, apiKey, addField); - description += ", Record URL: " + itemUrl; - JSONObject obj = new JSONObject(); - obj.put("notes", description); - catalogue.patchProductWithJSON(datasetId, obj, apiKey); } + + // update description anyway + description += ", Record URL: " + itemUrl; + JSONObject obj = new JSONObject(); + obj.put("notes", description); + catalogue.patchProductWithJSON(datasetId, obj, apiKey); // set info in the response bean responseBean.setId(datasetId); @@ -553,7 +556,7 @@ public class CommonServiceUtils { token, futureTitle, itemUrlForThread, - false, + true, new ArrayList(), authorFullname).start(); logger.info("Thread to write a post about the new product has been launched"); 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 cc26298..8c60c1b 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 @@ -67,7 +67,6 @@ public class CSVUtils { isUnitPresent = true; if(timeSeriesBean.isDataOwnerPresent()) isDataOwnerPresent = true; - if(isSourcePresent & isAssessmentPresent & isValuePresent & isUnitPresent & isDataOwnerPresent) break; }