a1d78516b4bf6f6a649587b5818fd4738fa0a389
[cdmlib.git] / cdmlib-remote / src / main / java / eu / etaxonomy / cdm / remote / controller / AgentListController.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 org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.stereotype.Controller;
14 import org.springframework.web.bind.annotation.RequestMapping;
15
16 import eu.etaxonomy.cdm.api.service.IAgentService;
17 import eu.etaxonomy.cdm.api.service.pager.Pager;
18 import eu.etaxonomy.cdm.database.UpdatableRoutingDataSource;
19 import eu.etaxonomy.cdm.model.agent.AgentBase;
20 import eu.etaxonomy.cdm.model.common.Annotation;
21
22 /**
23 * The AgentListController class is a Spring MVC Controller.
24 * <p>
25 * The syntax of the mapped service URIs contains the the {datasource-name} path element.
26 * The available {datasource-name}s are defined in a configuration file which
27 * is loaded by the {@link UpdatableRoutingDataSource}. If the
28 * UpdatableRoutingDataSource is not being used in the actual application
29 * context any arbitrary {datasource-name} may be used.
30 * <p>
31 * Methods mapped at type level, inherited from super classes ({@link BaseController}):
32 * <blockquote>
33 * URI: <b>&#x002F;{datasource-name}&#x002F;agent&#x002F;</b>
34 *
35 * Depending on the URI parameters used this service returns
36 * either a {@link Pager} on or a List of the {@link AgentBase} entities
37 * identified by the <code>{agent-uuid}</code>.
38 * The returned AgentBase instances are initialized by
39 * the following strategy: {@link #DEFAULT_INIT_STRATEGY}
40 * <p>
41 * <b>URI Parameters to return a {@link Pager}:</b>
42 * <ul>
43 * <li><b>pageNumber</b>
44 * the number of the page to be returned, the first page has the
45 * pageNumber = 1 - <i>optional parameter</i>
46 * <li><b>pageSize</b>
47 * the maximum number of entities returned per page (can be null
48 * to return all entities in a single page) - <i>optional
49 * parameter</i>
50 * <li><b>type</b>
51 * Further restricts the type of entities to be returned.
52 * If null the base type <code>&lt;T&gt;</code> is being used. - <i>optional parameter</i>
53 * </ul>
54 * <p>
55 * <b>URI Parameters to return a {@link List}:</b>
56 * <ul>
57 * <li><b>start</b>
58 * The offset index from the start of the list. The first entity
59 * has the index = 0 - <b><i>required parameter</i></b>
60 * The start parameter is used to distinguish between the List and Pager variants!
61 * <li><b>limit</b>
62 * The maximum number of entities returned. - <i>optional parameter</i>
63 * <li><b>type</b>
64 * Further restricts the type of entities to be returned.
65 * If null the base type <code>&lt;T&gt;</code> is being used. - <i>optional parameter</i>
66 * </ul>
67 * </blockquote>
68 *
69 * @author a.kohlbecker
70 * @date 24.03.2009
71 */
72 @Controller
73 @RequestMapping(value = {"/agent/"})
74 public class AgentListController extends BaseListController<AgentBase, IAgentService> {
75
76 /* (non-Javadoc)
77 * @see eu.etaxonomy.cdm.remote.controller.BaseListController#setService(eu.etaxonomy.cdm.api.service.IService)
78 */
79 @Override
80 @Autowired
81 public void setService(IAgentService service) {
82 this.service = service;
83 }
84 }