Compare commits

..

No commits in common. "master" and "r5.11.0" have entirely different histories.

4 changed files with 24 additions and 43 deletions

1
.gitignore vendored
View File

@ -2,4 +2,3 @@ target
.classpath .classpath
.project .project
.settings .settings
/.DS_Store

View File

@ -3,16 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.0.0]
- Adding support for "FAO SDG 14.4.1 Questionnaire" source [#23670]
- Upgraded gcube-bom version to 2.1.0
## [v1.3.2] ## [v1.3.2]
- Updated Labels [#23167] - Updated Labels [#23167]
## [v1.3.1] - 2021-04-09 ## [v1.3.1] - 2021-04-09
### Changed ### Changed

View File

@ -14,7 +14,7 @@
<groupId>org.gcube.data-catalogue</groupId> <groupId>org.gcube.data-catalogue</groupId>
<artifactId>grsf-common-library</artifactId> <artifactId>grsf-common-library</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>2.0.0</version> <version>1.3.2</version>
<description>Common library for GRSF service and management panel</description> <description>Common library for GRSF service and management panel</description>
<properties> <properties>
@ -40,7 +40,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>2.0.2</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>

View File

@ -1,6 +1,7 @@
package org.gcube.datacatalogue.common.enums; package org.gcube.datacatalogue.common.enums;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
@ -12,73 +13,60 @@ import com.fasterxml.jackson.annotation.JsonValue;
*/ */
public enum Sources { public enum Sources {
FIRMS("FIRMS","firms"), FIRMS("FIRMS"),
RAM("RAM","ram"), RAM("RAM"),
FISHSOURCE("FishSource", "fishsource"), FISHSOURCE("FishSource"),
GRSF("GRSF", "grsf"), GRSF("GRSF");
SDG("FAO SDG 14.4.1 Questionnaire","sdg");
private String sourceName; private String subGroupNameOrig;
private String urlPath;
private Sources(String sourceName, String urlPath) { private Sources(String origName) {
this.sourceName = sourceName; this.subGroupNameOrig = origName;
this.urlPath = urlPath;
} }
/** /**
* Return the original name * Return the original name
* @return * @return
*/ */
public String getSourceName(){ public String getOrigName(){
return sourceName; return subGroupNameOrig;
} }
@JsonValue @JsonValue
public String onSerialize(){ public String onSerialize(){
return urlPath; return subGroupNameOrig.toLowerCase();
} }
@JsonCreator @JsonCreator
public static Sources onDeserialize(String sourceString) { public static Sources onDeserialize(String sourceString) {
if(sourceString != null) { if(sourceString != null) {
for(Sources source : Sources.values()) { for(Sources source : Sources.values()) {
if (source.urlPath.equalsIgnoreCase(sourceString.trim())) { if (source.toString().equalsIgnoreCase(sourceString.trim()))
return source; return source;
}
if (source.sourceName.equalsIgnoreCase(sourceString.trim())) {
return source;
}
} }
} }
return null; return null;
} }
public String getURLPath() {
return urlPath;
}
@Override @Override
public String toString() { public String toString() {
return urlPath; return getOrigName();
} }
public static String getJsonArrayAsString(){ public static String getAsList(){
return "[" + FIRMS.urlPath + "," + return "[" + Arrays.asList(
RAM.urlPath + "," + FIRMS.toString().toLowerCase(),
FISHSOURCE.urlPath + "," + RAM.toString().toLowerCase(),
GRSF.urlPath + "," + FISHSOURCE.toString().toLowerCase(),
SDG.urlPath + "," + "]"; GRSF.toString().toLowerCase()) + "]";
} }
public static List<String> listNames(){ public static List<String> getListNames(){
List<String> valuesString = new ArrayList<String>(Sources.values().length); List<String> valuesString = new ArrayList<String>(Sources.values().length);
for(Sources source : Sources.values()) { for(Sources source : Sources.values())
valuesString.add(source.getSourceName()); valuesString.add(source.getOrigName());
}
return valuesString; return valuesString;
} }
} }