removed useless group name fields in enumerators. Fixed common class and helper method
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@132960 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0d27ef2e17
commit
3104372ed3
|
@ -228,7 +228,7 @@ public class Common {
|
|||
this.resources = resources;
|
||||
}
|
||||
|
||||
public void setProperties(Map<String, String> extras) {
|
||||
public void setExtras(Map<String, String> extras) {
|
||||
this.extras = extras;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ public abstract class HelperMethods {
|
|||
Object f = new PropertyDescriptor(field.getName(), current).getReadMethod().invoke(record);
|
||||
if(f != null){
|
||||
|
||||
// also convert to the group name that should be on ckan
|
||||
groups.add(getGroupNameOnCkan(f.toString()));
|
||||
|
||||
}
|
||||
|
@ -111,7 +112,7 @@ public abstract class HelperMethods {
|
|||
if(f != null){
|
||||
|
||||
// get the key to put into the map first
|
||||
extras.put(field.getAnnotation(CustomField.class).key(), f);
|
||||
extras.put(field.getAnnotation(CustomField.class).key(), f.toString());
|
||||
|
||||
}
|
||||
}catch(Exception e){
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.gcube.data_catalogue.grsf_publish_ws.utils.groups;
|
||||
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
|
@ -16,19 +14,9 @@ public enum Abundance_Level {
|
|||
Uncertain_Not_Assessed("Uncertain/Not assessed");
|
||||
|
||||
private String subGroupNameOrig;
|
||||
private String subGroupNameOnCkan;
|
||||
|
||||
private Abundance_Level(String origName) {
|
||||
this.subGroupNameOrig = origName;
|
||||
this.subGroupNameOnCkan = HelperMethods.getGroupNameOnCkan(origName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name the group has on ckan
|
||||
* @return
|
||||
*/
|
||||
public String getNameCkan(){
|
||||
return subGroupNameOnCkan;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package org.gcube.data_catalogue.grsf_publish_ws.utils.groups;
|
||||
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* Exploitation_Rate for Stock records
|
||||
|
@ -20,7 +17,6 @@ public enum Exploitation_Rate {
|
|||
|
||||
private Exploitation_Rate(String origName) {
|
||||
this.subGroupNameOrig = origName;
|
||||
this.subGroupNameOnCkan = HelperMethods.getGroupNameOnCkan(origName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,11 +35,6 @@ public enum Exploitation_Rate {
|
|||
return subGroupNameOrig;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String onSerialize(){
|
||||
return subGroupNameOrig.toLowerCase();
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static Exploitation_Rate onDeserialize(String exploitationString) {
|
||||
if(exploitationString != null) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.gcube.data_catalogue.grsf_publish_ws.utils.groups;
|
||||
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
|
@ -21,19 +19,9 @@ public enum Production_System_Type {
|
|||
Unspecified("Unspecified");
|
||||
|
||||
private String subGroupNameOrig;
|
||||
private String subGroupNameOnCkan;
|
||||
|
||||
private Production_System_Type(String origName) {
|
||||
this.subGroupNameOrig = origName;
|
||||
this.subGroupNameOnCkan = HelperMethods.getGroupNameOnCkan(origName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name the group has on ckan
|
||||
* @return
|
||||
*/
|
||||
public String getNameCkan(){
|
||||
return subGroupNameOnCkan;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.gcube.data_catalogue.grsf_publish_ws.utils.groups;
|
||||
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
|
@ -16,19 +14,9 @@ public enum Source {
|
|||
FISHSOURCE("FishSource");
|
||||
|
||||
private String subGroupNameOrig;
|
||||
private String subGroupNameOnCkan;
|
||||
|
||||
private Source(String origName) {
|
||||
this.subGroupNameOrig = origName;
|
||||
this.subGroupNameOnCkan = HelperMethods.getGroupNameOnCkan(origName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name the group has on ckan
|
||||
* @return
|
||||
*/
|
||||
public String getNameCkan(){
|
||||
return subGroupNameOnCkan;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.gcube.data_catalogue.grsf_publish_ws.utils.groups;
|
||||
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
|
@ -15,19 +13,9 @@ public enum Status {
|
|||
Confirmed("Confirmed");
|
||||
|
||||
private String subGroupNameOrig;
|
||||
private String subGroupNameOnCkan;
|
||||
|
||||
private Status(String origName) {
|
||||
this.subGroupNameOrig = origName;
|
||||
this.subGroupNameOnCkan = HelperMethods.getGroupNameOnCkan(origName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name the group has on ckan
|
||||
* @return
|
||||
*/
|
||||
public String getNameCkan(){
|
||||
return subGroupNameOnCkan;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,11 +26,20 @@ public enum Status {
|
|||
return subGroupNameOrig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the json value
|
||||
* @return
|
||||
*/
|
||||
@JsonValue
|
||||
public String onSerialize(){
|
||||
return subGroupNameOrig.toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get back an enum from json string
|
||||
* @param statusString
|
||||
* @return
|
||||
*/
|
||||
@JsonCreator
|
||||
public static Status onDeserialize(String statusString) {
|
||||
if(statusString != null) {
|
||||
|
@ -54,6 +51,9 @@ public enum Status {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by reflection
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return getOrigName();
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.gcube.data_catalogue.grsf_publish_ws.utils.groups;
|
||||
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
|
@ -18,19 +16,9 @@ public enum Type {
|
|||
Fishing_Description("Fishing Description"); // for fishery
|
||||
|
||||
private String subGroupNameOrig;
|
||||
private String subGroupNameOnCkan;
|
||||
|
||||
private Type(String origName) {
|
||||
this.subGroupNameOrig = origName;
|
||||
this.subGroupNameOnCkan = HelperMethods.getGroupNameOnCkan(origName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name the group has on ckan
|
||||
* @return
|
||||
*/
|
||||
public String getNameCkan(){
|
||||
return subGroupNameOnCkan;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,11 +29,20 @@ public enum Type {
|
|||
return subGroupNameOrig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the json value
|
||||
* @return
|
||||
*/
|
||||
@JsonValue
|
||||
public String onSerialize(){
|
||||
return subGroupNameOrig.toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get back an enum from json string
|
||||
* @param typeString
|
||||
* @return
|
||||
*/
|
||||
@JsonCreator
|
||||
public static Type onDeserialize(String typeString) {
|
||||
if(typeString != null) {
|
||||
|
@ -57,6 +54,9 @@ public enum Type {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by reflection
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return getOrigName();
|
||||
|
|
Loading…
Reference in New Issue