3 * Copyright (C) 2009 EDIT European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.remote
.controller
;
12 import java
.io
.IOException
;
14 import java
.net
.URISyntaxException
;
15 import java
.util
.Arrays
;
16 import java
.util
.List
;
17 import java
.util
.UUID
;
18 import java
.util
.regex
.Matcher
;
19 import java
.util
.regex
.Pattern
;
21 import javax
.servlet
.http
.HttpServletRequest
;
22 import javax
.servlet
.http
.HttpServletResponse
;
24 import org
.apache
.log4j
.Logger
;
25 import org
.springframework
.beans
.factory
.annotation
.Autowired
;
26 import org
.springframework
.stereotype
.Controller
;
27 import org
.springframework
.web
.bind
.WebDataBinder
;
28 import org
.springframework
.web
.bind
.annotation
.InitBinder
;
29 import org
.springframework
.web
.bind
.annotation
.RequestMapping
;
30 import org
.springframework
.web
.bind
.annotation
.RequestMethod
;
32 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonService
;
33 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonTreeService
;
34 import eu
.etaxonomy
.cdm
.api
.service
.ITermService
;
35 import eu
.etaxonomy
.cdm
.database
.UpdatableRoutingDataSource
;
36 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
37 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
38 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
39 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
40 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
41 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonomicTree
;
42 import eu
.etaxonomy
.cdm
.remote
.editor
.RankPropertyEditor
;
43 import eu
.etaxonomy
.cdm
.remote
.editor
.UUIDPropertyEditor
;
44 import eu
.etaxonomy
.cdm
.strategy
.exceptions
.UnknownCdmTypeException
;
47 * The TaxonomicTreeController class is a Spring MVC Controller.
49 * The syntax of the mapped service URIs contains the the {datasource-name} path element.
50 * The available {datasource-name}s are defined in a configuration file which
51 * is loaded by the {@link UpdatableRoutingDataSource}. If the
52 * UpdatableRoutingDataSource is not being used in the actual application
53 * context any arbitrary {datasource-name} may be used.
55 * @author a.kohlbecker
58 * TODO this controller should be a portal controller!!
61 @RequestMapping(value
= {"/portal/taxontree/{uuid}"})
62 public class TaxonomicTreePortalController
extends AnnotatableController
<TaxonomicTree
,ITaxonTreeService
> {
65 private static final List
<String
> TAXONTREE_INIT_STRATEGY
= Arrays
.asList(new String
[]{
66 "reference.authorTeam.titleCache"
69 public static final Logger logger
= Logger
.getLogger(TaxonomicTreePortalController
.class);
72 public void setService(ITaxonTreeService service
) {
73 this.service
= service
;
79 public void initBinder(WebDataBinder binder
) {
80 binder
.registerCustomEditor(Rank
.class, new RankPropertyEditor());
86 public TaxonomicTreePortalController() {
88 setInitializationStrategy(TAXONTREE_INIT_STRATEGY
);