Search in sources :

Example 1 with CodeListManager

use of org.openforis.collect.manager.CodeListManager in project collect by openforis.

the class CodeListItemFormValidator method getExistingCodeListItem.

protected CodeListItem getExistingCodeListItem(ValidationContext ctx, String code) {
    SurveyObjectBaseVM<CodeListItem> viewModel = getVM(ctx);
    CodeListItem editedItem = viewModel.getEditedItem();
    CodeList codeList = editedItem.getCodeList();
    CodeListItem parentItem = getParentItem(ctx);
    CodeListItem existingItem = null;
    CodeListManager codeListManager = getCodeListManager(ctx);
    if (parentItem == null) {
        existingItem = codeListManager.loadRootItem(codeList, code, null);
    } else {
        existingItem = codeListManager.loadChildItem(parentItem, code, null);
    }
    return existingItem;
}
Also used : CodeList(org.openforis.idm.metamodel.CodeList) CodeListManager(org.openforis.collect.manager.CodeListManager) CodeListItem(org.openforis.idm.metamodel.CodeListItem)

Aggregations

CodeListManager (org.openforis.collect.manager.CodeListManager)1 CodeList (org.openforis.idm.metamodel.CodeList)1 CodeListItem (org.openforis.idm.metamodel.CodeListItem)1