Project

General

Profile

Download (2.83 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10

    
11
package eu.etaxonomy.cdm.remote.controller;
12

    
13
import java.io.IOException;
14
import java.util.Arrays;
15
import java.util.List;
16
import java.util.UUID;
17

    
18
import javax.servlet.http.HttpServletRequest;
19
import javax.servlet.http.HttpServletResponse;
20

    
21
import org.apache.log4j.Logger;
22
import org.springframework.beans.factory.annotation.Autowired;
23
import org.springframework.stereotype.Component;
24

    
25
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
26
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
27
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
28

    
29
/**
30
 * This class once was a controller but is no longer needed as such.
31
 * The cdmlib-print project however still relies on this class being present to
32
 * access its methods directly, but is not using it as controller, though
33
 *
34
 *
35
 * @author n.hoffmann
36
 * @created Apr 8, 2010
37
 *
38
 * @deprecated only used by cdmlib-print in an unorthodox way to get cdm entities as xml
39
 */
40
@Deprecated
41
@Component
42
public class TaxonNodePrintAppController extends AbstractController<TaxonNode, ITaxonNodeService> {
43
    @SuppressWarnings("unused")
44
    private static final Logger logger = Logger.getLogger(TaxonNodePrintAppController.class);
45

    
46

    
47
    private static final List<String> NODE_INIT_STRATEGY = Arrays.asList(new String[]{
48
            "taxon.sec",
49
            "taxon.name"
50
    });
51

    
52

    
53
    private ITaxonNodeService service;
54

    
55
    /* (non-Javadoc)
56
     * @see eu.etaxonomy.cdm.remote.controller.AbstractListController#setService(eu.etaxonomy.cdm.api.service.IService)
57
     */
58
    @Override
59
    @Autowired
60
    public void setService(ITaxonNodeService service) {
61
        this.service = service;
62
    }
63

    
64
    /**
65
     * @param treeUuid
66
     * @param response
67
     * @return
68
     * @throws IOException
69
     *
70
     * @deprecated use the TaxonNodeController.doPageChildNodes() instead,
71
     *  has no request mapping to avoid conflicts with that method
72
     */
73
    @Deprecated
74
    public List<TaxonNode> getChildNodes(
75
           UUID taxonNodeUuid,
76
            HttpServletResponse response
77
            ) throws IOException {
78

    
79
        TaxonNode taxonNode = service.find(taxonNodeUuid);
80

    
81
        return service.loadChildNodesOfTaxonNode(taxonNode, NODE_INIT_STRATEGY, false, null);
82
    }
83

    
84
    public TaxonNode doGet(UUID taxonNodeUuid, HttpServletRequest request, HttpServletResponse response
85
            ) throws IOException {
86
        return service.load(taxonNodeUuid, getInitializationStrategy());
87
    }
88

    
89
    public TaxonBase doGetTaxon(UUID taxonNodeUuid) throws IOException {
90
        TaxonNode taxonNode = service.load(taxonNodeUuid, getInitializationStrategy());
91
        return taxonNode.getTaxon();
92
    }
93

    
94

    
95
}
(57-57/63)