コード例 #1
0
  public static void list() {
    Collection<Country> countries = Country.findActiveCountries();

    Collection<CountryDTO> countriesDto = new ArrayList<CountryDTO>();
    for (Country country : countries) {
      countriesDto.add(new CountryDTO(country));
    }

    ApiResponse response = new ApiResponse();
    response.setStatus(Http.StatusCode.OK);
    response.setTotal(String.valueOf(countries.size()));
    response.put("countries", countriesDto);
    renderJSON(response.json);
  }