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
.HttpServletRequest
;
19 import javax
.servlet
.http
.HttpServletResponse
;
21 import org
.springframework
.beans
.factory
.annotation
.Autowired
;
22 import org
.springframework
.stereotype
.Controller
;
23 import org
.springframework
.web
.bind
.annotation
.RequestMapping
;
24 import org
.springframework
.web
.bind
.annotation
.RequestMethod
;
26 import eu
.etaxonomy
.cdm
.api
.service
.AnnotatableServiceBase
;
27 import eu
.etaxonomy
.cdm
.api
.service
.IDescriptionService
;
28 import eu
.etaxonomy
.cdm
.api
.service
.pager
.Pager
;
29 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionBase
;
30 import eu
.etaxonomy
.cdm
.model
.description
.FeatureTree
;
31 import eu
.etaxonomy
.cdm
.model
.description
.TaxonDescription
;
32 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
33 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
34 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.IAnnotatableDao
;
37 * @author a.kohlbecker
42 @RequestMapping(value
= {"/*/description/*","/*/description/annotation/*", "/*/featuretree/*"})
43 public class DescriptionController
extends AnnotatableController
<DescriptionBase
, IDescriptionService
>
46 public DescriptionController(){
48 setUuidParameterPattern("^/(?:[^/]+)/(?:[^/]+)/([^/?#&\\.]+).*");
51 private static final List
<String
> FEATURETREE_INIT_STRATEGY
= Arrays
.asList(
54 "root.feature.representations",
55 "root.children.feature.representations",
56 //TODO implement recursive INIT_STRATEGY for children e.g:
57 // "root.children{<children;limit=0}.feature.representations",
62 * @see eu.etaxonomy.cdm.remote.controller.GenericController#setService(eu.etaxonomy.cdm.api.service.IService)
66 public void setService(IDescriptionService service
) {
67 this.service
= service
;
71 value
= {"/*/featuretree/*"},
72 method
= RequestMethod
.GET
)
73 public FeatureTree
doGetFeatureTree(HttpServletRequest request
, HttpServletResponse response
)throws IOException
{
74 UUID featureTreeUuid
= readValueUuid(request
, null);
75 FeatureTree featureTree
= service
.loadFeatureTree(featureTreeUuid
, FEATURETREE_INIT_STRATEGY
);
76 if(featureTree
== null){
77 HttpStatusMessage
.UUID_NOT_FOUND
.send(response
);