diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1cf4022..5345a56 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,8 +2,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for gCube Catalogue (gCat) Service
+## [v2.1.0-SNAPSHOT]
+
+-
+
+
## [v2.0.0]
+- Fixed retrieving of filename from content-disposition http header used to persist a resource [#21216]
- Fixed author and maintainer name and email [#21059] [#21189]
- Improved check on controlled vocabulary to match corner cases [#20742]
- Added PATCH method on Item collection [#19768]
diff --git a/pom.xml b/pom.xml
index 218715a..2ba9857 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@
org.gcube.data-catalogue
gcat
war
- 2.0.0
+ 2.1.0-SNAPSHOT
gCube Catalogue (gCat) Service
This service allows any client to publish on the gCube Catalogue.
diff --git a/src/main/java/org/gcube/gcat/persistence/ckan/CKANPackage.java b/src/main/java/org/gcube/gcat/persistence/ckan/CKANPackage.java
index 67bba4b..fa058d9 100644
--- a/src/main/java/org/gcube/gcat/persistence/ckan/CKANPackage.java
+++ b/src/main/java/org/gcube/gcat/persistence/ckan/CKANPackage.java
@@ -118,8 +118,10 @@ public class CKANPackage extends CKAN {
protected String itemID;
- protected ScopeBean currentScopeBean;
- protected String currentContext;
+ protected final ScopeBean currentScopeBean;
+ protected final String currentContext;
+
+ protected final CKANUser ckanUser;
protected String currentOrganizationName;
protected Set supportedOrganizations;
@@ -134,13 +136,17 @@ public class CKANPackage extends CKAN {
DELETE = ITEM_DELETE;
PURGE = ITEM_PURGE;
managedResources = new ArrayList();
- getCurrentContext();
+ currentContext = ContextUtility.getCurrentContext();
+ currentScopeBean = new ScopeBean(currentContext);
+ ckanUser = CKANUserCache.getCurrrentCKANUser();
getSupportedOrganizationsFromIS();
}
protected Set getSupportedOrganizationsFromIS() {
if(supportedOrganizations == null) {
+ // TODO Add a VRE based cache
+
supportedOrganizations = new HashSet<>();
SimpleQuery query = ICFactory.queryFor(GenericResource.class);
@@ -172,12 +178,11 @@ public class CKANPackage extends CKAN {
}
- CKANUser ckanUser = CKANUserCache.getCurrrentCKANUser();
for(String supportedOrganization : supportedOrganizations) {
ckanUser.addUserToOrganization(supportedOrganization);
}
- logger.debug("Supported CKAN Organization for current Context ({}) are {}", getCurrentContext(),
+ logger.debug("Supported CKAN Organization for current Context ({}) are {}", currentContext,
supportedOrganizations);
return supportedOrganizations;
}
@@ -190,14 +195,6 @@ public class CKANPackage extends CKAN {
return contextName.toLowerCase().replace(" ", "_");
}
- protected String getCurrentContext() {
- if(currentContext == null) {
- currentContext = ContextUtility.getCurrentContext();
- currentScopeBean = new ScopeBean(currentContext);
- }
- return currentContext;
- }
-
protected String getOrganizationName() {
if(currentOrganizationName == null) {
this.currentOrganizationName = CKANPackage.getOrganizationName(currentScopeBean);
@@ -308,9 +305,6 @@ public class CKANPackage extends CKAN {
objectNode.remove(CAPACITY_KEY);
}
- CKANUser ckanUser = CKANUserCache.getCurrrentCKANUser();
-
-
String authorName = ckanUser.getPortalUser().getFullName();
if(authorName==null || authorName.compareTo("")==0) {
authorName = ckanUser.getName();