@Override public List<Country> getCountries() { Search searchCriteria = new Search(Country.class); searchCriteria.addSortAsc("name"); List<Country> countries = countryDAO.search(searchCriteria); return countries; }
/** * retuns a country with the given name, null otherwise * * @param countryName * @return */ private Country findCountryByName(String name) { Search searchCriteria = new Search(Country.class); searchCriteria.addFilterEqual("name", name); List<Country> countries = countryDAO.search(searchCriteria); if (countries.size() > 0) { return countries.get(0); } return null; }
@Override public Country findCountryByISO3(String iso3) { Search searchCriteria = new Search(Country.class); searchCriteria.addFilterEqual("iso3", iso3); List<Country> countries = countryDAO.search(searchCriteria); if (countries.size() > 0) { return countries.get(0); } return null; }
@Override public Country findCountry(Long id) { return countryDAO.find(id); }
/* (non-Javadoc) * @see it.geosolutions.fra2015.services.SurveyService#searchCountry(java.lang.String) */ @Override public Country searchCountry(String iso3) { Search searchCriteria = new Search(Country.class); searchCriteria.addFilterEqual("iso3", iso3); return countryDAO.search(searchCriteria).get(0); }