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
This commit is contained in:
Costantino Perciante 2016-12-10 10:58:41 +00:00
parent 1431fe1e2f
commit 7ea5014870
1 changed files with 8 additions and 0 deletions

View File

@ -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 <orgName, scope>
private ConcurrentHashMap<String, String> mapOrganizationScope = new ConcurrentHashMap<String, String>();
@ -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<String, List<String>> addField = new HashMap<String, List<String>>();
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){