- binder.registerCustomEditor(UUID.class, new UUIDPropertyEditor());\r
- }\r
-\r
- @RequestMapping(method = RequestMethod.GET)\r
- public DerivedUnitFacade doGet(\r
- @PathVariable("uuid") UUID uuid,\r
- HttpServletRequest request,\r
- HttpServletResponse response) throws IOException {\r
-\r
- logger.info("getGet() - " + request.getServletPath());\r
- DerivedUnitFacade duf = newFacadeFrom(uuid, response, null);\r
- 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(\r
- value = {"collectingareas"},\r
- method = RequestMethod.GET)\r
- public Object doGetCollectingAreas(\r
- @PathVariable("uuid") UUID uuid,\r
- HttpServletRequest request,\r
- HttpServletResponse response) throws IOException {\r
-\r
- logger.info("doGetCollectingAreas() - " + request.getServletPath());\r
- DerivedUnitFacade duf = newFacadeFrom(uuid, \r
- response, \r
- Arrays.asList(new String []{"ecology"}));\r
- return duf.getCollectingAreas();\r
- }\r
- \r
- @RequestMapping(method = RequestMethod.GET, value = "collection")\r
- public Object doGetCollection(\r
- @PathVariable("uuid") UUID uuid,\r
- HttpServletRequest request,\r
- HttpServletResponse response) throws IOException {\r
-\r
- logger.info("doGetCollection() - " + request.getServletPath());\r
- DerivedUnitFacade duf = newFacadeFrom(uuid, \r
- response, \r
- Arrays.asList(new String []{"collection"}));\r
- return duf.getCollection();\r
- }\r
- \r
- \r
- //TODO:\r
- // public Point getExactLocation() => valueProcessor?\r
- \r
-\r
- // public Collection getCollection() {\r
- // public AgentBase getCollector() {\r
- // public DerivedUnitBase getDerivedUnit() {\r
- // public Map<Language, LanguageString> getDerivedUnitDefinitions(){\r
- // public List<Media> getDerivedUnitMedia() {\r
- // public Set<DeterminationEvent> getDeterminations() {\r
- // public Set<Specimen> getDuplicates(){\r
- // public Map<Language, LanguageString> getEcologyAll(){\r
- // public Map<Language, LanguageString> getFieldObjectDefinition() {\r
- // public List<Media> getFieldObjectMedia() {\r
- // public FieldObservation getFieldObservation(){\r
- // public GatheringEvent getGatheringEvent() {\r
- // public String getGatheringEventDescription() {\r
- // public Map<Language, LanguageString> getPlantDescriptionAll(){ ==> representation !!\r
- // public PreservationMethod getPreservationMethod() \r
- // public Set<IdentifiableSource> getSources(){\r
- // public TaxonNameBase getStoredUnder() {\r
-\r
-\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
- if(extendedInitStrategy != null && extendedInitStrategy.size() > 0){\r
- initStrategy.addAll(extendedInitStrategy);\r
- }\r
- SpecimenOrObservationBase<?> sob = service.load(uuid, null);\r
- if(sob instanceof DerivedUnitBase<?>){\r
- try {\r
- return service.getDerivedUnitFacade(((DerivedUnitBase)sob), initStrategy);\r
- } catch (DerivedUnitFacadeNotSupportedException e) {\r
- logger.error(e); //TODO ...\r
- }\r
- } else {\r
- HttpStatusMessage.UUID_REFERENCES_WRONG_TYPE.send(response);\r
- }\r
- return null;\r
- }\r
-\r
- \r
- \r
- \r
- \r
- \r
- \r
- \r
- \r
- \r
+ binder.registerCustomEditor(UUID.class, new UUIDPropertyEditor());\r
+ }\r
+\r
+ @RequestMapping(method = RequestMethod.GET)\r
+ public DerivedUnitFacade doGet(\r
+ @PathVariable("uuid") UUID occurrenceUuid,\r
+ HttpServletRequest request,\r
+ HttpServletResponse response) throws IOException {\r
+\r
+ logger.info("getGet() - " + request.getServletPath());\r
+ DerivedUnitFacade duf = newFacadeFrom(occurrenceUuid, response, null);\r
+ return duf;\r
+ }\r
+\r
+ @RequestMapping(value = {"derivedUnitMedia"}, method = RequestMethod.GET)\r
+ public ModelAndView doGetDerivedUnitMedia(\r
+ @PathVariable("uuid") UUID occurrenceUuid,\r
+ HttpServletRequest request,\r
+ HttpServletResponse response) throws IOException {\r
+\r
+ logger.info("doGetDerivedUnitMedia() - " + request.getServletPath());\r
+ ModelAndView mv = new ModelAndView();\r
+ DerivedUnitFacade duf = newFacadeFrom(occurrenceUuid, response,Arrays.asList(new String []{\r
+ "derivedUnitMedia", "derivedUnitMedia.title"}));\r
+ if(duf != null){\r
+ mv.addObject(duf.getDerivedUnitMedia());\r
+ }\r
+ return mv;\r
+ }\r
+\r
+ @RequestMapping(value = {"fieldObjectMedia"}, method = RequestMethod.GET)\r
+ public ModelAndView doGetFieldObjectMedia(\r
+ @PathVariable("uuid") UUID occurrenceUuid,\r
+ HttpServletRequest request,\r
+ HttpServletResponse response) throws IOException {\r
+\r
+ logger.info("doGetFieldObjectMedia() - " + request.getServletPath());\r
+ ModelAndView mv = new ModelAndView();\r
+ DerivedUnitFacade duf = newFacadeFrom(occurrenceUuid, response,Arrays.asList(new String []{\r
+ "fieldObjectMedia", "fieldObjectMedia.title"}));\r
+ mv.addObject(duf.getFieldObjectMedia());\r
+ return mv;\r
+ }\r
+\r
+// TODO\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 occurrenceUuid,\r
+ HttpServletRequest request,\r
+ HttpServletResponse response) throws IOException {\r
+\r
+ logger.info("doGetCollectingAreas() - " + request.getServletPath());\r
+ DerivedUnitFacade duf = newFacadeFrom(occurrenceUuid,\r
+ response,\r
+ Arrays.asList(new String []{"ecology"}));\r
+ return duf.getCollectingAreas();\r
+ }\r
+\r
+ @RequestMapping(method = RequestMethod.GET, value = "collection")\r
+ public Object doGetCollection(\r
+ @PathVariable("uuid") UUID uuid,\r
+ HttpServletRequest request,\r
+ HttpServletResponse response) throws IOException {\r
+\r
+ logger.info("doGetCollection() - " + request.getServletPath());\r
+ DerivedUnitFacade duf = newFacadeFrom(uuid,\r
+ response,\r
+ Arrays.asList(new String []{"collection"}));\r
+ return duf.getCollection();\r
+ }\r
+\r
+\r
+ //TODO:\r
+ // public Point getExactLocation() => valueProcessor?\r
+\r
+\r
+ // public Collection getCollection() {\r
+ // public AgentBase getCollector() {\r
+ // public DerivedUnitBase getDerivedUnit() {\r
+ // public Map<Language, LanguageString> getDerivedUnitDefinitions(){\r
+ // public List<Media> getDerivedUnitMedia() {\r
+ // public Set<DeterminationEvent> getDeterminations() {\r
+ // public Set<Specimen> getDuplicates(){\r
+ // public Map<Language, LanguageString> getEcologyAll(){\r
+ // public Map<Language, LanguageString> getFieldObjectDefinition() {\r
+ // public List<Media> getFieldObjectMedia() {\r
+ // public FieldObservation getFieldObservation(){\r
+ // public GatheringEvent getGatheringEvent() {\r
+ // public String getGatheringEventDescription() {\r
+ // public Map<Language, LanguageString> getPlantDescriptionAll(){ ==> representation !!\r
+ // public PreservationMethod getPreservationMethod()\r
+ // public Set<IdentifiableSource> getSources(){\r
+ // public TaxonNameBase getStoredUnder() {\r
+\r
+\r
+ /**\r
+ * @param occurrenceUuid\r
+ * @param response\r
+ * @param extendedInitStrategy\r
+ * @return the requesed <code>DerivedUnitFacade</code> instance or <code>null</code>\r
+ * @throws IOException\r
+ */\r
+ private DerivedUnitFacade newFacadeFrom(UUID occurrenceUuid, HttpServletResponse response, List<String> extendedInitStrategy)\r
+ throws IOException {\r
+ List<String> initStrategy = new ArrayList<String>(initializationStrategy);\r
+ if(extendedInitStrategy != null && extendedInitStrategy.size() > 0){\r
+ initStrategy.addAll(extendedInitStrategy);\r
+ }\r
+ SpecimenOrObservationBase<?> sob = service.load(occurrenceUuid, null);\r
+ if(sob instanceof DerivedUnitBase<?>){\r
+ try {\r
+ return service.getDerivedUnitFacade(((DerivedUnitBase)sob), initStrategy);\r
+ } catch (DerivedUnitFacadeNotSupportedException e) {\r
+ logger.error(e); //TODO ...\r
+ }\r
+ } else {\r
+ HttpStatusMessage.UUID_REFERENCES_WRONG_TYPE.send(response);\r
+ }\r
+ return null;\r
+ }\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r