harmonizing webservice paths
[cdmlib.git] / cdmlib-remote / src / main / java / eu / etaxonomy / cdm / remote / controller / DescriptionListController.java
1 // $Id$
2 /**
3 * Copyright (C) 2009 EDIT 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
7 * 1.1 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
16 import javax.servlet.http.HttpServletRequest;
17 import javax.servlet.http.HttpServletResponse;
18
19 import org.springframework.beans.factory.annotation.Autowired;
20 import org.springframework.stereotype.Controller;
21 import org.springframework.web.bind.annotation.RequestMapping;
22 import org.springframework.web.bind.annotation.RequestMethod;
23
24 import eu.etaxonomy.cdm.api.service.IDescriptionService;
25 import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
26 import eu.etaxonomy.cdm.model.description.DescriptionBase;
27 import eu.etaxonomy.cdm.model.description.FeatureTree;
28
29 /**
30 * TODO write controller documentation
31 *
32 * @author a.kohlbecker
33 * @date 24.03.2009
34 */
35 @Controller
36 @RequestMapping(value = {"/description"})
37 public class DescriptionListController extends BaseListController<DescriptionBase, IDescriptionService> {
38
39 @Autowired
40 private IFeatureTreeService featureTreeService;
41
42 private static final List<String> FEATURETREE_INIT_STRATEGY = Arrays.asList(
43 new String[]{
44 "representations",
45 "root.feature.representations",
46 "root.children.feature.representations"
47 });
48
49 /* (non-Javadoc)
50 * @see eu.etaxonomy.cdm.remote.controller.BaseListController#setService(eu.etaxonomy.cdm.api.service.IService)
51 */
52 @Override
53 @Autowired
54 public void setService(IDescriptionService service) {
55 this.service = service;
56 }
57
58 @RequestMapping(method = RequestMethod.GET, value="/featureTree")
59 public List<FeatureTree> doGetFeatureTrees(HttpServletRequest request, HttpServletResponse response) throws IOException {
60
61 List<FeatureTree> obj = featureTreeService.list(null,null,null,null,FEATURETREE_INIT_STRATEGY);
62 return obj;
63 }
64 }