Search in sources :

Example 1 with CodeListService

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

the class CodeTableDataExtractor method getCodeListService.

private CodeListService getCodeListService(CodeList list) {
    Survey survey = list.getSurvey();
    SurveyContext context = survey.getContext();
    CodeListService codeListService = context.getCodeListService();
    return codeListService;
}
Also used : CollectSurvey(org.openforis.collect.model.CollectSurvey) Survey(org.openforis.idm.metamodel.Survey) CodeListService(org.openforis.idm.metamodel.CodeListService) SurveyContext(org.openforis.idm.metamodel.SurveyContext)

Example 2 with CodeListService

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

the class CodeTableDataExtractor method getCodeListService.

private CodeListService getCodeListService() {
    CollectSurvey survey = (CollectSurvey) table.getCodeList().getSurvey();
    SurveyContext context = survey.getContext();
    CodeListService codeListService = context.getCodeListService();
    return codeListService;
}
Also used : CodeListService(org.openforis.idm.metamodel.CodeListService) CollectSurvey(org.openforis.collect.model.CollectSurvey) SurveyContext(org.openforis.idm.metamodel.SurveyContext)

Example 3 with CodeListService

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

the class CodeValueFKColumnValueExtractor method findCodeListItem.

private <T extends CodeListItem> T findCodeListItem(CodeAttribute attr) {
    String code = getCodeValue(attr);
    if (StringUtils.isBlank(code)) {
        return null;
    } else {
        CodeListService codeListService = getCodeListService((CollectSurvey) attr.getSurvey());
        T item = codeListService.loadItem(attr);
        return item;
    }
}
Also used : CodeListService(org.openforis.idm.metamodel.CodeListService)

Example 4 with CodeListService

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

the class CodeValueFKColumnValueExtractor method getCodeListService.

private CodeListService getCodeListService(CollectSurvey survey) {
    SurveyContext context = survey.getContext();
    CodeListService codeListService = context.getCodeListService();
    return codeListService;
}
Also used : CodeListService(org.openforis.idm.metamodel.CodeListService) SurveyContext(org.openforis.idm.metamodel.SurveyContext)

Example 5 with CodeListService

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

the class MinCountValidator method isAvailableCodeListItems.

private boolean isAvailableCodeListItems(Entity parentEntity) {
    CodeAttributeDefinition codeAttrDef = (CodeAttributeDefinition) nodeDefinition;
    SurveyContext context = codeAttrDef.getSurvey().getContext();
    CodeListService codeListService = context.getCodeListService();
    if (codeListService == null) {
        // test context does not have a CodeListService
        return true;
    }
    List<CodeListItem> validItems = codeListService.loadValidItems(parentEntity, codeAttrDef);
    return !validItems.isEmpty();
}
Also used : CodeAttributeDefinition(org.openforis.idm.metamodel.CodeAttributeDefinition) CodeListService(org.openforis.idm.metamodel.CodeListService) CodeListItem(org.openforis.idm.metamodel.CodeListItem) SurveyContext(org.openforis.idm.metamodel.SurveyContext)

Aggregations

CodeListService (org.openforis.idm.metamodel.CodeListService)19 CodeListItem (org.openforis.idm.metamodel.CodeListItem)13 CodeAttributeDefinition (org.openforis.idm.metamodel.CodeAttributeDefinition)8 CodeList (org.openforis.idm.metamodel.CodeList)8 SurveyContext (org.openforis.idm.metamodel.SurveyContext)6 ArrayList (java.util.ArrayList)4 CollectSurvey (org.openforis.collect.model.CollectSurvey)3 HashMap (java.util.HashMap)2 List (java.util.List)2 AttributeDefinition (org.openforis.idm.metamodel.AttributeDefinition)2 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)2 Survey (org.openforis.idm.metamodel.Survey)2 Code (org.openforis.idm.model.Code)2 NumberValue (org.openforis.idm.model.NumberValue)2 IOException (java.io.IOException)1 NumberFormat (java.text.NumberFormat)1 ExternalizedProperty (org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty)1 CodeListItemProxy (org.openforis.collect.metamodel.proxy.CodeListItemProxy)1 UIOptions (org.openforis.collect.metamodel.ui.UIOptions)1 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)1