fixes #1100 and #1101
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / IAgentService.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.api.service;
12
13 import java.util.Collection;
14 import java.util.List;
15 import java.util.Map;
16 import java.util.UUID;
17
18 import eu.etaxonomy.cdm.api.service.pager.Pager;
19 import eu.etaxonomy.cdm.model.agent.Address;
20 import eu.etaxonomy.cdm.model.agent.AgentBase;
21 import eu.etaxonomy.cdm.model.agent.Institution;
22 import eu.etaxonomy.cdm.model.agent.InstitutionalMembership;
23 import eu.etaxonomy.cdm.model.agent.Person;
24 import eu.etaxonomy.cdm.model.agent.Team;
25 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
26 import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
27 import eu.etaxonomy.cdm.persistence.query.OrderHint;
28
29 public interface IAgentService extends IIdentifiableEntityService<AgentBase> {
30
31 // FIXME Candidate for harmonization
32 public abstract AgentBase getAgentByUuid(UUID uuid);
33
34 // FIXME Candidate for harmonization
35 public abstract UUID saveAgent(AgentBase agent);
36
37 // FIXME Candidate for harmonization
38 public abstract Map<UUID, AgentBase> saveAgentAll(Collection<? extends AgentBase> agentCollection);
39
40 // FIXME Candidate for harmonization
41 public abstract List<AgentBase> findAgentsByTitle(String title);
42
43 // FIXME Candidate for harmonization
44 public abstract List<AgentBase> getAllAgents(int limit, int start);
45
46 public abstract List<Institution> searchInstitutionByCode(String code);
47
48 /**
49 * Return a paged list of the institutional memberships held by a person
50 *
51 * @param person the person
52 * @param pageSize The maximum number of memberships returned (can be null for all memberships)
53 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
54 * @return a Pager containing InstitutionalMembership instances
55 */
56 public Pager<InstitutionalMembership> getInstitutionalMemberships(Person person, Integer pageSize, Integer pageNumber);
57
58 /**
59 * Return a paged list of the members of a team
60 *
61 * @param team the team
62 * @param pageSize The maximum number of members returned (can be null for all members)
63 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
64 * @return a Pager containing Person instances
65 */
66 public Pager<Person> getMembers(Team team, Integer pageSize, Integer pageNumber);
67
68 /**
69 * Return a paged list of the addresses of an agent
70 *
71 * @param agent the agent
72 * @param pageSize The maximum number of addresses returned (can be null for all members)
73 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
74 * @return a Pager containing Address instances
75 */
76 public Pager<Address> getAddresses(AgentBase agent, Integer pageSize, Integer pageNumber);
77
78 /**
79 * Returns a Paged List of AgentBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
80 *
81 * @param clazz filter the results by class (or pass null to return all AgentBase instances)
82 * @param queryString
83 * @param pageSize The maximum number of agents returned (can be null for all matching agents)
84 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
85 * @param orderHints
86 * Supports path like <code>orderHints.propertyNames</code> which
87 * include *-to-one properties like createdBy.username or
88 * authorTeam.persistentTitleCache
89 * @param propertyPaths properties to be initialized
90 * @return a Pager Agent instances
91 * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
92 */
93 public Pager<AgentBase> search(Class<? extends AgentBase> clazz, String queryString, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
94
95 /**
96 * Returns a list of <code>UuidAndTitleCache</code> containing all <code>Person</code>s
97 *
98 * @return a list of <code>UuidAndTitleCache</code> instances
99 */
100 public List<UuidAndTitleCache<Person>> getPersonUuidAndNomenclaturalTitle();
101
102 /**
103 * Returns a list of <code>UuidAndTitleCache</code> containing all <code>TeamOrPersonBase</code> obejcts
104 * with their respective nomenclaturalTitle instead of regular titleCache
105 *
106 * @return a list of <code>UuidAndTitleCache</code> instances
107 */
108 public List<UuidAndTitleCache<TeamOrPersonBase>> getTeamOrPersonBaseUuidAndNomenclaturalTitle();
109 }