*print redlist status from congruent concept relations
[cdmlib.git] / cdmlib-remote / src / main / java / eu / etaxonomy / cdm / remote / controller / DerivedUnitFacadeController.java
index 0cf41e70f736935e2e288344bb469799a305d888..927c1f253c940b1e09a386351b419ca37dd5fd71 100644 (file)
@@ -25,10 +25,12 @@ import org.springframework.web.bind.annotation.InitBinder;
 import org.springframework.web.bind.annotation.PathVariable;\r
 import org.springframework.web.bind.annotation.RequestMapping;\r
 import org.springframework.web.bind.annotation.RequestMethod;\r
+import org.springframework.web.servlet.ModelAndView;\r
 \r
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;\r
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;\r
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;\r
+import eu.etaxonomy.cdm.model.media.Media;\r
 import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;\r
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;\r
 import eu.etaxonomy.cdm.remote.editor.UUIDPropertyEditor;\r
@@ -66,8 +68,39 @@ public class DerivedUnitFacadeController extends AbstractController{
                return duf;\r
        }\r
        \r
+       @RequestMapping(value = {"derivedUnitMedia"}, method = RequestMethod.GET)\r
+       public ModelAndView doGetDerivedUnitMedia(\r
+               @PathVariable("uuid") UUID uuid,\r
+               HttpServletRequest request,\r
+               HttpServletResponse response) throws IOException {\r
+\r
+               logger.info("doGetDerivedUnitMedia() - " + request.getServletPath());\r
+               ModelAndView mv = new ModelAndView();\r
+               DerivedUnitFacade duf = newFacadeFrom(uuid, response,Arrays.asList(new String []{\r
+                               "derivedUnitMedia.representations.parts", "derivedUnitMedia.title"}));\r
+               mv.addObject(duf.getDerivedUnitMedia());\r
+               return mv;\r
+       }\r
+       \r
+       @RequestMapping(value = {"fieldObjectMedia"}, method = RequestMethod.GET)\r
+       public ModelAndView doGetFieldObjectMedia(\r
+               @PathVariable("uuid") UUID uuid,\r
+               HttpServletRequest request,\r
+               HttpServletResponse response) throws IOException {\r
+\r
+               logger.info("doGetFieldObjectMedia() - " + request.getServletPath());\r
+               ModelAndView mv = new ModelAndView();\r
+               DerivedUnitFacade duf = newFacadeFrom(uuid, response,Arrays.asList(new String []{\r
+                               "fieldObjectMedia.representations.parts", "fieldObjectMedia.title"}));\r
+               mv.addObject(duf.getFieldObjectMedia());\r
+               return mv;\r
+       }\r
+       \r
 // TODO        \r
-       @RequestMapping(method = RequestMethod.GET, value = "{uuid}/collectingareas")\r
+       //@RequestMapping(method = RequestMethod.GET, value = "{uuid}/collectingareas")\r
+               @RequestMapping(\r
+                       value = {"collectingareas"},\r
+                       method = RequestMethod.GET)\r
        public Object doGetCollectingAreas(\r
                        @PathVariable("uuid") UUID uuid,\r
                        HttpServletRequest request,\r
@@ -80,7 +113,7 @@ public class DerivedUnitFacadeController extends AbstractController{
                return duf.getCollectingAreas();\r
        }\r
        \r
-       @RequestMapping(method = RequestMethod.GET, value = "{uuid}/collection")\r
+       @RequestMapping(method = RequestMethod.GET, value = "collection")\r
        public Object doGetCollection(\r
                        @PathVariable("uuid") UUID uuid,\r
                        HttpServletRequest request,\r
@@ -119,7 +152,7 @@ public class DerivedUnitFacadeController extends AbstractController{
 \r
        private DerivedUnitFacade newFacadeFrom(UUID uuid, HttpServletResponse response, List<String> extendedInitStrategy)\r
        throws IOException {\r
-               List<String> initStrategy = new ArrayList<String>(DEFAULT_INIT_STRATEGY);\r
+               List<String> initStrategy = new ArrayList<String>(initializationStrategy);\r
                if(extendedInitStrategy != null && extendedInitStrategy.size() > 0){\r
                        initStrategy.addAll(extendedInitStrategy);\r
                }\r