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