fixing MediaAutoInitializer & fixing bug in AbstractBeanInitializer
[cdmlib.git] / cdmlib-remote / src / main / java / eu / etaxonomy / cdm / remote / controller / PolytomousKeyPortalController.java
1 // $Id$
2 /**
3 * Copyright (C) 2009 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
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.
9 */
10 package eu.etaxonomy.cdm.remote.controller;
11
12 import java.io.IOException;
13 import java.util.ArrayList;
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.Controller;
23 import org.springframework.web.bind.annotation.PathVariable;
24 import org.springframework.web.bind.annotation.RequestMapping;
25 import org.springframework.web.servlet.ModelAndView;
26
27 import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
28 import eu.etaxonomy.cdm.model.description.PolytomousKey;
29
30 /**
31 * @author a.kohlbecker
32 * @date 24.03.2011
33 * @Deprecated ONLY FOR TESTING PURPOSES
34 */
35 @Deprecated
36 @Controller
37 @RequestMapping(value = {"/portal/polytomousKey/{uuid}"})
38 public class PolytomousKeyPortalController extends BaseController<PolytomousKey, IPolytomousKeyService> {
39 public static final Logger logger = Logger.getLogger(PolytomousKeyPortalController.class);
40
41 @Autowired
42 public void setService(IPolytomousKeyService service) {
43 this.service = service;
44 }
45
46 /**
47 * @param uuid
48 * @param request
49 * @param response
50 * @return
51 * @throws IOException
52 * @Deprecated ONLY FOR TESTING PURPOSES
53 */
54 @Deprecated
55 @RequestMapping(value = {"loadWithNodes"})
56 public ModelAndView doLoadWithNodes(
57 @PathVariable("uuid") UUID uuid,
58 HttpServletRequest request,
59 HttpServletResponse response) throws IOException {
60
61 logger.info("doLoadWithNodes() - " + request.getServletPath());
62
63 ModelAndView mv = new ModelAndView();
64
65 List<String> nodePaths = new ArrayList<String>();
66 nodePaths.add("subkey");
67 nodePaths.add("taxon.name.nomenclaturalReference");
68
69 List<String> propertyPaths = new ArrayList<String>();
70 propertyPaths.add("sources");
71 propertyPaths.add("annotations");
72
73 PolytomousKey key = service.loadWithNodes(uuid, propertyPaths, nodePaths);
74 mv.addObject(key);
75 return mv;
76
77 }
78
79 }
80