Switched to ContextBean

This commit is contained in:
Luca Frosini 2022-11-16 11:46:51 +01:00
parent 7742300b42
commit e95483a15e
2 changed files with 12 additions and 12 deletions

View File

@ -25,7 +25,7 @@
<dependency> <dependency>
<groupId>org.gcube.distribution</groupId> <groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId> <artifactId>gcube-bom</artifactId>
<version>2.1.0</version> <version>3.0.0-SNAPSHOT</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
@ -49,8 +49,8 @@
<artifactId>gcube-jackson-databind</artifactId> <artifactId>gcube-jackson-databind</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.core</groupId> <groupId>org.gcube.common</groupId>
<artifactId>common-scope</artifactId> <artifactId>common-security</artifactId>
</dependency> </dependency>
<!-- Added to support Java 11 JDK --> <!-- Added to support Java 11 JDK -->

View File

@ -9,7 +9,7 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonAnySetter;
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore; import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
import org.gcube.com.fasterxml.jackson.annotation.JsonProperty; import org.gcube.com.fasterxml.jackson.annotation.JsonProperty;
import org.gcube.com.fasterxml.jackson.annotation.JsonSetter; import org.gcube.com.fasterxml.jackson.annotation.JsonSetter;
import org.gcube.common.scope.impl.ScopeBean; import org.gcube.common.security.ContextBean;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
@ -35,7 +35,7 @@ public class CatalogueConfiguration {
protected String id; protected String id;
protected String context; protected String context;
protected ScopeBean scopeBean; protected ContextBean contextBean;
protected String defaultOrganization; protected String defaultOrganization;
protected Set<String> supportedOrganizations; protected Set<String> supportedOrganizations;
@ -56,12 +56,12 @@ public class CatalogueConfiguration {
* Return the CKAN organization name using the current context name * Return the CKAN organization name using the current context name
*/ */
public static String getOrganizationName(String context) { public static String getOrganizationName(String context) {
ScopeBean scopeBean = new ScopeBean(context); ContextBean contextBean = new ContextBean(context);
return getOrganizationName(scopeBean); return getOrganizationName(contextBean);
} }
public static String getOrganizationName(ScopeBean scopeBean) { public static String getOrganizationName(ContextBean contextBean) {
String contextName = scopeBean.name(); String contextName = contextBean.name();
return contextName.toLowerCase().replace(" ", "_"); return contextName.toLowerCase().replace(" ", "_");
} }
@ -103,12 +103,12 @@ public class CatalogueConfiguration {
@JsonSetter @JsonSetter
private void setContext(String context) { private void setContext(String context) {
this.context = context; this.context = context;
this.scopeBean = new ScopeBean(context); this.contextBean = new ContextBean(context);
} }
@JsonIgnore @JsonIgnore
public ScopeBean getScopeBean() { public ContextBean getContextBean() {
return scopeBean; return contextBean;
} }
@JsonProperty(value = DEFAULT_ORGANIZATION_KEY) @JsonProperty(value = DEFAULT_ORGANIZATION_KEY)