Revision 3ba542cb
Added by Cherian Mathew over 8 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IAgentService.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
11 | 11 |
package eu.etaxonomy.cdm.api.service; |
12 | 12 |
|
13 | 13 |
import java.util.List; |
14 |
|
|
14 |
import java.util.UUID; |
|
15 | 15 |
|
16 | 16 |
import eu.etaxonomy.cdm.api.service.pager.Pager; |
17 | 17 |
import eu.etaxonomy.cdm.model.agent.Address; |
... | ... | |
25 | 25 |
import eu.etaxonomy.cdm.strategy.merge.MergeException; |
26 | 26 |
|
27 | 27 |
public interface IAgentService extends IIdentifiableEntityService<AgentBase> { |
28 |
|
|
28 |
|
|
29 | 29 |
public List<Institution> searchInstitutionByCode(String code); |
30 |
|
|
30 |
|
|
31 | 31 |
/** |
32 | 32 |
* Return a paged list of the institutional memberships held by a person |
33 |
*
|
|
33 |
* |
|
34 | 34 |
* @param person the person |
35 | 35 |
* @param pageSize The maximum number of memberships returned (can be null for all memberships) |
36 | 36 |
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based) |
37 | 37 |
* @return a Pager containing InstitutionalMembership instances |
38 | 38 |
*/ |
39 | 39 |
public Pager<InstitutionalMembership> getInstitutionalMemberships(Person person, Integer pageSize, Integer pageNumber); |
40 |
|
|
40 |
|
|
41 | 41 |
/** |
42 | 42 |
* Return a paged list of the members of a team |
43 |
*
|
|
43 |
* |
|
44 | 44 |
* @param team the team |
45 | 45 |
* @param pageSize The maximum number of members returned (can be null for all members) |
46 | 46 |
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based) |
47 | 47 |
* @return a Pager containing Person instances |
48 | 48 |
*/ |
49 | 49 |
public Pager<Person> getMembers(Team team, Integer pageSize, Integer pageNumber); |
50 |
|
|
50 |
|
|
51 | 51 |
/** |
52 | 52 |
* Return a paged list of the addresses of an agent |
53 |
*
|
|
53 |
* |
|
54 | 54 |
* @param agent the agent |
55 | 55 |
* @param pageSize The maximum number of addresses returned (can be null for all members) |
56 | 56 |
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based) |
57 | 57 |
* @return a Pager containing Address instances |
58 | 58 |
*/ |
59 | 59 |
public Pager<Address> getAddresses(AgentBase agent, Integer pageSize, Integer pageNumber); |
60 |
|
|
60 |
|
|
61 | 61 |
/** |
62 | 62 |
* Returns a Paged List of AgentBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser) |
63 |
*
|
|
63 |
* |
|
64 | 64 |
* @param clazz filter the results by class (or pass null to return all AgentBase instances) |
65 | 65 |
* @param queryString |
66 | 66 |
* @param pageSize The maximum number of agents returned (can be null for all matching agents) |
... | ... | |
73 | 73 |
* @return a Pager Agent instances |
74 | 74 |
* @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a> |
75 | 75 |
*/ |
76 |
public Pager<AgentBase> search(Class<? extends AgentBase> clazz, String queryString, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths); |
|
77 |
|
|
76 |
@Override |
|
77 |
public Pager<AgentBase> search(Class<? extends AgentBase> clazz, String queryString, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths); |
|
78 |
|
|
78 | 79 |
/** |
79 | 80 |
* Returns a list of <code>UuidAndTitleCache</code> containing all <code>Person</code>s |
80 |
*
|
|
81 |
* |
|
81 | 82 |
* @return a list of <code>UuidAndTitleCache</code> instances |
82 | 83 |
*/ |
83 | 84 |
public List<UuidAndTitleCache<Person>> getPersonUuidAndTitleCache(); |
84 |
|
|
85 |
|
|
85 | 86 |
/** |
86 | 87 |
* Returns a list of <code>UuidAndTitleCache</code> containing all <code>TeamOrPersonBase</code> objects |
87 | 88 |
* with their respective titleCache |
88 |
*
|
|
89 |
* |
|
89 | 90 |
* @return a list of <code>UuidAndTitleCache</code> instances |
90 | 91 |
*/ |
91 | 92 |
public List<UuidAndTitleCache<Team>> getTeamUuidAndTitleCache(); |
92 |
|
|
93 |
|
|
93 | 94 |
/** |
94 | 95 |
* Returns a list of <code>UuidAndTitleCache</code> containing all <code>TeamOrPersonBase</code> objects |
95 | 96 |
* with their respective nomenclaturalTitle instead of regular titleCache |
96 |
*
|
|
97 |
* |
|
97 | 98 |
* @return a list of <code>UuidAndTitleCache</code> instances |
98 | 99 |
*/ |
99 | 100 |
public List<UuidAndTitleCache<Team>> getTeamUuidAndNomenclaturalTitle(); |
100 |
|
|
101 |
|
|
101 | 102 |
/** |
102 | 103 |
* Returns a list of <code>UuidAndTitleCache</code> containing all {@link Institution} objects |
103 | 104 |
* with their respective titleCache |
104 |
*
|
|
105 |
* |
|
105 | 106 |
* @return a list of <code>UuidAndTitleCache</code> instances |
106 | 107 |
*/ |
107 | 108 |
public List<UuidAndTitleCache<Institution>> getInstitutionUuidAndTitleCache(); |
108 | 109 |
|
109 |
|
|
110 |
|
|
111 |
/** |
|
112 |
* @param teamUuid |
|
113 |
* @return |
|
114 |
* @throws MergeException |
|
115 |
*/ |
|
116 |
public Person convertTeam2Person(UUID teamUuid) throws MergeException; |
|
117 |
|
|
110 | 118 |
/** |
111 | 119 |
* If the given {@link Team} is a single member team all links to the team are redirected to the |
112 | 120 |
* single member and the team itself is deleted. |
... | ... | |
115 | 123 |
* and all links to the team are redirected to the new person and the team itself is deleted. |
116 | 124 |
* <BR> |
117 | 125 |
* Otherwise, an {@link IllegalArgumentException} is thrown. |
118 |
*
|
|
126 |
* |
|
119 | 127 |
* @param team the team to be converted |
120 | 128 |
* @return the existing or new person that replaces the given team |
121 | 129 |
* @throws IllegalArgumentException if team has > 1 members |
122 | 130 |
* @throws MergeException if anything else goes wrong during merge |
123 | 131 |
*/ |
124 | 132 |
public Person convertTeam2Person(Team team) throws MergeException, IllegalArgumentException; |
125 |
|
|
133 |
|
|
134 |
|
|
135 |
/** |
|
136 |
* @param personUuid |
|
137 |
* @return |
|
138 |
* @throws MergeException |
|
139 |
* @throws IllegalArgumentException |
|
140 |
*/ |
|
141 |
public Team convertPerson2Team(UUID personUuid) throws MergeException, IllegalArgumentException; |
|
142 |
|
|
126 | 143 |
/** |
127 |
* If possible replaces the given person by a new {@link Team}.
|
|
128 |
* <BR>This is only possible if the person is at no place used in person only mode, which
|
|
144 |
* If possible replaces the given person by a new {@link Team}. |
|
145 |
* <BR>This is only possible if the person is at no place used in person only mode, which |
|
129 | 146 |
* is the case e.g. at User.person or FieldUnit.primaryCollector. |
130 | 147 |
* <BR> |
131 | 148 |
* If the person can not be replaced a {@link MergeException} is thrown. |
132 |
*
|
|
149 |
* |
|
133 | 150 |
* @param person the {@link Person} to be converted |
134 | 151 |
* @return the new team that replaces the given person |
135 | 152 |
* @throws MergeException if anything else goes wrong during merge |
136 | 153 |
*/ |
137 | 154 |
public Team convertPerson2Team(Person person) throws MergeException, IllegalArgumentException; |
138 |
|
|
155 |
|
|
156 |
|
|
157 |
|
|
139 | 158 |
} |
Also available in: Unified diff
#5268 Add convert methods which take uuid as input