@Test public void imagesForName() throws IOException { assertThat(imageService.findTaxonImagesForTaxonWithName("Homo sapiens", "en"), is(notNullValue())); }
@RequestMapping(value = "/imagesForName/{scientificName}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @ResponseBody public TaxonImage findTaxonImagesForTaxonWithName( @PathVariable("scientificName") String scientificName, @RequestParam(value = "lang", required = false, defaultValue = "en") String preferredLanguage) throws IOException { TaxonImage taxonImage = null; if (TaxonUtil.isEmptyValue(scientificName)) { taxonImage = new TaxonImage(); taxonImage.setScientificName(scientificName); } else { Map<String, String> taxon = taxonSearch.findTaxon(scientificName); if (taxon != null) { Collection<String> links = taxonSearch.findTaxonIds(scientificName); if (links != null) { taxonImage = enrichWithImage(preferredLanguage, taxonImage, taxon, links); } } } if (taxonImage == null) { throw new ResourceNotFoundException("no image for [" + scientificName + "]"); } return taxonImage; }
ImageService { @RequestMapping(value = "/imagesForName/{scientificName}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @ResponseBody public TaxonImage findTaxonImagesForTaxonWithName( @PathVariable("scientificName") String scientificName, @RequestParam(value = "lang", required = false, defaultValue = "en") String preferredLanguage) throws IOException { TaxonImage taxonImage = null; if (TaxonUtil.isEmptyValue(scientificName)) { taxonImage = new TaxonImage(); taxonImage.setScientificName(scientificName); } else { Map<String, String> taxon = taxonSearch.findTaxon(scientificName); if (taxon != null) { Collection<String> links = taxonSearch.findTaxonIds(scientificName); if (links != null) { taxonImage = enrichWithImage(preferredLanguage, taxonImage, taxon, links); } } } if (taxonImage == null) { throw new ResourceNotFoundException("no image for [" + scientificName + "]"); } return taxonImage; } }
ImageService { @RequestMapping(value = "/imagesForName/{scientificName}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @ResponseBody public TaxonImage findTaxonImagesForTaxonWithName( @PathVariable("scientificName") String scientificName, @RequestParam(value = "lang", required = false, defaultValue = "en") String preferredLanguage) throws IOException { TaxonImage taxonImage = null; if (TaxonUtil.isEmptyValue(scientificName)) { taxonImage = new TaxonImage(); taxonImage.setScientificName(scientificName); } else { Map<String, String> taxon = taxonSearch.findTaxon(scientificName); if (taxon != null) { Collection<String> links = taxonSearch.findTaxonIds(scientificName); if (links != null) { taxonImage = enrichWithImage(preferredLanguage, taxonImage, taxon, links); } } } if (taxonImage == null) { throw new ResourceNotFoundException("no image for [" + scientificName + "]"); } return taxonImage; }  }
ImageService { @RequestMapping(value = "/imagesForName/{scientificName}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @ResponseBody public TaxonImage findTaxonImagesForTaxonWithName( @PathVariable("scientificName") String scientificName, @RequestParam(value = "lang", required = false, defaultValue = "en") String preferredLanguage) throws IOException { TaxonImage taxonImage = null; if (TaxonUtil.isEmptyValue(scientificName)) { taxonImage = new TaxonImage(); taxonImage.setScientificName(scientificName); } else { Map<String, String> taxon = taxonSearch.findTaxon(scientificName); if (taxon != null) { Collection<String> links = taxonSearch.findTaxonIds(scientificName); if (links != null) { taxonImage = enrichWithImage(preferredLanguage, taxonImage, taxon, links); } } } if (taxonImage == null) { throw new ResourceNotFoundException("no image for [" + scientificName + "]"); } return taxonImage; }  @RequestMapping(value = "/imagesForName/{scientificName}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @ResponseBody TaxonImage findTaxonImagesForTaxonWithName(
            @PathVariable("scientificName") String scientificName,
            @RequestParam(value = "lang", required = false, defaultValue = "en") String preferredLanguage); @RequestMapping(value = "/imagesForName", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @ResponseBody TaxonImage findTaxonImagesForTaxonWithName2(
            @RequestParam(value = "name", required = false) String[] names,
            @RequestParam(value = "externalId", required = false) String[] externalIds,
            @RequestParam(value = "lang", required = false, defaultValue = "en") String preferredLanguage); @RequestMapping(value = "/imagesForNames", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @ResponseBody List<TaxonImage> findImagesForNames(
            @RequestParam(value = "name") String[] names,
            @RequestParam(value = "lang", required = false, defaultValue = "en") String preferredLanguage); @RequestMapping(value = "/images/{externalId}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @ResponseBody TaxonImage findTaxonImagesForExternalId(
            @PathVariable("externalId") String externalId,
            @RequestParam(value = "lang", required = false, defaultValue = "en") String preferredLanguage); }
ImageService { @RequestMapping(value = "/imagesForName/{scientificName}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @ResponseBody public TaxonImage findTaxonImagesForTaxonWithName( @PathVariable("scientificName") String scientificName, @RequestParam(value = "lang", required = false, defaultValue = "en") String preferredLanguage) throws IOException { TaxonImage taxonImage = null; if (TaxonUtil.isEmptyValue(scientificName)) { taxonImage = new TaxonImage(); taxonImage.setScientificName(scientificName); } else { Map<String, String> taxon = taxonSearch.findTaxon(scientificName); if (taxon != null) { Collection<String> links = taxonSearch.findTaxonIds(scientificName); if (links != null) { taxonImage = enrichWithImage(preferredLanguage, taxonImage, taxon, links); } } } if (taxonImage == null) { throw new ResourceNotFoundException("no image for [" + scientificName + "]"); } return taxonImage; }  @RequestMapping(value = "/imagesForName/{scientificName}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @ResponseBody TaxonImage findTaxonImagesForTaxonWithName(
            @PathVariable("scientificName") String scientificName,
            @RequestParam(value = "lang", required = false, defaultValue = "en") String preferredLanguage); @RequestMapping(value = "/imagesForName", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @ResponseBody TaxonImage findTaxonImagesForTaxonWithName2(
            @RequestParam(value = "name", required = false) String[] names,
            @RequestParam(value = "externalId", required = false) String[] externalIds,
            @RequestParam(value = "lang", required = false, defaultValue = "en") String preferredLanguage); @RequestMapping(value = "/imagesForNames", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @ResponseBody List<TaxonImage> findImagesForNames(
            @RequestParam(value = "name") String[] names,
            @RequestParam(value = "lang", required = false, defaultValue = "en") String preferredLanguage); @RequestMapping(value = "/images/{externalId}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @ResponseBody TaxonImage findTaxonImagesForExternalId(
            @PathVariable("externalId") String externalId,
            @RequestParam(value = "lang", required = false, defaultValue = "en") String preferredLanguage);  }