Search in sources :

Example 6 with ExternalizedProperty

use of org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty 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 7 with ExternalizedProperty

use of org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty 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 8 with ExternalizedProperty

use of org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty in project collect by openforis.

the class SchemaProxy method getKeyAttributeDefinitionIdsByRootEntityId.

@ExternalizedProperty
public Map<Integer, List<Integer>> getKeyAttributeDefinitionIdsByRootEntityId() {
    Map<Integer, List<Integer>> result = new HashMap<Integer, List<Integer>>();
    List<EntityDefinition> rootEntityDefinitions = schema.getRootEntityDefinitions();
    for (EntityDefinition rootEntity : rootEntityDefinitions) {
        List<Integer> keyDefnIds = new ArrayList<Integer>();
        List<AttributeDefinition> keyDefns = rootEntity.getKeyAttributeDefinitions();
        for (AttributeDefinition keyDefn : keyDefns) {
            keyDefnIds.add(keyDefn.getId());
        }
        result.put(rootEntity.getId(), keyDefnIds);
    }
    return result;
}
Also used : EntityDefinition(org.openforis.idm.metamodel.EntityDefinition) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AttributeDefinition(org.openforis.idm.metamodel.AttributeDefinition) List(java.util.List) ArrayList(java.util.ArrayList) ExternalizedProperty(org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty)

Example 9 with ExternalizedProperty

use of org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty in project collect by openforis.

the class CodeAttributeProxy method getCodeListItem.

@ExternalizedProperty
public CodeListItemProxy getCodeListItem() {
    if (isEnumerator()) {
        CodeListService codeListManager = getCodeListService();
        CodeListItem codeListItem = codeListManager.loadItem(codeAttribute);
        return codeListItem == null ? null : new CodeListItemProxy(codeListItem);
    } else {
        return null;
    }
}
Also used : CodeListService(org.openforis.idm.metamodel.CodeListService) CodeListItem(org.openforis.idm.metamodel.CodeListItem) CodeListItemProxy(org.openforis.collect.metamodel.proxy.CodeListItemProxy) ExternalizedProperty(org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty)

Example 10 with ExternalizedProperty

use of org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty in project collect by openforis.

the class EntityProxy method getChildrenRelevance.

@ExternalizedProperty
public List<Boolean> getChildrenRelevance() {
    List<Boolean> result = new ArrayList<Boolean>(availableChildDefinitions.size());
    for (NodeDefinition childDefinition : availableChildDefinitions) {
        boolean relevant = entity.isRelevant(childDefinition);
        result.add(relevant);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition) ExternalizedProperty(org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty)

Aggregations

ExternalizedProperty (org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty)15 ArrayList (java.util.ArrayList)10 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)6 UIOptions (org.openforis.collect.metamodel.ui.UIOptions)4 List (java.util.List)3 CollectSurvey (org.openforis.collect.model.CollectSurvey)3 HashMap (java.util.HashMap)2 ValidationResultFlag (org.openforis.idm.metamodel.validation.ValidationResultFlag)2 File (java.io.File)1 SurveyBackupJob (org.openforis.collect.io.SurveyBackupJob)1 CodeListItemProxy (org.openforis.collect.metamodel.proxy.CodeListItemProxy)1 Direction (org.openforis.collect.metamodel.ui.UIOptions.Direction)1 Layout (org.openforis.collect.metamodel.ui.UIOptions.Layout)1 Step (org.openforis.collect.model.CollectRecord.Step)1 NodeUnmarshallingError (org.openforis.collect.persistence.xml.NodeUnmarshallingError)1 AttributeDefinition (org.openforis.idm.metamodel.AttributeDefinition)1 CodeListItem (org.openforis.idm.metamodel.CodeListItem)1 CodeListService (org.openforis.idm.metamodel.CodeListService)1 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)1 ReferenceDataSchema (org.openforis.idm.metamodel.ReferenceDataSchema)1