use of org.hisp.dhis.dxf2.csv.CsvImportClass in project dhis2-core by dhis2.
the class CsvMetadataImportTest method runImport.
private ImportReport runImport(String csvFile, CsvImportClass importClass, Consumer<Metadata> preCondition, Consumer<MetadataImportParams> modifier) throws IOException {
InputStream input = new ClassPathResource(csvFile).getInputStream();
Metadata metadata = csvImportService.fromCsv(input, new CsvImportOptions().setImportClass(importClass).setFirstRowIsHeader(true));
if (preCondition != null) {
preCondition.accept(metadata);
}
MetadataImportParams params = new MetadataImportParams();
params.addMetadata(schemaService.getMetadataSchemas(), metadata);
if (modifier != null) {
modifier.accept(params);
}
return importService.importMetadata(params);
}
use of org.hisp.dhis.dxf2.csv.CsvImportClass in project dhis2-core by dhis2.
the class CsvMetadataImportIntegrationTest method runImport.
private ImportReport runImport(String csvFile, CsvImportClass importClass, Consumer<Metadata> preCondition, Consumer<MetadataImportParams> modifier) throws IOException {
InputStream input = new ClassPathResource(csvFile).getInputStream();
Metadata metadata = csvImportService.fromCsv(input, new CsvImportOptions().setImportClass(importClass).setFirstRowIsHeader(true));
if (preCondition != null) {
preCondition.accept(metadata);
}
MetadataImportParams params = new MetadataImportParams();
params.addMetadata(schemaService.getMetadataSchemas(), metadata);
if (modifier != null) {
modifier.accept(params);
}
return importService.importMetadata(params);
}
Aggregations