Commit c1c9738d authored by Matija Obreza's avatar Matija Obreza

JSP: Exclude custom X?? ISO3166 codes from country list and display

parent 8e102206
......@@ -45,7 +45,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
@RequestMapping("/geo")
@RequestMapping({ "/geo", "/iso3166" })
public class CountryController extends BaseController {
@Autowired
......@@ -65,7 +65,7 @@ public class CountryController extends BaseController {
@RequestMapping
public String view(ModelMap model) {
List<Country> countries = geoService.listActive(getLocale());
List<Country> countries = geoService.listActive(getLocale()).stream().filter(country -> country.getCode2() != null).collect(Collectors.toList());
model.addAttribute("countries", countries);
List<String> firstLetters = countries.stream().map(country -> country.getName(getLocale()).substring(0, 1)).distinct().collect(Collectors.toList());
......@@ -83,7 +83,8 @@ public class CountryController extends BaseController {
}
final Country country = geoService.getCountry(countryStr);
if (country == null) {
// We check for code2 so that CG centers as custom ISO3166 codes return 404
if (country == null || country.getCode2() == null) {
throw new NotFoundElement();
}
model.addAttribute("country", country);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment