X-Git-Url: https://dev.e-taxonomy.eu/gitweb/cdmlib.git/blobdiff_plain/bafda5d1f8edea71f130bbd0bb317fa59d0907c5..ff13d277f53b93453792b5fc2df59f5d13183a74:/cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/NamePortalController.java diff --git a/cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/NamePortalController.java b/cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/NamePortalController.java index 383dc302c0..8fb4af30bb 100644 --- a/cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/NamePortalController.java +++ b/cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/NamePortalController.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -44,12 +44,12 @@ import eu.etaxonomy.cdm.model.name.TypeDesignationBase; * Methods mapped at type level, inherited from super classes ({@link BaseController}): *
* URI: /{datasource-name}/portal/name/{name-uuid} - * + * * Get the {@link TaxonNameBase} instance identified by the {name-uuid}. * The returned TaxonNameBase is initialized by * the following strategy: -- NONE -- *
- * + * * @author a.kohlbecker * @date 24.03.2009 */ @@ -58,93 +58,92 @@ import eu.etaxonomy.cdm.model.name.TypeDesignationBase; @RequestMapping(value = {"/portal/name/{uuid}"}) public class NamePortalController extends BaseController { - - private static final List TYPEDESIGNATION_INIT_STRATEGY = Arrays.asList(new String []{ - "typeName.$", - "typeSpecimen", - "typeStatus.representations", - "typifiedNames", - "citation.authorTeam.$", - "typeSpecimen.media.representations.parts" - }); - - - private static final List NAMEDESCRIPTION_INIT_STRATEGY = Arrays.asList(new String []{ - "uuid", - "feature", - "elements.$", - "elements.multilanguageText", - "elements.media.representations.parts", - "elements.media.title", - }); - - - public NamePortalController(){ - super(); - setInitializationStrategy(Arrays.asList(new String[]{"$"})); //TODO required??? - } - - /* (non-Javadoc) - * @see eu.etaxonomy.cdm.remote.controller.GenericController#setService(eu.etaxonomy.cdm.api.service.IService) - */ - @Autowired - @Override - public void setService(INameService service) { - this.service = service; - } - - @Autowired - private IDescriptionService descriptionService; - - /** - * Get the list of {@link TypeDesignationBase}s of the - * {@link TaxonNameBase} instance identified by the {name-uuid}. - *

- * URI: /{datasource-name}/portal/name/{name-uuid}/typeDesignations - * - * @param request - * @param response - * @return a List of {@link TypeDesignationBase} entities which are initialized - * using the following initialization strategy: - * {@link #TYPEDESIGNATION_INIT_STRATEGY} - * @throws IOException - */ - @SuppressWarnings("unchecked") - @RequestMapping( - value = {"typeDesignations"}, - method = RequestMethod.GET) - public ModelAndView doGetTypeDesignations(@PathVariable("uuid") UUID uuid, - HttpServletRequest request, HttpServletResponse response)throws IOException { - ModelAndView mv = new ModelAndView(); - TaxonNameBase tnb = getCdmBaseInstance(uuid, response, (List)null); - Pager p = service.getTypeDesignations(tnb, null, null, null, TYPEDESIGNATION_INIT_STRATEGY); - mv.addObject(p.getRecords()); - return mv; - } - - /** - * Get the list of {@link TaxonNameDescription}s of the Name associated with the - * {@link TaxonNameBase} instance identified by the {name-uuid}. - *

- * URI: /{datasource-name}/portal/name/{name-uuid}/descriptions - * - * @param request - * @param response - * @return a List of {@link TaxonNameDescription} entities which are initialized - * using the following initialization strategy: - * {@link #NAMEDESCRIPTION_INIT_STRATEGY} - * @throws IOException - */ - @RequestMapping( - value = {"taxonNameDescriptions"}, - method = RequestMethod.GET) - public List doGetNameDescriptions(@PathVariable("uuid") UUID uuid, - HttpServletRequest request, HttpServletResponse response)throws IOException { - logger.info("doGetNameDescriptions()" + request.getServletPath()); - TaxonNameBase tnb = service.load(uuid, null); - Pager p = descriptionService.getTaxonNameDescriptions(tnb, null, null, NAMEDESCRIPTION_INIT_STRATEGY); - return p.getRecords(); - } + + private static final List TYPEDESIGNATION_INIT_STRATEGY = Arrays.asList(new String []{ + "typeName.$", + "typeSpecimen", + "typeStatus.representations", + "typifiedNames", + "citation.authorTeam.$", + "typeSpecimen.media" + }); + + + private static final List NAMEDESCRIPTION_INIT_STRATEGY = Arrays.asList(new String []{ + "uuid", + "feature", + "elements.$", + "elements.multilanguageText", + "elements.media", + }); + + +// public NamePortalController(){ +// super(); +// setInitializationStrategy(Arrays.asList(new String[]{"$"})); //TODO required??? +// } + + /* (non-Javadoc) + * @see eu.etaxonomy.cdm.remote.controller.GenericController#setService(eu.etaxonomy.cdm.api.service.IService) + */ + @Autowired + @Override + public void setService(INameService service) { + this.service = service; + } + + @Autowired + private IDescriptionService descriptionService; + + /** + * Get the list of {@link TypeDesignationBase}s of the + * {@link TaxonNameBase} instance identified by the {name-uuid}. + *

+ * URI: /{datasource-name}/portal/name/{name-uuid}/typeDesignations + * + * @param request + * @param response + * @return a List of {@link TypeDesignationBase} entities which are initialized + * using the following initialization strategy: + * {@link #TYPEDESIGNATION_INIT_STRATEGY} + * @throws IOException + */ + @SuppressWarnings("unchecked") + @RequestMapping( + value = {"typeDesignations"}, + method = RequestMethod.GET) + public ModelAndView doGetTypeDesignations(@PathVariable("uuid") UUID uuid, + HttpServletRequest request, HttpServletResponse response)throws IOException { + ModelAndView mv = new ModelAndView(); + TaxonNameBase tnb = getCdmBaseInstance(uuid, response, (List)null); + Pager p = service.getTypeDesignations(tnb, null, null, null, TYPEDESIGNATION_INIT_STRATEGY); + mv.addObject(p.getRecords()); + return mv; + } + + /** + * Get the list of {@link TaxonNameDescription}s of the Name associated with the + * {@link TaxonNameBase} instance identified by the {name-uuid}. + *

+ * URI: /{datasource-name}/portal/name/{name-uuid}/descriptions + * + * @param request + * @param response + * @return a List of {@link TaxonNameDescription} entities which are initialized + * using the following initialization strategy: + * {@link #NAMEDESCRIPTION_INIT_STRATEGY} + * @throws IOException + */ + @RequestMapping( + value = {"taxonNameDescriptions"}, + method = RequestMethod.GET) + public List doGetNameDescriptions(@PathVariable("uuid") UUID uuid, + HttpServletRequest request, HttpServletResponse response)throws IOException { + logger.info("doGetNameDescriptions()" + request.getServletPath()); + TaxonNameBase tnb = service.load(uuid, null); + Pager p = descriptionService.getTaxonNameDescriptions(tnb, null, null, NAMEDESCRIPTION_INIT_STRATEGY); + return p.getRecords(); + } }