Search in sources :

Example 1 with FlushMode

use of org.hisp.dhis.dxf2.metadata.FlushMode in project dhis2-core by dhis2.

the class DefaultMetadataImportService method getParamsFromMap.

@Override
public MetadataImportParams getParamsFromMap(Map<String, List<String>> parameters) {
    MetadataImportParams params = new MetadataImportParams();
    if (params.getUser() == null) {
        params.setUser(currentUserService.getCurrentUser());
    }
    params.setSkipSharing(getBooleanWithDefault(parameters, "skipSharing", false));
    params.setSkipValidation(getBooleanWithDefault(parameters, "skipValidation", false));
    params.setImportMode(getEnumWithDefault(ObjectBundleMode.class, parameters, "importMode", ObjectBundleMode.COMMIT));
    params.setPreheatMode(getEnumWithDefault(PreheatMode.class, parameters, "preheatMode", PreheatMode.REFERENCE));
    params.setIdentifier(getEnumWithDefault(PreheatIdentifier.class, parameters, "identifier", PreheatIdentifier.UID));
    params.setImportStrategy(getEnumWithDefault(ImportStrategy.class, parameters, "importStrategy", ImportStrategy.CREATE_AND_UPDATE));
    params.setAtomicMode(getEnumWithDefault(AtomicMode.class, parameters, "atomicMode", AtomicMode.ALL));
    params.setMergeMode(getEnumWithDefault(MergeMode.class, parameters, "mergeMode", MergeMode.REPLACE));
    params.setFlushMode(getEnumWithDefault(FlushMode.class, parameters, "flushMode", FlushMode.AUTO));
    params.setImportReportMode(getEnumWithDefault(ImportReportMode.class, parameters, "importReportMode", ImportReportMode.ERRORS));
    if (getBooleanWithDefault(parameters, "async", false)) {
        TaskId taskId = new TaskId(TaskCategory.METADATA_IMPORT, params.getUser());
        notifier.clear(taskId);
        params.setTaskId(taskId);
    }
    return params;
}
Also used : ImportStrategy(org.hisp.dhis.importexport.ImportStrategy) MergeMode(org.hisp.dhis.common.MergeMode) TaskId(org.hisp.dhis.scheduling.TaskId) ObjectBundleMode(org.hisp.dhis.dxf2.metadata.objectbundle.ObjectBundleMode) ImportReportMode(org.hisp.dhis.dxf2.metadata.feedback.ImportReportMode) PreheatIdentifier(org.hisp.dhis.preheat.PreheatIdentifier) PreheatMode(org.hisp.dhis.preheat.PreheatMode)

Example 2 with FlushMode

use of org.hisp.dhis.dxf2.metadata.FlushMode in project dhis2-core by dhis2.

the class MetadataImportParams method toObjectBundleParams.

public ObjectBundleParams toObjectBundleParams() {
    ObjectBundleParams params = new ObjectBundleParams();
    params.setUser(user);
    params.setSkipSharing(skipSharing);
    params.setSkipValidation(skipValidation);
    params.setTaskId(taskId);
    params.setImportStrategy(importStrategy);
    params.setAtomicMode(atomicMode);
    params.setObjects(objects);
    params.setPreheatIdentifier(identifier);
    params.setPreheatMode(preheatMode);
    params.setObjectBundleMode(importMode);
    params.setMergeMode(mergeMode);
    params.setFlushMode(flushMode);
    params.setImportReportMode(importReportMode);
    return params;
}
Also used : ObjectBundleParams(org.hisp.dhis.dxf2.metadata.objectbundle.ObjectBundleParams)

Aggregations

MergeMode (org.hisp.dhis.common.MergeMode)1 ImportReportMode (org.hisp.dhis.dxf2.metadata.feedback.ImportReportMode)1 ObjectBundleMode (org.hisp.dhis.dxf2.metadata.objectbundle.ObjectBundleMode)1 ObjectBundleParams (org.hisp.dhis.dxf2.metadata.objectbundle.ObjectBundleParams)1 ImportStrategy (org.hisp.dhis.importexport.ImportStrategy)1 PreheatIdentifier (org.hisp.dhis.preheat.PreheatIdentifier)1 PreheatMode (org.hisp.dhis.preheat.PreheatMode)1 TaskId (org.hisp.dhis.scheduling.TaskId)1