Compare commits

..

8 Commits

4 changed files with 43 additions and 24 deletions

1
.gitignore vendored
View File

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

View File

@ -3,10 +3,16 @@
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>1.3.2</version> <version>2.0.0</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.0.2</version> <version>2.1.0</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>

View File

@ -1,7 +1,6 @@
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;
@ -13,60 +12,73 @@ 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 subGroupNameOrig; private String sourceName;
private String urlPath;
private Sources(String origName) { private Sources(String sourceName, String urlPath) {
this.subGroupNameOrig = origName; this.sourceName = sourceName;
this.urlPath = urlPath;
} }
/** /**
* Return the original name * Return the original name
* @return * @return
*/ */
public String getOrigName(){ public String getSourceName(){
return subGroupNameOrig; return sourceName;
} }
@JsonValue @JsonValue
public String onSerialize(){ public String onSerialize(){
return subGroupNameOrig.toLowerCase(); return urlPath;
} }
@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.toString().equalsIgnoreCase(sourceString.trim())) if (source.urlPath.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 getOrigName(); return urlPath;
} }
public static String getAsList(){ public static String getJsonArrayAsString(){
return "[" + Arrays.asList( return "[" + FIRMS.urlPath + "," +
FIRMS.toString().toLowerCase(), RAM.urlPath + "," +
RAM.toString().toLowerCase(), FISHSOURCE.urlPath + "," +
FISHSOURCE.toString().toLowerCase(), GRSF.urlPath + "," +
GRSF.toString().toLowerCase()) + "]"; SDG.urlPath + "," + "]";
} }
public static List<String> getListNames(){ public static List<String> listNames(){
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.getOrigName()); valuesString.add(source.getSourceName());
}
return valuesString; return valuesString;
} }
} }