From 7ea50148707eae96718ac47d79cda747136ba124 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Sat, 10 Dec 2016 10:58:41 +0000 Subject: [PATCH] Product url custom field is automatically added after publication of the product itself git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@139881 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../server/CKANPublisherServicesImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java index 7ebd0c1..4289607 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java @@ -3,6 +3,7 @@ package org.gcube.portlets.widgets.ckandatapublisherwidget.server; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -49,6 +50,8 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C // Logger private static final org.slf4j.Logger logger = LoggerFactory.getLogger(CKANPublisherServicesImpl.class); + private static final String PRODUCT_URL_FIELD = "Product URL"; + // map private ConcurrentHashMap mapOrganizationScope = new ConcurrentHashMap(); @@ -279,6 +282,11 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C // retrieve the url String datasetUrl = utils.getUrlFromDatasetIdOrName(datasetId); toCreate.setSource(datasetUrl); + + // add also this information as custom field + Map> addField = new HashMap>(); + addField.put(PRODUCT_URL_FIELD, Arrays.asList(datasetUrl)); + utils.patchProductCustomFields(datasetId, userApiKey, addField); // start a thread that will associate this dataset with the group if(toCreate.getChosenProfile() != null || toCreate.getGroups() != null){