Project

General

Profile

Download (2.53 KB) Statistics
| Branch: | Tag: | Revision:
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 io.swagger.annotations.Api;
13

    
14
import java.util.Arrays;
15
import java.util.List;
16

    
17
import org.apache.log4j.Logger;
18
import org.springframework.beans.factory.annotation.Autowired;
19
import org.springframework.stereotype.Controller;
20
import org.springframework.web.bind.WebDataBinder;
21
import org.springframework.web.bind.annotation.InitBinder;
22
import org.springframework.web.bind.annotation.RequestMapping;
23

    
24
import eu.etaxonomy.cdm.api.service.IClassificationService;
25
import eu.etaxonomy.cdm.database.UpdatableRoutingDataSource;
26
import eu.etaxonomy.cdm.model.name.Rank;
27
import eu.etaxonomy.cdm.model.taxon.Classification;
28
import eu.etaxonomy.cdm.remote.editor.RankPropertyEditor;
29

    
30
/**
31
 * The ClassificationController class is a Spring MVC Controller.
32
 * <p>
33
 * The syntax of the mapped service URIs contains the the {datasource-name} path element.
34
 * The available {datasource-name}s are defined in a configuration file which
35
 * is loaded by the {@link UpdatableRoutingDataSource}. If the
36
 * UpdatableRoutingDataSource is not being used in the actual application
37
 * context any arbitrary {datasource-name} may be used.
38
 * <p>
39
 * @author a.kohlbecker
40
 * @date 20.03.2009
41
 *
42
 * TODO this controller should be a portal controller!!
43
 */
44
@Controller
45
@Api("portal_classification")
46
@RequestMapping(value = {"/portal/classification/{uuid}"})
47
public class ClassificationPortalController extends BaseController<Classification,IClassificationService> {
48

    
49

    
50
    private static final List<String> CLASSIFICATION_INIT_STRATEGY = Arrays.asList(new String[]{
51
            "reference.authorship",
52
            "childNodes"
53
    });
54

    
55
    public static final Logger logger = Logger.getLogger(ClassificationPortalController.class);
56

    
57
    @Override
58
    @Autowired
59
    public void setService(IClassificationService service) {
60
        this.service = service;
61
    }
62

    
63

    
64

    
65
    @InitBinder
66
    @Override
67
    public void initBinder(WebDataBinder binder) {
68
        super.initBinder(binder);
69
        binder.registerCustomEditor(Rank.class, new RankPropertyEditor());
70
    }
71

    
72
    /**
73
     *
74
     */
75
    public ClassificationPortalController() {
76
        super();
77
        setInitializationStrategy(CLASSIFICATION_INIT_STRATEGY);
78
    }
79

    
80

    
81
}
(11-11/63)