use of de.symeda.sormas.api.infrastructure.country.CountryDto in project SORMAS-Project by hzi-braunschweig.
the class CountryFacadeEjbTest method testArchive.
@Test
public void testArchive() {
Country country = creator.createCountry("Romania", "ROU", "642");
getCountryFacade().archive(country.getUuid());
CountryDto actual = getCountryFacade().getByUuid(country.getUuid());
assertTrue(actual.isArchived());
}
use of de.symeda.sormas.api.infrastructure.country.CountryDto in project SORMAS-Project by hzi-braunschweig.
the class CountryImporter method importDataFromCsvLine.
@Override
protected ImportLineResult importDataFromCsvLine(String[] values, String[] entityClasses, String[] entityProperties, String[][] entityPropertyPaths, boolean firstLine) throws IOException, InvalidColumnException {
if (values.length > entityProperties.length) {
writeImportError(values, I18nProperties.getValidationError(Validations.importLineTooLong));
return ImportLineResult.ERROR;
}
CountryDto newEntityDto = CountryDto.build();
boolean iHasImportError = insertRowIntoData(values, entityClasses, entityPropertyPaths, false, (cellData) -> {
try {
if (!StringUtils.isEmpty(cellData.getValue())) {
insertColumnEntryIntoData(newEntityDto, cellData.getValue(), cellData.getEntityPropertyPath());
}
} catch (ImportErrorException | InvalidColumnException e) {
return e;
}
return null;
});
if (!iHasImportError) {
try {
FacadeProvider.getCountryFacade().save(newEntityDto, allowOverwrite);
return ImportLineResult.SUCCESS;
} catch (EmptyValueException e) {
writeImportError(values, e.getMessage());
return ImportLineResult.ERROR;
} catch (ValidationRuntimeException e) {
writeImportError(values, e.getMessage());
return ImportLineResult.DUPLICATE;
}
} else {
return ImportLineResult.ERROR;
}
}
Aggregations