37 lines
870 B
Java
37 lines
870 B
Java
package org.gcube.application.geoportal.common.model.profile;
|
|
|
|
import org.bson.Document;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
public class Field extends Document {
|
|
|
|
public static final String TYPE="_type";
|
|
public static final String CHILDREN="_children";
|
|
public static final String MAX_CARDINALITY="_max";
|
|
public static final String MIN_CARDINALITY="_min";
|
|
|
|
|
|
public String getType(){
|
|
return this.getString(TYPE);
|
|
};
|
|
|
|
public List getChildren(){
|
|
return this.get(CHILDREN,List.class);
|
|
}
|
|
|
|
public Integer getMaxCardinality(){
|
|
return (Integer) this.getOrDefault(MAX_CARDINALITY,1);
|
|
}
|
|
|
|
public Integer getMinCardinality(){
|
|
return (Integer) this.getOrDefault(MIN_CARDINALITY,0);
|
|
}
|
|
public Boolean isMandatory(){
|
|
return getMinCardinality()==0;
|
|
}
|
|
|
|
}
|