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;
}
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;
}
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;
}
}
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;
}
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();
}
Aggregations