Search in sources :

Example 1 with CodeListImporter

use of org.openforis.idm.metamodel.xml.CodeListImporter in project collect by openforis.

the class CodeListItemPersisterPR method persistItem.

protected void persistItem() {
    CodeListImporter binder = getImporter();
    PersistedCodeListItem persistedItem = (PersistedCodeListItem) item;
    persistedItem.setSystemId(binder.nextItemId());
    persistedItem.setSortOrder(calculateSortOrder());
    if (parentItem != null) {
        int parentId = ((PersistedCodeListItem) parentItem).getSystemId();
        persistedItem.setParentId(parentId);
    }
    binder.persistItem(persistedItem);
    itemPersisted = true;
}
Also used : CodeListImporter(org.openforis.idm.metamodel.xml.CodeListImporter) PersistedCodeListItem(org.openforis.idm.metamodel.PersistedCodeListItem)

Example 2 with CodeListImporter

use of org.openforis.idm.metamodel.xml.CodeListImporter in project collect by openforis.

the class CodeListManager method importCodeLists.

@Transactional
public void importCodeLists(CollectSurvey survey, InputStream is) throws CodeListImportException {
    int nextSystemId = codeListItemDao.nextSystemId();
    CollectCodeListService service = new CollectCodeListService();
    service.setCodeListManager(this);
    CodeListImporter binder = new CodeListImporter(service, nextSystemId);
    try {
        binder.importCodeLists(survey, is);
    } catch (IdmlParseException e) {
        throw new CodeListImportException(e);
    }
}
Also used : CodeListImporter(org.openforis.idm.metamodel.xml.CodeListImporter) CodeListImportException(org.openforis.collect.io.exception.CodeListImportException) CollectCodeListService(org.openforis.collect.service.CollectCodeListService) IdmlParseException(org.openforis.idm.metamodel.xml.IdmlParseException) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

CodeListImporter (org.openforis.idm.metamodel.xml.CodeListImporter)2 CodeListImportException (org.openforis.collect.io.exception.CodeListImportException)1 CollectCodeListService (org.openforis.collect.service.CollectCodeListService)1 PersistedCodeListItem (org.openforis.idm.metamodel.PersistedCodeListItem)1 IdmlParseException (org.openforis.idm.metamodel.xml.IdmlParseException)1 Transactional (org.springframework.transaction.annotation.Transactional)1