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>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId>
<version>2.1.0</version>
<version>3.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -49,8 +49,8 @@
<artifactId>gcube-jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope</artifactId>
<groupId>org.gcube.common</groupId>
<artifactId>common-security</artifactId>
</dependency>
<!-- 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.JsonProperty;
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)
@ -35,7 +35,7 @@ public class CatalogueConfiguration {
protected String id;
protected String context;
protected ScopeBean scopeBean;
protected ContextBean contextBean;
protected String defaultOrganization;
protected Set<String> supportedOrganizations;
@ -56,12 +56,12 @@ public class CatalogueConfiguration {
* Return the CKAN organization name using the current context name
*/
public static String getOrganizationName(String context) {
ScopeBean scopeBean = new ScopeBean(context);
return getOrganizationName(scopeBean);
ContextBean contextBean = new ContextBean(context);
return getOrganizationName(contextBean);
}
public static String getOrganizationName(ScopeBean scopeBean) {
String contextName = scopeBean.name();
public static String getOrganizationName(ContextBean contextBean) {
String contextName = contextBean.name();
return contextName.toLowerCase().replace(" ", "_");
}
@ -103,12 +103,12 @@ public class CatalogueConfiguration {
@JsonSetter
private void setContext(String context) {
this.context = context;
this.scopeBean = new ScopeBean(context);
this.contextBean = new ContextBean(context);
}
@JsonIgnore
public ScopeBean getScopeBean() {
return scopeBean;
public ContextBean getContextBean() {
return contextBean;
}
@JsonProperty(value = DEFAULT_ORGANIZATION_KEY)