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:
parent
4d9c4888b2
commit
16165bb74d
|
@ -3,7 +3,7 @@
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<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="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<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>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
<property name="context-root" value="grsf-publisher-ws"/>
|
<property name="context-root" value="grsf-publisher-ws"/>
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -51,7 +51,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.data-catalogue</groupId>
|
<groupId>org.gcube.data-catalogue</groupId>
|
||||||
<artifactId>grsf-common-library</artifactId>
|
<artifactId>grsf-common-library</artifactId>
|
||||||
<version>1-0-0-SNAPSHOT</version>
|
<version>[1-0-0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
|
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -516,10 +516,16 @@ public class GrsfPublisherFisheryService {
|
||||||
|
|
||||||
if(id != null){
|
if(id != null){
|
||||||
logger.info("Item updated!");
|
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(
|
CommonServiceUtils.actionsPostCreateOrUpdate(
|
||||||
id, name, record, apiKey, username, organization,
|
id, name, record, apiKey, username, organization,
|
||||||
itemUrl, responseBean, catalogue, namespaces, groups, context, token, title, authorFullname,
|
itemUrl, responseBean, catalogue, namespaces, groups, context, token, title, authorFullname,
|
||||||
contextServlet, false, null);
|
contextServlet, true, description);
|
||||||
status = Status.OK;
|
status = Status.OK;
|
||||||
}else{
|
}else{
|
||||||
throw new Exception("There was an error during the item updated, sorry");
|
throw new Exception("There was an error during the item updated, sorry");
|
||||||
|
|
|
@ -514,10 +514,15 @@ public class GrsfPublisherStockService {
|
||||||
if(id != null){
|
if(id != null){
|
||||||
|
|
||||||
logger.info("Item updated!");
|
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(
|
CommonServiceUtils.actionsPostCreateOrUpdate(
|
||||||
recordPublished.getId(), name, record, apiKey, username, organization, itemUrl,
|
recordPublished.getId(), name, record, apiKey, username, organization, itemUrl,
|
||||||
responseBean, catalogue, namespaces, groups, context, token,
|
responseBean, catalogue, namespaces, groups, context, token,
|
||||||
title, authorFullname, contextServlet, true, null);
|
title, authorFullname, contextServlet, true, description);
|
||||||
status = Status.OK;
|
status = Status.OK;
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -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,
|
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,
|
ResponseCreationBean responseBean, final DataCatalogue catalogue,
|
||||||
Map<String, String> namespaces, final Set<String> groups, final String context,
|
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){
|
if(!isUpdated){
|
||||||
itemUrl = catalogue.getUnencryptedUrlFromDatasetIdOrName(futureName);
|
itemUrl = catalogue.getUnencryptedUrlFromDatasetIdOrName(futureName);
|
||||||
Map<String, List<String>> addField = new HashMap<String, List<String>>();
|
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;
|
String modifiedUUIDKey = namespaces.containsKey(Constants.ITEM_URL_FIELD) ? namespaces.get(Constants.ITEM_URL_FIELD) : Constants.ITEM_URL_FIELD;
|
||||||
addField.put(modifiedUUIDKey, Arrays.asList(itemUrl));
|
addField.put(modifiedUUIDKey, Arrays.asList(itemUrl));
|
||||||
catalogue.patchProductCustomFields(datasetId, apiKey, addField);
|
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
|
// set info in the response bean
|
||||||
responseBean.setId(datasetId);
|
responseBean.setId(datasetId);
|
||||||
|
@ -553,7 +556,7 @@ public class CommonServiceUtils {
|
||||||
token,
|
token,
|
||||||
futureTitle,
|
futureTitle,
|
||||||
itemUrlForThread,
|
itemUrlForThread,
|
||||||
false,
|
true,
|
||||||
new ArrayList<String>(),
|
new ArrayList<String>(),
|
||||||
authorFullname).start();
|
authorFullname).start();
|
||||||
logger.info("Thread to write a post about the new product has been launched");
|
logger.info("Thread to write a post about the new product has been launched");
|
||||||
|
|
|
@ -67,7 +67,6 @@ public class CSVUtils {
|
||||||
isUnitPresent = true;
|
isUnitPresent = true;
|
||||||
if(timeSeriesBean.isDataOwnerPresent())
|
if(timeSeriesBean.isDataOwnerPresent())
|
||||||
isDataOwnerPresent = true;
|
isDataOwnerPresent = true;
|
||||||
|
|
||||||
if(isSourcePresent & isAssessmentPresent & isValuePresent & isUnitPresent & isDataOwnerPresent)
|
if(isSourcePresent & isAssessmentPresent & isValuePresent & isUnitPresent & isDataOwnerPresent)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue