Search in sources :

Example 86 with NodeDefinition

use of org.openforis.idm.metamodel.NodeDefinition in project collect by openforis.

the class EntityChangeProxy method convertToChildDefinitionIdMap.

private <V extends Object> Map<Integer, V> convertToChildDefinitionIdMap(Map<String, V> from) {
    EntityDefinition entityDef = change.getNode().getDefinition();
    Map<Integer, V> map = new HashMap<Integer, V>();
    Set<Entry<String, V>> entries = from.entrySet();
    for (Entry<String, V> entry : entries) {
        String childName = entry.getKey();
        NodeDefinition childDef = entityDef.getChildDefinition(childName);
        Integer childDefId = childDef.getId();
        map.put(childDefId, entry.getValue());
    }
    return map;
}
Also used : EntityDefinition(org.openforis.idm.metamodel.EntityDefinition) Entry(java.util.Map.Entry) HashMap(java.util.HashMap) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition)

Example 87 with NodeDefinition

use of org.openforis.idm.metamodel.NodeDefinition in project collect by openforis.

the class EntityProxy method getChildrenByDefinitionId.

@ExternalizedProperty
public Map<Integer, List<NodeProxy>> getChildrenByDefinitionId() {
    Map<Integer, List<NodeProxy>> result = new HashMap<Integer, List<NodeProxy>>();
    for (NodeDefinition childDefinition : availableChildDefinitions) {
        List<Node<?>> nodes = this.entity.getChildren(childDefinition);
        List<NodeProxy> proxies = NodeProxy.fromList(this, nodes, context);
        result.put(childDefinition.getId(), proxies);
    }
    return result;
}
Also used : HashMap(java.util.HashMap) Node(org.openforis.idm.model.Node) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition) ArrayList(java.util.ArrayList) List(java.util.List) ExternalizedProperty(org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty)

Example 88 with NodeDefinition

use of org.openforis.idm.metamodel.NodeDefinition in project collect by openforis.

the class EntityProxy method getChildrenMaxCountValidation.

@ExternalizedProperty
public List<ValidationResultFlag> getChildrenMaxCountValidation() {
    List<ValidationResultFlag> result = new ArrayList<ValidationResultFlag>(availableChildDefinitions.size());
    for (NodeDefinition childDefinition : availableChildDefinitions) {
        ValidationResultFlag valid = entity.getMaxCountValidationResult(childDefinition);
        result.add(valid);
    }
    return result;
}
Also used : ValidationResultFlag(org.openforis.idm.metamodel.validation.ValidationResultFlag) ArrayList(java.util.ArrayList) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition) ExternalizedProperty(org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty)

Example 89 with NodeDefinition

use of org.openforis.idm.metamodel.NodeDefinition in project collect by openforis.

the class EntityProxy method getAvailableChildDefinitions.

private List<NodeDefinition> getAvailableChildDefinitions() {
    List<NodeDefinition> result = new ArrayList<NodeDefinition>();
    UIOptions uiOptions = ((CollectSurvey) entity.getSurvey()).getUIOptions();
    for (NodeDefinition childDefinition : getChildDefinitions()) {
        if (isApplicable(childDefinition) && !uiOptions.isHidden(childDefinition)) {
            result.add(childDefinition);
        }
    }
    return result;
}
Also used : UIOptions(org.openforis.collect.metamodel.ui.UIOptions) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition) ArrayList(java.util.ArrayList) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Example 90 with NodeDefinition

use of org.openforis.idm.metamodel.NodeDefinition in project collect by openforis.

the class UIModelObjectView method getNodeDefinition.

protected NodeDefinition getNodeDefinition(int defId) {
    CollectSurvey survey = getSurvey();
    NodeDefinition def = survey.getSchema().getDefinitionById(defId);
    return def;
}
Also used : NodeDefinition(org.openforis.idm.metamodel.NodeDefinition) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Aggregations

NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)173 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)70 ArrayList (java.util.ArrayList)42 AttributeDefinition (org.openforis.idm.metamodel.AttributeDefinition)27 Schema (org.openforis.idm.metamodel.Schema)24 UIOptions (org.openforis.collect.metamodel.ui.UIOptions)22 CollectSurvey (org.openforis.collect.model.CollectSurvey)20 Entity (org.openforis.idm.model.Entity)19 CodeAttributeDefinition (org.openforis.idm.metamodel.CodeAttributeDefinition)16 NodeDefinitionVisitor (org.openforis.idm.metamodel.NodeDefinitionVisitor)14 UITab (org.openforis.collect.metamodel.ui.UITab)12 NumericAttributeDefinition (org.openforis.idm.metamodel.NumericAttributeDefinition)11 Survey (org.openforis.idm.metamodel.Survey)11 Test (org.junit.Test)10 DateAttributeDefinition (org.openforis.idm.metamodel.DateAttributeDefinition)9 ModelVersion (org.openforis.idm.metamodel.ModelVersion)9 BooleanAttributeDefinition (org.openforis.idm.metamodel.BooleanAttributeDefinition)8 CoordinateAttributeDefinition (org.openforis.idm.metamodel.CoordinateAttributeDefinition)8 NumberAttributeDefinition (org.openforis.idm.metamodel.NumberAttributeDefinition)8 Node (org.openforis.idm.model.Node)8