diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java index 9fbd81a..8596a87 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java @@ -180,7 +180,7 @@ public abstract class HelperMethods { // extract the name from the enum class and add it to the groups // also convert to the group name that should be on ckan - String groupName = getGroupNameOnCkan(field.getClass().getName()); + String groupName = getGroupNameOnCkan(field.getClass().getSimpleName()); if(!groups.contains(groupName)) groups.add(groupName); diff --git a/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java b/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java index 1f0c02e..263588b 100644 --- a/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java +++ b/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java @@ -42,6 +42,7 @@ import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Source; import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Status; import org.gcube.datacatalogue.ckanutillibrary.DataCatalogue; import org.gcube.datacatalogue.ckanutillibrary.DataCatalogueFactory; +import org.junit.Test; import org.slf4j.LoggerFactory; import com.fasterxml.jackson.core.JsonProcessingException; @@ -520,5 +521,22 @@ public class JTests { HelperMethods.removeHTML(toTest); } + + //@Test + public void fatherGroupAnnotation(){ + + Status status = Status.Confirmed; + + // check if the field is an enumerator, and the enum class is also annotated with @Group + if(status.getClass().isEnum() && status.getClass().isAnnotationPresent(Group.class)){ + + // extract the name from the enum class and add it to the groups + // also convert to the group name that should be on ckan + String groupName = HelperMethods.getGroupNameOnCkan(status.getClass().getSimpleName()); + logger.debug("Name is " +groupName ); + + } + + } }