@ExtJson @Delete("cities") public void destroy(DtoCities dtos) { for (DtoCity dto : dtos) { final City city = cities.get(dto.getId()); validate( new Validations() { { that( city.getAddresses().isEmpty(), "constraint", String.format( "city %s belong to any address, then doesn\'t deleted.", city.toString())); } }); this.cities.delete(city); logger.debug(city.toString() + " removed."); } json("actor destoyed sucessfully", true); }
@Get("cities") public void list() { json(new DtoCities(cities.list())); }