Compare commits
3 Commits
master
...
task_20728
Author | SHA1 | Date |
---|---|---|
Francesco Mangiacrapa | d7a746a83b | |
Francesco Mangiacrapa | 2c47de15d5 | |
Francesco Mangiacrapa | 0cb2d091d3 |
|
@ -0,0 +1,7 @@
|
||||||
|
<root>
|
||||||
|
<facet id="jst.jaxrs">
|
||||||
|
<node name="libprov">
|
||||||
|
<attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
|
||||||
|
</node>
|
||||||
|
</facet>
|
||||||
|
</root>
|
|
@ -4,4 +4,5 @@
|
||||||
<installed facet="jst.web" version="2.3"/>
|
<installed facet="jst.web" version="2.3"/>
|
||||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||||
<installed facet="java" version="1.7"/>
|
<installed facet="java" version="1.7"/>
|
||||||
|
<installed facet="jst.jaxrs" version="2.0"/>
|
||||||
</faceted-project>
|
</faceted-project>
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v1.5.0-SNAPSHOT] - 2021-02-17
|
||||||
|
|
||||||
|
[#20728] Migrate to catalogue-util-library
|
||||||
|
|
||||||
|
|
||||||
|
## [v1.4.2-SNAPSHOT] - 2021-02-17
|
||||||
|
|
||||||
|
[#19500] Migrate to git/jenkins
|
||||||
|
|
||||||
|
|
||||||
|
## [v1.4.1] - 2020-18-06
|
||||||
|
|
||||||
|
[#19500] Migrate to git/jenkins
|
||||||
|
|
||||||
|
|
||||||
|
## [v1.0.0] - 2017-26-01
|
||||||
|
|
||||||
|
First release
|
19
pom.xml
19
pom.xml
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
<artifactId>grsf-manage-widget</artifactId>
|
<artifactId>grsf-manage-widget</artifactId>
|
||||||
<version>1.4.2-SNAPSHOT</version>
|
<version>1.5.0-SNAPSHOT</version>
|
||||||
<name>gCube GRSF Manage widget</name>
|
<name>gCube GRSF Manage widget</name>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
|
@ -111,12 +111,21 @@
|
||||||
<artifactId>usermanagement-core</artifactId>
|
<artifactId>usermanagement-core</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</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> -->
|
||||||
|
<!-- </dependency> -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.data-catalogue</groupId>
|
<groupId>org.gcube.datacatalogue</groupId>
|
||||||
<artifactId>ckan-util-library</artifactId>
|
<artifactId>catalogue-util-library</artifactId>
|
||||||
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
|
<version>[1.0.0-SNAPSHOT, 2.0.0)</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.core</groupId>
|
<groupId>org.gcube.core</groupId>
|
||||||
<artifactId>common-scope-maps</artifactId>
|
<artifactId>common-scope-maps</artifactId>
|
||||||
|
@ -179,7 +188,7 @@
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>compile</goal>
|
<goal>compile</goal>
|
||||||
<!-- <goal>test</goal> -->
|
<!-- <goal>test</goal> -->
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<inherits name='org.gcube.datacatalogue.common.GRSFCommon' />
|
<inherits name='org.gcube.datacatalogue.common.GRSFCommon' />
|
||||||
|
|
||||||
<!-- Other module inherits -->
|
<!-- Other module inherits -->
|
||||||
<inherits name='org.gcube.datacatalogue.ckanutillibrary.CkanUtilLibrary' />
|
<inherits name='org.gcube.datacatalogue.utillibrary.CkanUtilLibrary' />
|
||||||
|
|
||||||
<!-- Specify the app entry point class. -->
|
<!-- Specify the app entry point class. -->
|
||||||
<entry-point
|
<entry-point
|
||||||
|
|
|
@ -8,12 +8,11 @@ import java.util.UUID;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
|
import org.apache.http.impl.client.HttpClientBuilder;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue;
|
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogueFactory;
|
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.server.utils.CatalogueUtilMethods;
|
|
||||||
import org.gcube.datacatalogue.common.Constants;
|
import org.gcube.datacatalogue.common.Constants;
|
||||||
import org.gcube.datacatalogue.common.enums.Product_Type;
|
import org.gcube.datacatalogue.common.enums.Product_Type;
|
||||||
import org.gcube.datacatalogue.common.enums.Sources;
|
import org.gcube.datacatalogue.common.enums.Sources;
|
||||||
|
@ -27,6 +26,12 @@ import org.gcube.datacatalogue.grsf_manage_widget.shared.SimilarGRSFRecord;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.SourceRecord;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.SourceRecord;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.ex.GRSFRecordAlreadyManagedStatusException;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.ex.GRSFRecordAlreadyManagedStatusException;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.ex.NoGRSFRecordException;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.ex.NoGRSFRecordException;
|
||||||
|
import org.gcube.datacatalogue.utillibrary.server.DataCatalogue;
|
||||||
|
import org.gcube.datacatalogue.utillibrary.server.DataCatalogueFactory;
|
||||||
|
import org.gcube.datacatalogue.utillibrary.server.utils.CatalogueUtilMethods;
|
||||||
|
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
|
||||||
|
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanPair;
|
||||||
|
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanResource;
|
||||||
import org.gcube.vomanagement.usermanagement.RoleManager;
|
import org.gcube.vomanagement.usermanagement.RoleManager;
|
||||||
import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager;
|
import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager;
|
||||||
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||||
|
@ -37,12 +42,6 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
import com.liferay.portal.kernel.log.Log;
|
import com.liferay.portal.kernel.log.Log;
|
||||||
import com.liferay.portal.kernel.log.LogFactoryUtil;
|
import com.liferay.portal.kernel.log.LogFactoryUtil;
|
||||||
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.CloseableHttpClient;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.HttpClientBuilder;
|
|
||||||
import eu.trentorise.opendata.jackan.model.CkanDataset;
|
|
||||||
import eu.trentorise.opendata.jackan.model.CkanPair;
|
|
||||||
import eu.trentorise.opendata.jackan.model.CkanResource;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Endpoint for sending update records information to GRSF KnowledgeBase.
|
* Endpoint for sending update records information to GRSF KnowledgeBase.
|
||||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
@ -190,8 +189,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
String scopePerCurrentUrl = Utils.getScopeFromClientUrl(getThreadLocalRequest());
|
String scopePerCurrentUrl = Utils.getScopeFromClientUrl(getThreadLocalRequest());
|
||||||
DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl);
|
DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl);
|
||||||
String username = Utils.getCurrentUser(getThreadLocalRequest()).getUsername();
|
String username = Utils.getCurrentUser(getThreadLocalRequest()).getUsername();
|
||||||
String apiKey = catalogue.getApiKeyFromUsername(username);
|
CkanDataset record = catalogue.getDataset(productIdentifier,username);
|
||||||
CkanDataset record = catalogue.getDataset(productIdentifier, apiKey);
|
|
||||||
|
|
||||||
// it cannot be enabled in this case ...
|
// it cannot be enabled in this case ...
|
||||||
if(record == null)
|
if(record == null)
|
||||||
|
@ -252,7 +250,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
if(similarGrsfRecordsAsStrings != null && !similarGrsfRecordsAsStrings.isEmpty()){
|
if(similarGrsfRecordsAsStrings != null && !similarGrsfRecordsAsStrings.isEmpty()){
|
||||||
if(!similarGrsfRecordsAsStrings.get(0).equals(Constants.NO_SIMILAR_GRSF_RECORDS)){
|
if(!similarGrsfRecordsAsStrings.get(0).equals(Constants.NO_SIMILAR_GRSF_RECORDS)){
|
||||||
for (String similarGRSFRecord : similarGrsfRecordsAsStrings) {
|
for (String similarGRSFRecord : similarGrsfRecordsAsStrings) {
|
||||||
similarRecords.add(Utils.similarGRSFRecordFromJson(similarGRSFRecord, catalogue, apiKey, httpSession));
|
similarRecords.add(Utils.similarGRSFRecordFromJson(similarGRSFRecord, catalogue, username, httpSession));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,7 +265,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
if(connectedBeanUrls != null && !connectedBeanUrls.isEmpty()){
|
if(connectedBeanUrls != null && !connectedBeanUrls.isEmpty()){
|
||||||
if(!connectedBeanUrls.get(0).equals(Constants.NO_CONNECTED_RECORDS)){
|
if(!connectedBeanUrls.get(0).equals(Constants.NO_CONNECTED_RECORDS)){
|
||||||
for (String connectedBean : connectedBeanUrls) {
|
for (String connectedBean : connectedBeanUrls) {
|
||||||
ConnectedBean builtBean = Utils.connectedBeanRecordFromUrl(connectedBean, catalogue, apiKey, httpSession);
|
ConnectedBean builtBean = Utils.connectedBeanRecordFromUrl(connectedBean, catalogue, username, httpSession);
|
||||||
if(builtBean != null)
|
if(builtBean != null)
|
||||||
connectedBeans.add(builtBean);
|
connectedBeans.add(builtBean);
|
||||||
}
|
}
|
||||||
|
@ -286,7 +284,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
|
|
||||||
if(exploitedResourcesUrls != null && !exploitedResourcesUrls.isEmpty()){
|
if(exploitedResourcesUrls != null && !exploitedResourcesUrls.isEmpty()){
|
||||||
for (String exploited : exploitedResourcesUrls) {
|
for (String exploited : exploitedResourcesUrls) {
|
||||||
ConnectedBean builtBean = Utils.connectedBeanRecordFromUrl(exploited, catalogue, apiKey, httpSession);
|
ConnectedBean builtBean = Utils.connectedBeanRecordFromUrl(exploited, catalogue, username, httpSession);
|
||||||
if(builtBean != null)
|
if(builtBean != null)
|
||||||
suggestedConnectionsByKnowledgeBase.add(builtBean);
|
suggestedConnectionsByKnowledgeBase.add(builtBean);
|
||||||
}
|
}
|
||||||
|
@ -437,7 +435,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
throw new Exception("This operation can no longer be reverted (link expired)!");
|
throw new Exception("This operation can no longer be reverted (link expired)!");
|
||||||
|
|
||||||
DataCatalogue catalogue = getCatalogue(context);
|
DataCatalogue catalogue = getCatalogue(context);
|
||||||
CkanDataset dataset = catalogue.getDataset(uuid, catalogue.getApiKeyFromUsername(username));
|
CkanDataset dataset = catalogue.getDataset(uuid, username);
|
||||||
Map<String, String> extras = dataset.getExtrasAsHashMap();
|
Map<String, String> extras = dataset.getExtrasAsHashMap();
|
||||||
String recordUrl = extras.get(Constants.ITEM_URL_FIELD);
|
String recordUrl = extras.get(Constants.ITEM_URL_FIELD);
|
||||||
String currentStatus = extras.get(Constants.STATUS_OF_THE_GRSF_RECORD_CUSTOM_KEY);
|
String currentStatus = extras.get(Constants.STATUS_OF_THE_GRSF_RECORD_CUSTOM_KEY);
|
||||||
|
@ -546,7 +544,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
String scopePerCurrentUrl = Utils.getScopeFromClientUrl(getThreadLocalRequest());
|
String scopePerCurrentUrl = Utils.getScopeFromClientUrl(getThreadLocalRequest());
|
||||||
DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl);
|
DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl);
|
||||||
String username = Utils.getCurrentUser(getThreadLocalRequest()).getUsername();
|
String username = Utils.getCurrentUser(getThreadLocalRequest()).getUsername();
|
||||||
CkanDataset dataset = catalogue.getDataset(id, catalogue.getApiKeyFromUsername(username));
|
CkanDataset dataset = catalogue.getDataset(id,username);
|
||||||
if(dataset == null)
|
if(dataset == null)
|
||||||
throw new Exception("A GRSF record with id " + id + " doesn't exist");
|
throw new Exception("A GRSF record with id " + id + " doesn't exist");
|
||||||
|
|
||||||
|
@ -575,7 +573,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS
|
||||||
String scopePerCurrentUrl = Utils.getScopeFromClientUrl(getThreadLocalRequest());
|
String scopePerCurrentUrl = Utils.getScopeFromClientUrl(getThreadLocalRequest());
|
||||||
DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl);
|
DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl);
|
||||||
String username = Utils.getCurrentUser(getThreadLocalRequest()).getUsername();
|
String username = Utils.getCurrentUser(getThreadLocalRequest()).getUsername();
|
||||||
CkanDataset dataset = catalogue.getDataset(id, catalogue.getApiKeyFromUsername(username));
|
CkanDataset dataset = catalogue.getDataset(id, username);
|
||||||
|
|
||||||
if(dataset == null)
|
if(dataset == null)
|
||||||
throw new Exception("A record with id " + id + " doesn't exist");
|
throw new Exception("A record with id " + id + " doesn't exist");
|
||||||
|
|
|
@ -6,14 +6,19 @@ import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||||
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue;
|
|
||||||
import org.gcube.datacatalogue.common.Constants;
|
import org.gcube.datacatalogue.common.Constants;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.ConnectedBean;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.ConnectedBean;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.ManageProductBean;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.ManageProductBean;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.SimilarGRSFRecord;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.SimilarGRSFRecord;
|
||||||
|
import org.gcube.datacatalogue.utillibrary.server.DataCatalogue;
|
||||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
|
@ -22,12 +27,6 @@ import org.json.simple.parser.JSONParser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.HttpResponse;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.client.methods.HttpPost;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.entity.StringEntity;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.CloseableHttpClient;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.util.EntityUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exploits the grsf-services-updater service's methods https://app.swaggerhub.com/apis/ymark/grsf-services-updater/1.1.0
|
* Exploits the grsf-services-updater service's methods https://app.swaggerhub.com/apis/ymark/grsf-services-updater/1.1.0
|
||||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
|
|
@ -11,15 +11,25 @@ import java.util.Set;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.apache.http.HttpEntity;
|
||||||
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
|
import org.apache.http.impl.client.HttpClientBuilder;
|
||||||
|
import org.apache.http.impl.client.LaxRedirectStrategy;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
|
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.resources.gcore.GCoreEndpoint;
|
import org.gcube.common.resources.gcore.GCoreEndpoint;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue;
|
|
||||||
import org.gcube.datacatalogue.common.Constants;
|
import org.gcube.datacatalogue.common.Constants;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.HashTagsOnUpdate;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.HashTagsOnUpdate;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.ManageProductBean;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.ManageProductBean;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.RevertableOperationInfo;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.RevertableOperationInfo;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.RevertableOperations;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.RevertableOperations;
|
||||||
|
import org.gcube.datacatalogue.utillibrary.server.DataCatalogue;
|
||||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||||
import org.gcube.vomanagement.usermanagement.RoleManager;
|
import org.gcube.vomanagement.usermanagement.RoleManager;
|
||||||
|
@ -31,18 +41,6 @@ import org.json.simple.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.HttpEntity;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.HttpResponse;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.client.methods.CloseableHttpResponse;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.client.methods.HttpPost;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.entity.StringEntity;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.CloseableHttpClient;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.HttpClientBuilder;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.LaxRedirectStrategy;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.util.EntityUtils;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For managing the different interactions with social channels (posts and mails)
|
* For managing the different interactions with social channels (posts and mails)
|
||||||
|
|
|
@ -16,13 +16,12 @@ import javax.servlet.http.HttpSession;
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
|
||||||
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
|
import org.apache.http.impl.client.HttpClientBuilder;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.common.resources.gcore.utils.XPathHelper;
|
import org.gcube.common.resources.gcore.utils.XPathHelper;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.server.ApplicationProfileScopePerUrlReader;
|
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue;
|
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogueRunningCluster;
|
|
||||||
import org.gcube.datacatalogue.common.Constants;
|
import org.gcube.datacatalogue.common.Constants;
|
||||||
import org.gcube.datacatalogue.common.enums.Product_Type;
|
import org.gcube.datacatalogue.common.enums.Product_Type;
|
||||||
import org.gcube.datacatalogue.common.enums.Status;
|
import org.gcube.datacatalogue.common.enums.Status;
|
||||||
|
@ -30,6 +29,11 @@ import org.gcube.datacatalogue.grsf_manage_widget.shared.ConnectedBean;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.ManageProductBean;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.ManageProductBean;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.RevertableOperationInfo;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.RevertableOperationInfo;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.SimilarGRSFRecord;
|
import org.gcube.datacatalogue.grsf_manage_widget.shared.SimilarGRSFRecord;
|
||||||
|
import org.gcube.datacatalogue.utillibrary.server.ApplicationProfileScopePerUrlReader;
|
||||||
|
import org.gcube.datacatalogue.utillibrary.server.DataCatalogue;
|
||||||
|
import org.gcube.datacatalogue.utillibrary.server.DataCatalogueRunningCluster;
|
||||||
|
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanDataset;
|
||||||
|
import org.gcube.datacatalogue.utillibrary.shared.jackan.model.CkanPair;
|
||||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
import org.gcube.resources.discovery.client.queries.api.Query;
|
import org.gcube.resources.discovery.client.queries.api.Query;
|
||||||
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
|
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
|
||||||
|
@ -45,11 +49,6 @@ import org.xml.sax.InputSource;
|
||||||
|
|
||||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||||
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.CloseableHttpClient;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.HttpClientBuilder;
|
|
||||||
import eu.trentorise.opendata.jackan.model.CkanDataset;
|
|
||||||
import eu.trentorise.opendata.jackan.model.CkanPair;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility methods for GRSF Management panel widget.
|
* Utility methods for GRSF Management panel widget.
|
||||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
@ -397,13 +396,15 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exploits the fact that in GRSF the url of a record contains the name (which is unique) of the record itself
|
* Exploits the fact that in GRSF the url of a record contains the name (which is unique) of the record itself.
|
||||||
* @param url
|
*
|
||||||
* @param clg
|
* @param url the url
|
||||||
* @return
|
* @param clg the clg
|
||||||
* @throws Exception
|
* @param username the username
|
||||||
|
* @return the dataset from url
|
||||||
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public static CkanDataset getDatasetFromUrl(String url, DataCatalogue clg, String apiKey) throws Exception{
|
public static CkanDataset getDatasetFromUrl(String url, DataCatalogue clg, String username) throws Exception{
|
||||||
|
|
||||||
if(url == null || url.isEmpty())
|
if(url == null || url.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
|
@ -417,7 +418,7 @@ public class Utils {
|
||||||
if (m.find()) {
|
if (m.find()) {
|
||||||
String uuidFound = m.group();
|
String uuidFound = m.group();
|
||||||
logger.debug("Found match for uuid " + uuidFound);
|
logger.debug("Found match for uuid " + uuidFound);
|
||||||
return clg.getDataset(uuidFound, apiKey);
|
return clg.getDataset(uuidFound, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception("No record exists with such url " + url);
|
throw new Exception("No record exists with such url " + url);
|
||||||
|
@ -456,7 +457,7 @@ public class Utils {
|
||||||
* @return {@link SimilarGRSFRecord}
|
* @return {@link SimilarGRSFRecord}
|
||||||
* @throws ParseException
|
* @throws ParseException
|
||||||
*/
|
*/
|
||||||
public static SimilarGRSFRecord similarGRSFRecordFromJson(String json, DataCatalogue ctl, String apiKey, HttpSession httpSession) throws ParseException{
|
public static SimilarGRSFRecord similarGRSFRecordFromJson(String json, DataCatalogue ctl, String username, HttpSession httpSession) throws ParseException{
|
||||||
|
|
||||||
if(json == null)
|
if(json == null)
|
||||||
return null;
|
return null;
|
||||||
|
@ -465,7 +466,7 @@ public class Utils {
|
||||||
JSONObject object = (JSONObject)parser.parse(json);
|
JSONObject object = (JSONObject)parser.parse(json);
|
||||||
|
|
||||||
String uuid = getDatasetKnowledgeBaseIdFromUrl((String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_URL));
|
String uuid = getDatasetKnowledgeBaseIdFromUrl((String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_URL));
|
||||||
CkanDataset dataset = ctl.getDataset(uuid, apiKey);
|
CkanDataset dataset = ctl.getDataset(uuid,username);
|
||||||
|
|
||||||
boolean isStock = dataset.getExtrasAsHashMap().get(Constants.DOMAIN_CUSTOM_KEY).contains(Product_Type.STOCK.getOrigName());
|
boolean isStock = dataset.getExtrasAsHashMap().get(Constants.DOMAIN_CUSTOM_KEY).contains(Product_Type.STOCK.getOrigName());
|
||||||
Map<String, String> fieldsNamespacesMap =
|
Map<String, String> fieldsNamespacesMap =
|
||||||
|
@ -501,19 +502,19 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Connected bean from record
|
* Get Connected bean from record.
|
||||||
* @param httpSession
|
*
|
||||||
* @param json
|
* @param destUrl the dest url
|
||||||
* @param sourceIdentifier
|
* @param clg the clg
|
||||||
* @param sourceDomain
|
* @param username the username
|
||||||
* @param grsfDomain
|
* @param httpSession the http session
|
||||||
* @return
|
* @return the connected bean
|
||||||
* @throws ParseException
|
* @throws ParseException the parse exception
|
||||||
*/
|
*/
|
||||||
public static ConnectedBean connectedBeanRecordFromUrl(
|
public static ConnectedBean connectedBeanRecordFromUrl(
|
||||||
String destUrl,
|
String destUrl,
|
||||||
DataCatalogue clg,
|
DataCatalogue clg,
|
||||||
String apiKey,
|
String username,
|
||||||
HttpSession httpSession
|
HttpSession httpSession
|
||||||
) throws ParseException {
|
) throws ParseException {
|
||||||
|
|
||||||
|
@ -521,7 +522,7 @@ public class Utils {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
String connectedBeanUuid = getDatasetKnowledgeBaseIdFromUrl(destUrl);
|
String connectedBeanUuid = getDatasetKnowledgeBaseIdFromUrl(destUrl);
|
||||||
CkanDataset destDataset = clg.getDataset(connectedBeanUuid, apiKey);
|
CkanDataset destDataset = clg.getDataset(connectedBeanUuid,username);
|
||||||
boolean isStock = destDataset.getExtrasAsHashMap().get(Constants.DOMAIN_CUSTOM_KEY).contains(Product_Type.STOCK.getOrigName());
|
boolean isStock = destDataset.getExtrasAsHashMap().get(Constants.DOMAIN_CUSTOM_KEY).contains(Product_Type.STOCK.getOrigName());
|
||||||
Map<String, String> fieldsNamespacesMap =
|
Map<String, String> fieldsNamespacesMap =
|
||||||
Utils.getFieldToFieldNameSpaceMapping(httpSession, isStock ?
|
Utils.getFieldToFieldNameSpaceMapping(httpSession, isStock ?
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<inherits name='org.gcube.datacatalogue.common.GRSFCommon' />
|
<inherits name='org.gcube.datacatalogue.common.GRSFCommon' />
|
||||||
|
|
||||||
<!-- Other module inherits -->
|
<!-- Other module inherits -->
|
||||||
<inherits name='org.gcube.datacatalogue.ckanutillibrary.CkanUtilLibrary' />
|
<inherits name='org.gcube.datacatalogue.utillibrary.CkanUtilLibrary' />
|
||||||
|
|
||||||
<!-- Specify the app entry point class. -->
|
<!-- Specify the app entry point class. -->
|
||||||
<entry-point
|
<entry-point
|
||||||
|
|
|
@ -6,13 +6,19 @@ import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
|
import org.apache.http.impl.client.HttpClientBuilder;
|
||||||
|
import org.apache.http.impl.client.LaxRedirectStrategy;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.resources.gcore.GCoreEndpoint;
|
import org.gcube.common.resources.gcore.GCoreEndpoint;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue;
|
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogueFactory;
|
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.server.manage.GRSFNotificationService;
|
import org.gcube.datacatalogue.grsf_manage_widget.server.manage.GRSFNotificationService;
|
||||||
import org.gcube.datacatalogue.grsf_manage_widget.server.manage.SocialCommunications;
|
import org.gcube.datacatalogue.grsf_manage_widget.server.manage.SocialCommunications;
|
||||||
|
import org.gcube.datacatalogue.utillibrary.server.DataCatalogue;
|
||||||
|
import org.gcube.datacatalogue.utillibrary.server.DataCatalogueFactory;
|
||||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
|
@ -20,18 +26,11 @@ import org.json.simple.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.client.methods.CloseableHttpResponse;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.client.methods.HttpPost;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.entity.StringEntity;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.CloseableHttpClient;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.HttpClientBuilder;
|
|
||||||
import eu.trentorise.opendata.jackan.internal.org.apache.http.impl.client.LaxRedirectStrategy;
|
|
||||||
|
|
||||||
public class SendNotification {
|
public class SendNotification {
|
||||||
|
|
||||||
private static String context = "/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab";
|
private static String context = "/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab";
|
||||||
|
|
||||||
private static String token = "57b42a99-6239-44c4-9a68-591c18363222-843339462"; ///d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab
|
private static String token = ""; ///d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab
|
||||||
|
|
||||||
//private static String token = "8e74a17c-92f1-405a-b591-3a6090066248-98187548"; //devVRE
|
//private static String token = "8e74a17c-92f1-405a-b591-3a6090066248-98187548"; //devVRE
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue