optimizing initialization strategies
[cdmlib.git] / cdmlib-remote / src / main / java / eu / etaxonomy / cdm / remote / controller / TaxonomicTreePortalController.java
1 // $Id$
2 /**
3 * Copyright (C) 2009 EDIT European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
9
10 package eu.etaxonomy.cdm.remote.controller;
11
12 import java.util.Arrays;
13 import java.util.List;
14
15 import org.apache.log4j.Logger;
16 import org.springframework.beans.factory.annotation.Autowired;
17 import org.springframework.stereotype.Controller;
18 import org.springframework.web.bind.WebDataBinder;
19 import org.springframework.web.bind.annotation.InitBinder;
20 import org.springframework.web.bind.annotation.RequestMapping;
21
22 import eu.etaxonomy.cdm.api.service.ITaxonTreeService;
23 import eu.etaxonomy.cdm.model.name.Rank;
24 import eu.etaxonomy.cdm.model.taxon.TaxonomicTree;
25 import eu.etaxonomy.cdm.remote.editor.RankPropertyEditor;
26
27 /**
28 * The TaxonomicTreeController class is a Spring MVC Controller.
29 * <p>
30 * The syntax of the mapped service URIs contains the the {datasource-name} path element.
31 * The available {datasource-name}s are defined in a configuration file which
32 * is loaded by the {@link UpdatableRoutingDataSource}. If the
33 * UpdatableRoutingDataSource is not being used in the actual application
34 * context any arbitrary {datasource-name} may be used.
35 * <p>
36 * @author a.kohlbecker
37 * @date 20.03.2009
38 *
39 * TODO this controller should be a portal controller!!
40 */
41 @Controller
42 @RequestMapping(value = {"/portal/taxonTree/{uuid}"})
43 public class TaxonomicTreePortalController extends AnnotatableController<TaxonomicTree,ITaxonTreeService> {
44
45
46 private static final List<String> TAXONTREE_INIT_STRATEGY = Arrays.asList(new String[]{
47 "reference.authorTeam"
48 });
49
50 public static final Logger logger = Logger.getLogger(TaxonomicTreePortalController.class);
51
52 @Autowired
53 public void setService(ITaxonTreeService service) {
54 this.service = service;
55 }
56
57
58
59 @InitBinder
60 public void initBinder(WebDataBinder binder) {
61 binder.registerCustomEditor(Rank.class, new RankPropertyEditor());
62 }
63
64 /**
65 *
66 */
67 public TaxonomicTreePortalController() {
68 super();
69 setInitializationStrategy(TAXONTREE_INIT_STRATEGY);
70 }
71
72
73 }