2 * Copyright (C) 2013 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.cdm
.remote
.controller
;
11 import io
.swagger
.annotations
.Api
;
13 import java
.io
.IOException
;
14 import java
.util
.ArrayList
;
15 import java
.util
.Arrays
;
16 import java
.util
.List
;
17 import java
.util
.UUID
;
19 import javax
.persistence
.EntityNotFoundException
;
20 import javax
.servlet
.http
.HttpServletRequest
;
21 import javax
.servlet
.http
.HttpServletResponse
;
23 import org
.apache
.log4j
.Logger
;
24 import org
.springframework
.stereotype
.Controller
;
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
.model
.description
.FeatureTree
;
32 * @author a.kohlbecker
37 @Api("portal_featureTree")
38 @RequestMapping(value
= {"/portal/featureTree/{uuid}"})
39 public class FeatureTreePortalController
extends FeatureTreeController
{
41 public static final Logger logger
= Logger
.getLogger(FeatureTreePortalController
.class);
44 private static final List
<String
> FEATURETREE_INIT_STRATEGY
= Arrays
.asList(
49 private List
<String
> featuretreeNodeInitStrategy
= null;
51 public FeatureTreePortalController() {
52 setInitializationStrategy(FEATURETREE_INIT_STRATEGY
);
54 featuretreeNodeInitStrategy
= new ArrayList
<String
>(2);
55 // featuretreeNodeInitStrategy.add("representations");
56 featuretreeNodeInitStrategy
.add("feature.representations");
60 @RequestMapping(method
= RequestMethod
.GET
)
61 public FeatureTree
doGet(@PathVariable("uuid") UUID uuid
,
62 HttpServletRequest request
,
63 HttpServletResponse response
) throws IOException
{
65 logger
.info("doGet() " + request
.getRequestURI());
67 FeatureTree featureTree
= null;
69 featureTree
= service
.loadWithNodes(uuid
, getInitializationStrategy(), featuretreeNodeInitStrategy
);
70 } catch(EntityNotFoundException e
){
71 HttpStatusMessage
.UUID_NOT_FOUND
.send(response
);