documentation and improved BaseListController
[cdmlib.git] / cdmlib-remote / src / main / java / eu / etaxonomy / cdm / remote / controller / AgentController.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 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
11 package eu.etaxonomy.cdm.remote.controller;
12
13 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.stereotype.Controller;
15 import org.springframework.web.bind.annotation.RequestMapping;
16
17 import eu.etaxonomy.cdm.api.service.IAgentService;
18 import eu.etaxonomy.cdm.api.service.pager.Pager;
19 import eu.etaxonomy.cdm.database.UpdatableRoutingDataSource;
20 import eu.etaxonomy.cdm.model.agent.AgentBase;
21 import eu.etaxonomy.cdm.model.common.Annotation;
22
23 /**
24 * The AgentController class is a Spring MVC Controller.
25 * <p>
26 * The syntax of the mapped service URIs contains the the {datasource-name} path element.
27 * The available {datasource-name}s are defined in a configuration file which
28 * is loaded by the {@link UpdatableRoutingDataSource}. If the
29 * UpdatableRoutingDataSource is not being used in the actual application
30 * context any arbitrary {datasource-name} may be used.
31 * <p>
32 * Methods mapped at type level, inherited from super classes ({@link BaseController}):
33 * <blockquote>
34 * URI: <b>&#x002F;{datasource-name}&#x002F;agent&#x002F;name&#x002F;{agent-uuid}</b>
35 *
36 * Get the {@link AgentBase} instance identified by the <code>{agent-uuid}</code>.
37 * The returned AgentBase is initialized by
38 * the default initialization strategy: {@link #DEFAULT_INIT_STRATEGY}
39 * </blockquote>
40 * <blockquote>
41 * URI: <b>&#x002F;{datasource-name}&#x002F;agent&#x002F;name&#x002F;{agent-uuid}&#x002F;annotation</b>
42 *
43 * Returns a {@link Pager} on the {@link Annotation}s for the {@link AgentBase} instance identified by the
44 * <code>{agent-uuid}</code>.
45 * The returned AgentBase instances are initialized by
46 * the following strategy: {@link #ANNOTATION_INIT_STRATEGY}
47 * </blockquote>
48 *
49 * @author a.kohlbecker
50 * @date 24.03.2009
51 */
52 @Controller
53 @RequestMapping(value = {"/*/agent/*","/*/agent/*/annotation"})
54 public class AgentController extends AnnotatableController<AgentBase, IAgentService>
55 {
56
57 public AgentController(){
58 super();
59 setUuidParameterPattern("^/(?:[^/]+)/agent/([^/?#&\\.]+).*");
60 }
61
62 /* (non-Javadoc)
63 * @see eu.etaxonomy.cdm.remote.controller.GenericController#setService(eu.etaxonomy.cdm.api.service.IService)
64 */
65 @Autowired
66 @Override
67 public void setService(IAgentService service) {
68 this.service = service;
69 }
70
71 }