Search in sources :

Example 1 with DataCleansingMetadataView

use of org.openforis.collect.datacleansing.DataCleansingMetadataView in project collect by openforis.

the class JsonDataCleansingExportTask method execute.

@Override
protected void execute() throws Throwable {
    DataCleansingMetadata metadata = dataCleansingManager.loadMetadata(survey);
    if (!metadata.isEmpty()) {
        DataCleansingMetadataView metadataView = DataCleansingMetadataView.fromMetadata(metadata);
        ObjectMapper mapper = new ObjectMapper();
        mapper.writeValue(resultFile, metadataView);
    }
}
Also used : DataCleansingMetadata(org.openforis.collect.datacleansing.DataCleansingMetadata) DataCleansingMetadataView(org.openforis.collect.datacleansing.DataCleansingMetadataView) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 2 with DataCleansingMetadataView

use of org.openforis.collect.datacleansing.DataCleansingMetadataView in project collect by openforis.

the class JsonDataCleansingImportTask method execute.

@Override
protected void execute() throws Throwable {
    ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    DataCleansingMetadataView metadataView = objectMapper.readValue(inputFile, DataCleansingMetadataView.class);
    DataCleansingMetadata metadata = metadataView.toMetadata(survey);
    // TODO handle exceptions
    dataCleansingManager.saveMetadata(survey, metadata, true, activeUser);
}
Also used : DataCleansingMetadata(org.openforis.collect.datacleansing.DataCleansingMetadata) DataCleansingMetadataView(org.openforis.collect.datacleansing.DataCleansingMetadataView) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 DataCleansingMetadata (org.openforis.collect.datacleansing.DataCleansingMetadata)2 DataCleansingMetadataView (org.openforis.collect.datacleansing.DataCleansingMetadataView)2