merged trunk into branch
[cdmlib.git] / cdmlib-remote / src / main / java / eu / etaxonomy / cdm / remote / controller / ClassificationPortalController.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.IClassificationService;
23 import eu.etaxonomy.cdm.database.UpdatableRoutingDataSource;
24 import eu.etaxonomy.cdm.model.name.Rank;
25 import eu.etaxonomy.cdm.model.taxon.Classification;
26 import eu.etaxonomy.cdm.remote.editor.RankPropertyEditor;
27
28 /**
29 * The ClassificationController class is a Spring MVC Controller.
30 * <p>
31 * The syntax of the mapped service URIs contains the the {datasource-name} path element.
32 * The available {datasource-name}s are defined in a configuration file which
33 * is loaded by the {@link UpdatableRoutingDataSource}. If the
34 * UpdatableRoutingDataSource is not being used in the actual application
35 * context any arbitrary {datasource-name} may be used.
36 * <p>
37 * @author a.kohlbecker
38 * @date 20.03.2009
39 *
40 * TODO this controller should be a portal controller!!
41 */
42 @Controller
43 @RequestMapping(value = {"/portal/classification/{uuid}"})
44 public class ClassificationPortalController extends BaseController<Classification,IClassificationService> {
45
46
47 private static final List<String> CLASSIFICATION_INIT_STRATEGY = Arrays.asList(new String[]{
48 "reference.authorTeam",
49 "childNodes"
50 });
51
52 public static final Logger logger = Logger.getLogger(ClassificationPortalController.class);
53
54 @Override
55 @Autowired
56 public void setService(IClassificationService service) {
57 this.service = service;
58 }
59
60
61
62 @InitBinder
63 @Override
64 public void initBinder(WebDataBinder binder) {
65 super.initBinder(binder);
66 binder.registerCustomEditor(Rank.class, new RankPropertyEditor());
67 }
68
69 /**
70 *
71 */
72 public ClassificationPortalController() {
73 super();
74 setInitializationStrategy(CLASSIFICATION_INIT_STRATEGY);
75 }
76
77
78 }