a little bit documentation
[cdmlib.git] / cdmlib-remote / src / main / java / eu / etaxonomy / cdm / remote / controller / TaxonController.java
index 2a168baeb1dde1bdfe2bce88142295252bcce5ae..2b7ffb3f336c46610d4fdefb3e04ffc2649d72c3 100644 (file)
@@ -57,6 +57,9 @@ public class TaxonController extends BaseController<TaxonBase, ITaxonService>
     private IOccurrenceService occurrenceService;\r
     @Autowired\r
     private INameService nameService;\r
+    @Autowired\r
+    private ITaxonService taxonService;\r
+\r
 \r
     protected static final List<String> TAXONNODE_INIT_STRATEGY = Arrays.asList(new String []{\r
             "taxonNodes"\r
@@ -121,12 +124,13 @@ public class TaxonController extends BaseController<TaxonBase, ITaxonService>
         }\r
     }\r
 \r
-    @RequestMapping(value = "specimensOrObersvations", method = RequestMethod.GET)\r
-    public ModelAndView doListSpecimensOrObersvations(\r
+\r
+    @RequestMapping(value = "specimensOrObservations", method = RequestMethod.GET)\r
+    public ModelAndView doListSpecimensOrObservations(\r
             @PathVariable("uuid") UUID uuid,\r
             HttpServletRequest request,\r
             HttpServletResponse response) throws IOException {\r
-        logger.info("doListSpecimensOrObersvations() - " + request.getServletPath());\r
+        logger.info("doListSpecimensOrObservations() - " + request.getServletPath());\r
 \r
         ModelAndView mv = new ModelAndView();\r
 \r
@@ -136,8 +140,7 @@ public class TaxonController extends BaseController<TaxonBase, ITaxonService>
         orderHints.add(new OrderHint("titleCache", SortOrder.DESCENDING));\r
 \r
         if(tb instanceof Taxon){\r
-            List<SpecimenOrObservationBase> specimensOrObersvations = occurrenceService.listByAnyAssociation(\r
-                    null, (Taxon)tb, null, 0, orderHints, null);\r
+            List<SpecimenOrObservationBase> specimensOrObersvations = occurrenceService.listByAssociatedTaxon(null, null, (Taxon)tb, null, null, null, orderHints, null);\r
             mv.addObject(specimensOrObersvations);\r
         } else {\r
             HttpStatusMessage.UUID_REFERENCES_WRONG_TYPE.send(response);\r
@@ -161,4 +164,20 @@ public class TaxonController extends BaseController<TaxonBase, ITaxonService>
         return mv;\r
     }\r
 \r
+    /**\r
+     * FIXME change @RequestMapping to /taxon/findBestMatchingTaxon and also move into TaxonListController\r
+     */\r
+    @RequestMapping(value = "/bestMatchingTaxon/{taxonName}", method = RequestMethod.GET)\r
+    public TaxonBase doFindBestMatchingTaxon(\r
+             @PathVariable("taxonName") String taxonName,\r
+            HttpServletRequest request,\r
+            HttpServletResponse response)throws IOException {\r
+\r
+        Taxon bestMatchingTaxon =  taxonService.findBestMatchingTaxon(taxonName);\r
+\r
+        return bestMatchingTaxon;\r
+\r
+\r
+    }\r
+\r
 }
\ No newline at end of file