Changed solution to support both Smartgears 3 and 4

This commit is contained in:
Luca Frosini 2022-11-28 14:29:49 +01:00
parent ec25766c3b
commit faf102e5d7
3 changed files with 9 additions and 25 deletions

View File

@ -2,9 +2,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for gCube Catalogue (gCat) API
## [v3.0.0-SNAPSHOT]
## [v2.3.2-SNAPSHOT]
- Library migrated to Smartgears 4
- Library modified to be compliant with both Smartgears 3 and 4
## [v2.3.1]

11
pom.xml
View File

@ -9,7 +9,7 @@
</parent>
<groupId>org.gcube.data-catalogue</groupId>
<artifactId>gcat-api</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>2.3.2-SNAPSHOT</version>
<name>gCube Catalogue (gCat) API</name>
<description>gCube Catalogue (gCat) API is a library containing classes shared across gcat* components</description>
<properties>
@ -25,7 +25,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>2.1.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -48,15 +48,12 @@
<groupId>org.gcube.common</groupId>
<artifactId>gcube-jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-security</artifactId>
</dependency>
<!-- Added to support Java 11 JDK -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- END Added to support Java 11 JDK -->

View File

@ -6,10 +6,8 @@ import java.util.Set;
import org.gcube.com.fasterxml.jackson.annotation.JsonAnyGetter;
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.security.ContextBean;
/**
* @author Luca Frosini (ISTI - CNR)
@ -35,7 +33,6 @@ public class CatalogueConfiguration {
protected String id;
protected String context;
protected ContextBean contextBean;
protected String defaultOrganization;
protected Set<String> supportedOrganizations;
@ -56,13 +53,9 @@ public class CatalogueConfiguration {
* Return the CKAN organization name using the current context name
*/
public static String getOrganizationName(String context) {
ContextBean contextBean = new ContextBean(context);
return getOrganizationName(contextBean);
}
public static String getOrganizationName(ContextBean contextBean) {
String contextName = contextBean.name();
return contextName.toLowerCase().replace(" ", "_");
String[] components = context.split("/");
String name = components[components.length-1];
return name.toLowerCase().replace(" ", "_");
}
protected CatalogueConfiguration() {
@ -103,12 +96,6 @@ public class CatalogueConfiguration {
@JsonSetter
private void setContext(String context) {
this.context = context;
this.contextBean = new ContextBean(context);
}
@JsonIgnore
public ContextBean getContextBean() {
return contextBean;
}
@JsonProperty(value = DEFAULT_ORGANIZATION_KEY)