improved Group annotation with parent field: Indicator group can now be managed
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@135154 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ba87596f27
commit
41c877cda7
|
@ -13,4 +13,6 @@ import java.lang.annotation.Target;
|
|||
@Target({ElementType.FIELD, ElementType.TYPE})
|
||||
public @interface Group {
|
||||
|
||||
Class parentGroup() default Class.class;
|
||||
|
||||
}
|
||||
|
|
|
@ -187,6 +187,14 @@ public abstract class HelperMethods {
|
|||
if(!groups.contains(groupName))
|
||||
groups.add(groupName);
|
||||
|
||||
// check if this class has a father too (@Group annotation allows it)
|
||||
Group groupAnnotationOnEnum = field.getType().getAnnotation(Group.class);
|
||||
if(!groupAnnotationOnEnum.parentGroup().equals(Class.class)){
|
||||
String groupNameFather = getGroupNameOnCkan(groupAnnotationOnEnum.parentGroup().getSimpleName());
|
||||
if(!groups.contains(groupNameFather))
|
||||
groups.add(groupNameFather);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
|||
* Abundance_Level for Stock records
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
@Group
|
||||
@Group(parentGroup=Indicator.class)
|
||||
public enum Abundance_Level {
|
||||
|
||||
Intermediate_Abundance("Intermediate abundance"),
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
|
|||
* Exploitation_Rate for Stock records
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
@Group
|
||||
@Group(parentGroup=Indicator.class)
|
||||
public enum Exploitation_Rate {
|
||||
|
||||
Moderate_Fishing_Mortality("Moderate fishing mortality"),
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package org.gcube.data_catalogue.grsf_publish_ws.utils.groups;
|
||||
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Group;
|
||||
|
||||
/**
|
||||
* Indicator group: father of Abundance level and Exploitation Rate
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
@Group
|
||||
public enum Indicator {
|
||||
|
||||
}
|
Loading…
Reference in New Issue