missing controllers for the generic BaseController
[cdmlib.git] / cdmlib-remote / src / main / java / eu / etaxonomy / cdm / remote / controller / NameController.java
index 97d679c89fc01e96da930eb5ab7219ca02be13f4..f0a2061a847b691f656d943fcd3e803574e9c9c4 100644 (file)
@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;\r
 import org.springframework.web.bind.WebDataBinder;\r
 import org.springframework.web.bind.annotation.InitBinder;\r
+import org.springframework.web.bind.annotation.PathVariable;\r
 import org.springframework.web.bind.annotation.RequestMapping;\r
 import org.springframework.web.bind.annotation.RequestMethod;\r
 \r
@@ -45,7 +46,7 @@ import eu.etaxonomy.cdm.remote.editor.UUIDPropertyEditor;
  */\r
 \r
 @Controller\r
-@RequestMapping(value = {"/name/*", "/name/{uuid}"})\r
+@RequestMapping(value = {"/name/{uuid}"})\r
 public class NameController extends AnnotatableController<TaxonNameBase, INameService>\r
 {\r
        \r
@@ -64,8 +65,7 @@ public class NameController extends AnnotatableController<TaxonNameBase, INameSe
        \r
        public NameController(){\r
                super();\r
-               setUuidParameterPattern("^/name/([^/?#&\\.]+).*");\r
-               setInitializationStrategy(Arrays.asList(new String[]{"$"}));\r
+               setInitializationStrategy(Arrays.asList(new String[]{"$"})); //TODO still needed????\r
        }\r
        \r
        /* (non-Javadoc)\r
@@ -77,10 +77,6 @@ public class NameController extends AnnotatableController<TaxonNameBase, INameSe
                this.service = service;\r
        }\r
        \r
-       @InitBinder\r
-    public void initBinder(WebDataBinder binder) {\r
-               binder.registerCustomEditor(UUID.class, new UUIDPropertyEditor());\r
-       }\r
        \r
        /**\r
      * Get the list of {@link TypeDesignationBase}s of the \r
@@ -93,27 +89,36 @@ public class NameController extends AnnotatableController<TaxonNameBase, INameSe
         * @return a List of {@link TypeDesignationBase} entities which are initialized\r
         *         using the {@link #TYPEDESIGNATION_INIT_STRATEGY}\r
         * @throws IOException\r
-        */\r
-       @RequestMapping(\r
-                       value = {"*/typeDesignations"},\r
-                       method = RequestMethod.GET)\r
-       public List<TypeDesignationBase> doGetNameTypeDesignations(HttpServletRequest request, HttpServletResponse response)throws IOException {\r
+        *///TODO obsolete method?\r
+       @RequestMapping(value = { "typeDesignations" }, method = RequestMethod.GET)\r
+       public List<TypeDesignationBase> doGetNameTypeDesignations(\r
+                       @PathVariable("uuid") UUID uuid, HttpServletRequest request,\r
+                       HttpServletResponse response) throws IOException {\r
+               \r
                logger.info("doGetTypeDesignations()" + request.getServletPath());\r
-               TaxonNameBase tnb = getCdmBase(request, response, null, TaxonNameBase.class);\r
-               Pager<TypeDesignationBase> p = service.getTypeDesignations(tnb, null, null, null, TYPEDESIGNATION_INIT_STRATEGY);\r
+               TaxonNameBase tnb = getCdmBaseInstance(uuid, response,\r
+                               (List<String>) null);\r
+               Pager<TypeDesignationBase> p = service.getTypeDesignations(tnb, null,\r
+                               null, null, TYPEDESIGNATION_INIT_STRATEGY);\r
                return p.getRecords();\r
+               \r
        }\r
        \r
+       //TODO obsolete method?\r
        @RequestMapping(\r
-                       value = {"*/nameCache"},\r
+                       value = {"nameCache"},\r
                        method = RequestMethod.GET)\r
-       public List<String> doGetNameCache(HttpServletRequest request, HttpServletResponse response)throws IOException {\r
-               TaxonNameBase tnb = getCdmBase(request, response, NAME_CACHE_INIT_STRATEGY, TaxonNameBase.class);\r
+       public List<String> doGetNameCache(@PathVariable("uuid") UUID uuid, \r
+                       HttpServletRequest request, HttpServletResponse response)throws IOException {\r
+               \r
+               logger.info("doGetNameCache()" + request.getServletPath());\r
+               TaxonNameBase tnb = getCdmBaseInstance(uuid, response, NAME_CACHE_INIT_STRATEGY);\r
                NonViralName nvn = (NonViralName) tnb;\r
                String nameCacheString = nvn.getNameCache();\r
                List result = new ArrayList<String>();\r
                result.add(nameCacheString);\r
                return result;\r
+               \r
        }\r
        \r
 }\r