migrated the method 'createGroup'

This commit is contained in:
Francesco Mangiacrapa 2020-08-27 17:42:08 +02:00
parent d235b81231
commit 7442e8a671
2 changed files with 52 additions and 14 deletions

33
pom.xml
View File

@ -13,7 +13,7 @@
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>ckan-metadata-publisher-widget</artifactId>
<version>1.6.1</version>
<version>2.0.0-SNAPSHOT</version>
<name>gCube Ckan metadata publisher widget</name>
<description>
@ -145,18 +145,29 @@
<version>[2.0.0,)</version>
<scope>provided</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.gcube.data-catalogue</groupId> -->
<!-- <artifactId>ckan-util-library</artifactId> -->
<!-- <version>[2.0.0, 3.0.0-SNAPSHOT)</version> -->
<!-- <scope>compile</scope> -->
<!-- <exclusions> -->
<!-- <exclusion> -->
<!-- <groupId>org.gcube.data-catalogue</groupId> -->
<!-- <artifactId>gcubedatacatalogue-metadata-discovery</artifactId> -->
<!-- </exclusion> -->
<!-- </exclusions> -->
<!-- </dependency> -->
<dependency>
<groupId>org.gcube.data-catalogue</groupId>
<artifactId>ckan-util-library</artifactId>
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.gcube.data-catalogue</groupId>
<artifactId>gcubedatacatalogue-metadata-discovery</artifactId>
</exclusion>
</exclusions>
<groupId>org.gcube.datacatalogue</groupId>
<artifactId>catalogue-util-library</artifactId>
<version>0.1.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>/home/francesco/git/catalogue-util-library/target/catalogue-util-library-0.1.0-SNAPSHOT.jar</systemPath>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>

View File

@ -48,9 +48,9 @@ import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
import eu.trentorise.opendata.jackan.model.CkanGroup;
import eu.trentorise.opendata.jackan.model.CkanLicense;
/**
* Server side of the data publisher.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
@ -328,12 +328,33 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
logger.debug("The user wants to publish in organization with name " + organizationNameOrId);
String scope = getScopeFromOrgName(organizationNameOrId);
DataCatalogue utils = getCatalogue(scope);
String userApiKey = utils.getApiKeyFromUsername(userName);
String datasetId = utils.createCKanDatasetMultipleCustomFields(userName,
title,
null,
organizationNameOrId,
author,
authorMail,
maintainer,
maintainerMail,
version,
description,
licenseId,
listOfTags,
customFields,
resources,
setPublic,
true);
/**
* OLD CODE
String userApiKey = utils.getApiKeyFromUsername(userName);
String datasetId = utils.createCKanDatasetMultipleCustomFields
(userApiKey, title, null, organizationNameOrId, author, authorMail, maintainer,
maintainerMail, version, description, licenseId, listOfTags, customFields, resources, setPublic);
*/
if(datasetId != null){
logger.info("Dataset created!");
@ -344,9 +365,15 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
toCreate.setSource(datasetUrl);
// add also this information as custom field
/**
* TODO NEEDED TO BE CHECK
*
* OLD CODE NOT NEEDED. NOW IT IS PERFORMED BY gCAT
Map<String, List<String>> addField = new HashMap<String, List<String>>();
addField.put(ITEM_URL_FIELD, Arrays.asList(datasetUrl));
utils.patchProductCustomFields(datasetId, userApiKey, addField, false);
*/
// start a thread that will associate this dataset with the group
if(/*toCreate.getChosenType() != null ||*/ toCreate.getGroups() != null){