use of org.activityinfo.server.database.hibernate.entity.Country in project activityinfo by bedatadriven.
the class UserDatabasePolicy method findCountry.
private Country findCountry(PropertyMap properties) {
int countryId;
if (properties.containsKey("countryId")) {
countryId = properties.get("countryId");
} else {
// this was the default
countryId = 1;
}
Country country = countryDAO.findById(countryId);
if (country == null) {
throw new CommandException(String.format("No country exists with id %d", countryId));
}
return country;
}
use of org.activityinfo.server.database.hibernate.entity.Country in project activityinfo by bedatadriven.
the class GetCountriesHandler method mapToDtos.
private ArrayList<CountryDTO> mapToDtos(List<Country> countries) {
ArrayList<CountryDTO> dtos = new ArrayList<CountryDTO>();
for (Country country : countries) {
CountryDTO dto = new CountryDTO();
dto.setId(country.getId());
dto.setName(country.getName());
dto.setCodeISO(country.getCodeISO());
dtos.add(dto);
}
return dtos;
}
Aggregations