1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* 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 1.1
|
7
|
* 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.io.IOException;
|
13
|
import java.util.Arrays;
|
14
|
import java.util.List;
|
15
|
import java.util.UUID;
|
16
|
|
17
|
import javax.servlet.http.HttpServletRequest;
|
18
|
import javax.servlet.http.HttpServletResponse;
|
19
|
|
20
|
import org.apache.log4j.Logger;
|
21
|
import org.springframework.beans.factory.annotation.Autowired;
|
22
|
import org.springframework.stereotype.Component;
|
23
|
|
24
|
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
|
25
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
26
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
27
|
|
28
|
/**
|
29
|
* This class once was a controller but is no longer needed as such.
|
30
|
* The cdmlib-print project however still relies on this class being present to
|
31
|
* access its methods directly, but is not using it as controller, though
|
32
|
*
|
33
|
*
|
34
|
* @author n.hoffmann
|
35
|
* @since Apr 8, 2010
|
36
|
*
|
37
|
* @deprecated only used by cdmlib-print in an unorthodox way to get cdm entities as xml
|
38
|
*/
|
39
|
@Deprecated
|
40
|
@Component
|
41
|
public class TaxonNodePrintAppController extends AbstractController<TaxonNode, ITaxonNodeService> {
|
42
|
@SuppressWarnings("unused")
|
43
|
private static final Logger logger = Logger.getLogger(TaxonNodePrintAppController.class);
|
44
|
|
45
|
|
46
|
private static final List<String> NODE_INIT_STRATEGY = Arrays.asList(new String[]{
|
47
|
"taxon.secSource.citation",
|
48
|
"taxon.name"
|
49
|
});
|
50
|
|
51
|
|
52
|
private ITaxonNodeService service;
|
53
|
|
54
|
@Override
|
55
|
@Autowired
|
56
|
public void setService(ITaxonNodeService service) {
|
57
|
this.service = service;
|
58
|
}
|
59
|
|
60
|
/**
|
61
|
* @param treeUuid
|
62
|
* @param response
|
63
|
* @return
|
64
|
* @throws IOException
|
65
|
*
|
66
|
* @deprecated use the TaxonNodeController.doPageChildNodes() instead,
|
67
|
* has no request mapping to avoid conflicts with that method
|
68
|
*/
|
69
|
@Deprecated
|
70
|
public List<TaxonNode> getChildNodes(
|
71
|
UUID taxonNodeUuid, boolean includeUnpublished,
|
72
|
HttpServletResponse response
|
73
|
) throws IOException {
|
74
|
|
75
|
TaxonNode taxonNode = service.find(taxonNodeUuid);
|
76
|
|
77
|
return service.loadChildNodesOfTaxonNode(taxonNode, NODE_INIT_STRATEGY, false, includeUnpublished, null);
|
78
|
}
|
79
|
|
80
|
public TaxonNode doGet(UUID taxonNodeUuid, HttpServletRequest request, HttpServletResponse response
|
81
|
) throws IOException {
|
82
|
return service.load(taxonNodeUuid, getInitializationStrategy());
|
83
|
}
|
84
|
|
85
|
public TaxonBase doGetTaxon(UUID taxonNodeUuid) throws IOException {
|
86
|
TaxonNode taxonNode = service.load(taxonNodeUuid, getInitializationStrategy());
|
87
|
return taxonNode.getTaxon();
|
88
|
}
|
89
|
|
90
|
|
91
|
}
|