3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.cdm
.remote
.controller
;
13 import java
.io
.IOException
;
14 import java
.util
.Arrays
;
15 import java
.util
.List
;
16 import java
.util
.UUID
;
18 import javax
.servlet
.http
.HttpServletResponse
;
20 import org
.apache
.log4j
.Logger
;
21 import org
.springframework
.beans
.factory
.annotation
.Autowired
;
22 import org
.springframework
.stereotype
.Controller
;
23 import org
.springframework
.web
.bind
.WebDataBinder
;
24 import org
.springframework
.web
.bind
.annotation
.InitBinder
;
25 import org
.springframework
.web
.bind
.annotation
.PathVariable
;
26 import org
.springframework
.web
.bind
.annotation
.RequestMapping
;
27 import org
.springframework
.web
.bind
.annotation
.RequestMethod
;
29 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonNodeService
;
30 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
31 import eu
.etaxonomy
.cdm
.remote
.editor
.UUIDPropertyEditor
;
35 * @created Apr 8, 2010
39 public class TaxonNodeListController
extends BaseListController
<TaxonNode
, ITaxonNodeService
> {
40 private static final Logger logger
= Logger
41 .getLogger(TaxonNodeListController
.class);
44 private static final List
<String
> NODE_INIT_STRATEGY
= Arrays
.asList(new String
[]{
46 "taxon.name.taggedName",
47 "taxon.name.titleCache"
51 private ITaxonNodeService service
;
54 * @see eu.etaxonomy.cdm.remote.controller.AbstractListController#setService(eu.etaxonomy.cdm.api.service.IService)
58 public void setService(ITaxonNodeService service
) {
59 this.service
= service
;
63 public void initBinder(WebDataBinder binder
) {
64 binder
.registerCustomEditor(UUID
.class, new UUIDPropertyEditor());
74 value
= {"/taxonNode/{taxonNodeUuid}/childNodes/"},
75 method
= RequestMethod
.GET
)
76 public List
<TaxonNode
> getChildNodes(
77 @PathVariable("taxonNodeUuid") UUID taxonNodeUuid
,
78 HttpServletResponse response
79 ) throws IOException
{
81 TaxonNode taxonNode
= service
.getTaxonNodeByUuid(taxonNodeUuid
);
83 return service
.loadChildNodesOfTaxonNode(taxonNode
, NODE_INIT_STRATEGY
);