Migrating code
This commit is contained in:
parent
bd554272bd
commit
f5f04417af
|
@ -6,11 +6,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
## [v3.0.0-SNAPSHOT]
|
## [v3.0.0-SNAPSHOT]
|
||||||
|
|
||||||
- Service migrated to Smartgears 4
|
- Service migrated to Smartgears 4
|
||||||
|
|
||||||
|
|
||||||
## [v2.4.2-SNAPSHOT]
|
|
||||||
|
|
||||||
- Switched form commons-lang3 to commons-lang to avoid duplicates
|
- Switched form commons-lang3 to commons-lang to avoid duplicates
|
||||||
|
- Set resource-registry-publisher dependency scope to provided
|
||||||
|
|
||||||
|
|
||||||
## [v2.4.1]
|
## [v2.4.1]
|
||||||
|
|
3
pom.xml
3
pom.xml
|
@ -70,7 +70,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.data-catalogue</groupId>
|
<groupId>org.gcube.data-catalogue</groupId>
|
||||||
<artifactId>gcat-api</artifactId>
|
<artifactId>gcat-api</artifactId>
|
||||||
<version>[3.0.0-SNAPSHOT,4.0.0-SNAPSHOT)</version>
|
<version>[2.0.0,3.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.social-networking</groupId>
|
<groupId>org.gcube.social-networking</groupId>
|
||||||
|
@ -100,7 +100,6 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.information-system</groupId>
|
<groupId>org.gcube.information-system</groupId>
|
||||||
<artifactId>resource-registry-publisher</artifactId>
|
<artifactId>resource-registry-publisher</artifactId>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.resources</groupId>
|
<groupId>org.gcube.resources</groupId>
|
||||||
|
|
|
@ -22,7 +22,6 @@ import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.node.NullNode;
|
import org.gcube.com.fasterxml.jackson.databind.node.NullNode;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
|
import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
|
||||||
import org.gcube.gcat.configuration.CatalogueConfigurationFactory;
|
|
||||||
import org.gcube.gcat.utils.HTTPUtility;
|
import org.gcube.gcat.utils.HTTPUtility;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
|
@ -21,6 +21,7 @@ import javax.ws.rs.core.MultivaluedMap;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
|
import org.gcube.common.security.ContextBean;
|
||||||
import org.gcube.common.security.ContextBean.Type;
|
import org.gcube.common.security.ContextBean.Type;
|
||||||
import org.gcube.gcat.api.GCatConstants;
|
import org.gcube.gcat.api.GCatConstants;
|
||||||
import org.gcube.gcat.api.configuration.CatalogueConfiguration;
|
import org.gcube.gcat.api.configuration.CatalogueConfiguration;
|
||||||
|
@ -891,7 +892,10 @@ public class CKANPackage extends CKAN implements Moderated {
|
||||||
((ObjectNode) jsonNode).remove(RESOURCES_KEY);
|
((ObjectNode) jsonNode).remove(RESOURCES_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(configuration.getContextBean().is(Type.VRE)) {
|
String context = configuration.getContext();
|
||||||
|
ContextBean contextBean = new ContextBean(context);
|
||||||
|
|
||||||
|
if(contextBean.is(Type.VRE)) {
|
||||||
addItemURLViaResolver(jsonNode);
|
addItemURLViaResolver(jsonNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -904,7 +908,7 @@ public class CKANPackage extends CKAN implements Moderated {
|
||||||
postItemCreated();
|
postItemCreated();
|
||||||
|
|
||||||
if(!isModerationEnabled()) {
|
if(!isModerationEnabled()) {
|
||||||
if(configuration.getContextBean().is(Type.VRE)) {
|
if(contextBean.is(Type.VRE)) {
|
||||||
// Actions performed after a package has been correctly created on ckan.
|
// Actions performed after a package has been correctly created on ckan.
|
||||||
sendSocialPost();
|
sendSocialPost();
|
||||||
}
|
}
|
||||||
|
@ -1489,7 +1493,9 @@ public class CKANPackage extends CKAN implements Moderated {
|
||||||
moderationThread.setItemCoordinates(itemID, name, itemTitle, itemURL);
|
moderationThread.setItemCoordinates(itemID, name, itemTitle, itemURL);
|
||||||
moderationThread.postItemApproved(moderatorMessage);
|
moderationThread.postItemApproved(moderatorMessage);
|
||||||
|
|
||||||
if(configuration.getContextBean().is(Type.VRE)) {
|
String context = configuration.getContext();
|
||||||
|
ContextBean contextBean = new ContextBean(context);
|
||||||
|
if(contextBean.is(Type.VRE)) {
|
||||||
// Actions performed after a package has been correctly created on ckan.
|
// Actions performed after a package has been correctly created on ckan.
|
||||||
sendSocialPost();
|
sendSocialPost();
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class CKANOrganizationTest extends ContextTest {
|
||||||
ContextBean contextBean = new ContextBean(context);
|
ContextBean contextBean = new ContextBean(context);
|
||||||
CKANOrganization ckanOrganization = new CKANOrganization();
|
CKANOrganization ckanOrganization = new CKANOrganization();
|
||||||
ckanOrganization.setApiKey(CKANUtility.getSysAdminAPI());
|
ckanOrganization.setApiKey(CKANUtility.getSysAdminAPI());
|
||||||
String name = CatalogueConfiguration.getOrganizationName(contextBean);
|
String name = CatalogueConfiguration.getOrganizationName(context);
|
||||||
ckanOrganization.setName(name);
|
ckanOrganization.setName(name);
|
||||||
String json = "{\"display_name\": \"" + contextBean.name() + "\",\"description\": \"" + context + " Organization\",\"name\": \"" + name + "\"}";
|
String json = "{\"display_name\": \"" + contextBean.name() + "\",\"description\": \"" + context + " Organization\",\"name\": \"" + name + "\"}";
|
||||||
logger.info("Going to create Organization {} : {}", name, json);
|
logger.info("Going to create Organization {} : {}", name, json);
|
||||||
|
|
|
@ -22,7 +22,6 @@ import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import org.gcube.common.authorization.library.provider.UserInfo;
|
import org.gcube.common.authorization.library.provider.UserInfo;
|
||||||
import org.gcube.common.security.ContextBean;
|
|
||||||
import org.gcube.common.security.providers.SecretManagerProvider;
|
import org.gcube.common.security.providers.SecretManagerProvider;
|
||||||
import org.gcube.gcat.ContextTest;
|
import org.gcube.gcat.ContextTest;
|
||||||
import org.gcube.gcat.api.GCatConstants;
|
import org.gcube.gcat.api.GCatConstants;
|
||||||
|
@ -178,8 +177,7 @@ public class CKANPackageTest extends ContextTest {
|
||||||
@Test
|
@Test
|
||||||
public void listWithParameters() throws Exception {
|
public void listWithParameters() throws Exception {
|
||||||
String contextName = "/gcube/devNext/NextNext";
|
String contextName = "/gcube/devNext/NextNext";
|
||||||
ContextBean contextBean = new ContextBean(contextName);
|
String ckanOrganizationName = CatalogueConfiguration.getOrganizationName(contextName);
|
||||||
String ckanOrganizationName = CatalogueConfiguration.getOrganizationName(contextBean);
|
|
||||||
ContextTest.setContextByName(contextName);
|
ContextTest.setContextByName(contextName);
|
||||||
|
|
||||||
CKANPackage ckanPackage = new CKANPackage();
|
CKANPackage ckanPackage = new CKANPackage();
|
||||||
|
@ -310,8 +308,7 @@ public class CKANPackageTest extends ContextTest {
|
||||||
|
|
||||||
protected CKANPackage createPackage(ObjectMapper mapper, Boolean socialPost) throws Exception {
|
protected CKANPackage createPackage(ObjectMapper mapper, Boolean socialPost) throws Exception {
|
||||||
String currentContext = SecretManagerProvider.instance.get().getContext();
|
String currentContext = SecretManagerProvider.instance.get().getContext();
|
||||||
ContextBean contextBean = new ContextBean(currentContext);
|
String organization = CatalogueConfiguration.getOrganizationName(currentContext);
|
||||||
String organization = CatalogueConfiguration.getOrganizationName(contextBean);
|
|
||||||
|
|
||||||
ObjectNode itemObjectNode = mapper.createObjectNode();
|
ObjectNode itemObjectNode = mapper.createObjectNode();
|
||||||
itemObjectNode.put(CKAN.NAME_KEY, ITEM_NAME_VALUE);
|
itemObjectNode.put(CKAN.NAME_KEY, ITEM_NAME_VALUE);
|
||||||
|
|
Loading…
Reference in New Issue