fixed operations after creation

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@158046 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-10-31 11:31:52 +00:00
parent 4d9c4888b2
commit 16165bb74d
6 changed files with 25 additions and 12 deletions

View File

@ -3,7 +3,7 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<dependent-module archiveName="grsf-common-library-1-0-0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/grsf-common-library/grsf-common-library">
<dependent-module archiveName="grsf-common-library-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/grsf-common-library/grsf-common-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="grsf-publisher-ws"/>

View File

@ -51,7 +51,7 @@
<dependency>
<groupId>org.gcube.data-catalogue</groupId>
<artifactId>grsf-common-library</artifactId>
<version>1-0-0-SNAPSHOT</version>
<version>[1-0-0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
<dependency>

View File

@ -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");

View File

@ -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{

View File

@ -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<String, String> namespaces, final Set<String> 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<String, List<String>> addField = new HashMap<String, List<String>>();
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<String>(),
authorFullname).start();
logger.info("Thread to write a post about the new product has been launched");

View File

@ -67,7 +67,6 @@ public class CSVUtils {
isUnitPresent = true;
if(timeSeriesBean.isDataOwnerPresent())
isDataOwnerPresent = true;
if(isSourcePresent & isAssessmentPresent & isValuePresent & isUnitPresent & isDataOwnerPresent)
break;
}