X-Git-Url: https://dev.e-taxonomy.eu/gitweb/cdmlib.git/blobdiff_plain/dcdd69ca733cbdb4b5ebbf9fe2cf244fdfa7531a..305e7252c6eb73a0a0f823fb6c3ea505d39f452e:/cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/DerivedUnitFacadeController.java diff --git a/cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/DerivedUnitFacadeController.java b/cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/DerivedUnitFacadeController.java index 0cf41e70f7..927c1f253c 100644 --- a/cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/DerivedUnitFacadeController.java +++ b/cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/DerivedUnitFacadeController.java @@ -25,10 +25,12 @@ import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException; import eu.etaxonomy.cdm.api.service.IOccurrenceService; +import eu.etaxonomy.cdm.model.media.Media; import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase; import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; import eu.etaxonomy.cdm.remote.editor.UUIDPropertyEditor; @@ -66,8 +68,39 @@ public class DerivedUnitFacadeController extends AbstractController{ return duf; } + @RequestMapping(value = {"derivedUnitMedia"}, method = RequestMethod.GET) + public ModelAndView doGetDerivedUnitMedia( + @PathVariable("uuid") UUID uuid, + HttpServletRequest request, + HttpServletResponse response) throws IOException { + + logger.info("doGetDerivedUnitMedia() - " + request.getServletPath()); + ModelAndView mv = new ModelAndView(); + DerivedUnitFacade duf = newFacadeFrom(uuid, response,Arrays.asList(new String []{ + "derivedUnitMedia.representations.parts", "derivedUnitMedia.title"})); + mv.addObject(duf.getDerivedUnitMedia()); + return mv; + } + + @RequestMapping(value = {"fieldObjectMedia"}, method = RequestMethod.GET) + public ModelAndView doGetFieldObjectMedia( + @PathVariable("uuid") UUID uuid, + HttpServletRequest request, + HttpServletResponse response) throws IOException { + + logger.info("doGetFieldObjectMedia() - " + request.getServletPath()); + ModelAndView mv = new ModelAndView(); + DerivedUnitFacade duf = newFacadeFrom(uuid, response,Arrays.asList(new String []{ + "fieldObjectMedia.representations.parts", "fieldObjectMedia.title"})); + mv.addObject(duf.getFieldObjectMedia()); + return mv; + } + // TODO - @RequestMapping(method = RequestMethod.GET, value = "{uuid}/collectingareas") + //@RequestMapping(method = RequestMethod.GET, value = "{uuid}/collectingareas") + @RequestMapping( + value = {"collectingareas"}, + method = RequestMethod.GET) public Object doGetCollectingAreas( @PathVariable("uuid") UUID uuid, HttpServletRequest request, @@ -80,7 +113,7 @@ public class DerivedUnitFacadeController extends AbstractController{ return duf.getCollectingAreas(); } - @RequestMapping(method = RequestMethod.GET, value = "{uuid}/collection") + @RequestMapping(method = RequestMethod.GET, value = "collection") public Object doGetCollection( @PathVariable("uuid") UUID uuid, HttpServletRequest request, @@ -119,7 +152,7 @@ public class DerivedUnitFacadeController extends AbstractController{ private DerivedUnitFacade newFacadeFrom(UUID uuid, HttpServletResponse response, List extendedInitStrategy) throws IOException { - List initStrategy = new ArrayList(DEFAULT_INIT_STRATEGY); + List initStrategy = new ArrayList(initializationStrategy); if(extendedInitStrategy != null && extendedInitStrategy.size() > 0){ initStrategy.addAll(extendedInitStrategy); }