1 |
25663b56
|
Andreas Müller
|
/**
|
2 |
|
|
* Copyright (C) 2007 EDIT
|
3 |
a561758b
|
Andreas Kohlbecker
|
* European Distributed Institute of Taxonomy
|
4 |
25663b56
|
Andreas Müller
|
* http://www.e-taxonomy.eu
|
5 |
a561758b
|
Andreas Kohlbecker
|
*
|
6 |
25663b56
|
Andreas Müller
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7 |
|
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8 |
|
|
*/
|
9 |
|
|
|
10 |
2d993c6e
|
Andreas Müller
|
package eu.etaxonomy.cdm.api.service;
|
11 |
|
|
|
12 |
0c686681
|
Andreas Müller
|
import java.net.URI;
|
13 |
b0d80757
|
Andreas Müller
|
import java.util.Collection;
|
14 |
01918b69
|
Andreas Kohlbecker
|
import java.util.Enumeration;
|
15 |
2d993c6e
|
Andreas Müller
|
import java.util.List;
|
16 |
01918b69
|
Andreas Kohlbecker
|
import java.util.Locale;
|
17 |
697a6de8
|
Andreas Müller
|
import java.util.Map;
|
18 |
d8e15f8a
|
Andreas Müller
|
import java.util.Set;
|
19 |
2d993c6e
|
Andreas Müller
|
import java.util.UUID;
|
20 |
|
|
|
21 |
a1ab6a74
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.api.service.TermServiceImpl.TermMovePosition;
|
22 |
c9f77ee3
|
Andreas Müller
|
import eu.etaxonomy.cdm.api.service.config.TermDeletionConfigurator;
|
23 |
bcb513cd
|
ben.clark
|
import eu.etaxonomy.cdm.api.service.pager.Pager;
|
24 |
2d993c6e
|
Andreas Müller
|
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
|
25 |
bab794a8
|
a.babadshanjan
|
import eu.etaxonomy.cdm.model.common.Language;
|
26 |
7f2165f9
|
a.babadshanjan
|
import eu.etaxonomy.cdm.model.common.LanguageString;
|
27 |
|
|
import eu.etaxonomy.cdm.model.common.LanguageStringBase;
|
28 |
a1ab6a74
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.model.common.OrderedTermBase;
|
29 |
|
|
import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary;
|
30 |
bf54e6b4
|
a.babadshanjan
|
import eu.etaxonomy.cdm.model.common.Representation;
|
31 |
503a869b
|
Patric Plitzner
|
import eu.etaxonomy.cdm.model.common.TermType;
|
32 |
92cc0c2b
|
Katja Luther
|
import eu.etaxonomy.cdm.model.common.TermVocabulary;
|
33 |
13422b4b
|
Andreas Müller
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
34 |
bcb513cd
|
ben.clark
|
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
|
35 |
|
|
import eu.etaxonomy.cdm.model.location.NamedAreaType;
|
36 |
|
|
import eu.etaxonomy.cdm.model.media.Media;
|
37 |
b9cbcc7c
|
Andreas Kohlbecker
|
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
|
38 |
a1ab6a74
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.persistence.dto.TermDto;
|
39 |
92cc0c2b
|
Katja Luther
|
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
|
40 |
d391964a
|
Andreas Kohlbecker
|
import eu.etaxonomy.cdm.persistence.query.OrderHint;
|
41 |
2d993c6e
|
Andreas Müller
|
|
42 |
c4e812bc
|
ben.clark
|
public interface ITermService extends IIdentifiableEntityService<DefinedTermBase> {
|
43 |
2d993c6e
|
Andreas Müller
|
|
44 |
a561758b
|
Andreas Kohlbecker
|
/**
|
45 |
|
|
* Returns a term according to it's uri
|
46 |
|
|
* @param uri
|
47 |
|
|
* @return
|
48 |
|
|
*/
|
49 |
|
|
public DefinedTermBase getByUri(URI uri);
|
50 |
|
|
|
51 |
|
|
public UUID saveLanguageData(LanguageStringBase languageData);
|
52 |
|
|
|
53 |
|
|
public List<LanguageString> getAllLanguageStrings(int limit, int start);
|
54 |
|
|
|
55 |
|
|
public List<Representation> getAllRepresentations(int limit, int start);
|
56 |
|
|
|
57 |
|
|
public Language getLanguageByIso(String iso639);
|
58 |
|
|
|
59 |
|
|
public List<Language> getLanguagesByLocale(Enumeration<Locale> locales);
|
60 |
|
|
|
61 |
|
|
public NamedArea getAreaByTdwgAbbreviation(String tdwgAbbreviation);
|
62 |
|
|
|
63 |
|
|
/**
|
64 |
bcb513cd
|
ben.clark
|
* Returns a paged list of Media that represent a given DefinedTerm instance
|
65 |
a561758b
|
Andreas Kohlbecker
|
*
|
66 |
|
|
* @param definedTerm the definedTerm represented by these media
|
67 |
|
|
* @param pageSize The maximum number of media returned (can be null for all related media)
|
68 |
|
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
69 |
bcb513cd
|
ben.clark
|
* @return a Pager of media instances
|
70 |
|
|
*/
|
71 |
a561758b
|
Andreas Kohlbecker
|
public Pager<Media> getMedia(DefinedTermBase definedTerm, Integer pageSize, Integer pageNumber);
|
72 |
|
|
|
73 |
|
|
/**
|
74 |
|
|
* Returns a paged list of NamedArea instances (optionally filtered by type or level)
|
75 |
|
|
*
|
76 |
|
|
* @param level restrict the result set to named areas of a certain level (can be null)
|
77 |
|
|
* @param type restrict the result set to named areas of a certain type (can be null)
|
78 |
|
|
* @param pageSize The maximum number of namedAreas returned (can be null for all named areas)
|
79 |
|
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
80 |
|
|
* @return a Pager of named areas
|
81 |
|
|
*/
|
82 |
|
|
public Pager<NamedArea> list(NamedAreaLevel level, NamedAreaType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
|
83 |
|
|
|
84 |
|
|
/**
|
85 |
|
|
* Return a paged list of terms which are specializations of a given definedTerm
|
86 |
|
|
*
|
87 |
|
|
* @param definedTerm The term which is a generalization of the terms returned
|
88 |
|
|
* @param pageSize The maximum number of terms returned (can be null for all specializations)
|
89 |
|
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
90 |
|
|
* @return a Pager of DefinedTerms
|
91 |
|
|
*/
|
92 |
|
|
public <T extends DefinedTermBase> Pager<T> getGeneralizationOf(T definedTerm, Integer pageSize, Integer pageNumber);
|
93 |
|
|
|
94 |
|
|
/**
|
95 |
|
|
* Return a paged list of distinct terms which include the terms supplied
|
96 |
|
|
*
|
97 |
|
|
* @param definedTerms the set of terms which are part of the terms of interest
|
98 |
|
|
* @param pageSize The maximum number of terms returned (can be null for all terms)
|
99 |
|
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
100 |
|
|
* @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
|
101 |
|
|
* @return a Pager of DefinedTerms
|
102 |
|
|
*/
|
103 |
|
|
public <T extends DefinedTermBase> Pager<T> getPartOf(Set<T> definedTerms, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
|
104 |
|
|
|
105 |
|
|
/**
|
106 |
|
|
* Return a paged list of terms which are part of the terms supplied
|
107 |
|
|
*
|
108 |
|
|
* @param definedTerms the set of terms which include the terms of interest
|
109 |
|
|
* @param pageSize The maximum number of terms returned (can be null for all terms)
|
110 |
|
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
111 |
|
|
* @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
|
112 |
|
|
* @return a Pager of DefinedTerms
|
113 |
|
|
*/
|
114 |
b0d80757
|
Andreas Müller
|
public <T extends DefinedTermBase> Pager<T> getIncludes(Collection<T> definedTerms, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
|
115 |
a561758b
|
Andreas Kohlbecker
|
|
116 |
|
|
/**
|
117 |
|
|
* Return a paged list of terms which have representations that match the supplied string in the text (description)
|
118 |
|
|
*
|
119 |
|
|
* @param label a string to match (exactly)
|
120 |
|
|
* @param pageSize The maximum number of terms returned (can be null for all terms)
|
121 |
|
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
122 |
|
|
* @return a Pager of DefinedTerms
|
123 |
|
|
*/
|
124 |
|
|
public <T extends DefinedTermBase> Pager<T> findByRepresentationText(String label, Class<T> clazz, Integer pageSize, Integer pageNumber);
|
125 |
|
|
|
126 |
|
|
/**
|
127 |
|
|
* Return a paged list of terms which have representations that match the supplied string in the abbreviated label
|
128 |
|
|
*
|
129 |
|
|
* @param label a string to match (exactly)
|
130 |
|
|
* @param pageSize The maximum number of terms returned (can be null for all terms)
|
131 |
|
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
132 |
|
|
* @return a Pager of DefinedTerms
|
133 |
|
|
*/
|
134 |
|
|
public <T extends DefinedTermBase> Pager<T> findByRepresentationAbbreviation(String abbrev, Class<T> clazz, Integer pageSize, Integer pageNumber);
|
135 |
|
|
|
136 |
503a869b
|
Patric Plitzner
|
/**
|
137 |
|
|
* Retrieves all {@link DefinedTermBase}s with the given {@link TermType}
|
138 |
|
|
* @param termType the term type to filter the terms
|
139 |
|
|
* @param limit
|
140 |
|
|
* @param start
|
141 |
|
|
* @param orderHints
|
142 |
|
|
* @param propertyPaths
|
143 |
|
|
* @return a list containing the terms
|
144 |
|
|
*/
|
145 |
740b2830
|
Patrick Plitzner
|
public <T extends DefinedTermBase> List<T> listByTermType(TermType termType, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
146 |
503a869b
|
Patric Plitzner
|
|
147 |
a561758b
|
Andreas Kohlbecker
|
/**
|
148 |
|
|
* Delete the given term according to the given delete configuration.
|
149 |
|
|
* In case a problem occurrs while deleting the term the result will reflect this
|
150 |
|
|
* via its status.
|
151 |
|
|
* @param term the term to delete
|
152 |
|
|
* @param config the configurator
|
153 |
|
|
* @return DeleteResult which holds the status of the deletion.
|
154 |
|
|
*/
|
155 |
|
|
public DeleteResult delete(DefinedTermBase term, TermDeletionConfigurator config);
|
156 |
e6814896
|
Andreas Müller
|
|
157 |
d0f4da50
|
Andreas Kohlbecker
|
/**
|
158 |
|
|
* Returns the term with the given idInVocabulary for the given vocabulary.
|
159 |
17cffe56
|
Andreas Müller
|
* If the same idInVocabulary exists with same vocabulary for multiple terms (though this is against the general
|
160 |
|
|
* contract of idInVocabulary) always the same term should be returned.
|
161 |
d0f4da50
|
Andreas Kohlbecker
|
* @param id idInVocabulary
|
162 |
|
|
* @param vocabularyUuid uuid of vocabulary
|
163 |
17cffe56
|
Andreas Müller
|
* @param clazz term clazz filter on certain term classes. May be <code>null</code> for no filter.
|
164 |
d0f4da50
|
Andreas Kohlbecker
|
* @return the term
|
165 |
17cffe56
|
Andreas Müller
|
* @throws IllegalArgumentException if id or vocabularyUuid is <code>null</code>
|
166 |
d0f4da50
|
Andreas Kohlbecker
|
*/
|
167 |
d984b9fb
|
Cherian Mathew
|
public <TERM extends DefinedTermBase> TERM findByIdInVocabulary(String id, UUID vocabularyUuid, Class<TERM> clazz)
|
168 |
17cffe56
|
Andreas Müller
|
throws IllegalArgumentException;
|
169 |
d984b9fb
|
Cherian Mathew
|
|
170 |
|
|
/**
|
171 |
|
|
* @param termUuid
|
172 |
|
|
* @param config
|
173 |
|
|
* @return
|
174 |
|
|
*/
|
175 |
|
|
public DeleteResult delete(UUID termUuid, TermDeletionConfigurator config);
|
176 |
57be0561
|
Cherian Mathew
|
|
177 |
|
|
/**
|
178 |
|
|
* @param label
|
179 |
|
|
* @return
|
180 |
|
|
*/
|
181 |
|
|
public Language getLanguageByLabel(String label);
|
182 |
697a6de8
|
Andreas Müller
|
|
183 |
|
|
/**
|
184 |
|
|
* @param representations
|
185 |
|
|
* @return
|
186 |
|
|
*/
|
187 |
|
|
public Map<UUID, Representation> saveOrUpdateRepresentations(Collection<Representation> representations);
|
188 |
92cc0c2b
|
Katja Luther
|
|
189 |
bc5e8c69
|
Katja Luther
|
|
190 |
92cc0c2b
|
Katja Luther
|
/**
|
191 |
|
|
* @param vocs
|
192 |
|
|
* @param limit
|
193 |
|
|
* @param pattern
|
194 |
bc5e8c69
|
Katja Luther
|
* @param lang
|
195 |
92cc0c2b
|
Katja Luther
|
* @return
|
196 |
|
|
*/
|
197 |
bc5e8c69
|
Katja Luther
|
List<UuidAndTitleCache<NamedArea>> getUuidAndTitleCache(List<TermVocabulary> vocs, Integer limit, String pattern,
|
198 |
|
|
Language lang);
|
199 |
a1ab6a74
|
Patrick Plitzner
|
|
200 |
|
|
/**
|
201 |
|
|
* Returns all terms that are included in the given parent term resp. a part of the given term.
|
202 |
|
|
* @param parentTerm the parent term
|
203 |
|
|
* @return a collection of included terms
|
204 |
|
|
*/
|
205 |
|
|
public Collection<TermDto> getIncludesAsDto(TermDto parentTerm);
|
206 |
|
|
|
207 |
|
|
/**
|
208 |
|
|
* Returns all terms that the given term is a generalization of resp. that are a kind of the given term
|
209 |
|
|
* @param parentTerm the parent term
|
210 |
|
|
* @return a collection of included terms
|
211 |
|
|
*/
|
212 |
|
|
public Collection<TermDto> getKindOfsAsDto(TermDto parentTerm);
|
213 |
|
|
|
214 |
|
|
/**
|
215 |
|
|
* Move the given term to the given parent
|
216 |
|
|
* @param termDto the {@link TermDto} of the term to move
|
217 |
|
|
* @param parentUuid the {@link UUID} of the new parent term
|
218 |
|
|
* @param termMovePosition enum to specify the position for {@link OrderedTermBase}s in an {@link OrderedTermVocabulary}
|
219 |
|
|
*/
|
220 |
|
|
public void moveTerm(TermDto termDto, UUID parentUuid, TermMovePosition termMovePosition);
|
221 |
|
|
|
222 |
|
|
/**
|
223 |
|
|
* Move the given term to the given parent
|
224 |
|
|
* @param termDto the {@link TermDto} of the term to move
|
225 |
|
|
* @param parentUuid the {@link UUID} of the new parent term
|
226 |
|
|
*/
|
227 |
|
|
public void moveTerm(TermDto termDto, UUID parentUuid);
|
228 |
|
|
|
229 |
|
|
/**
|
230 |
|
|
* Creates a new term as a child of the given parent.
|
231 |
|
|
* @param termType the {@link TermType} of the term to create
|
232 |
|
|
* @param parentUuid the {@link UUID} of the parent term
|
233 |
|
|
* @param isKindOf if <code>true</code> the term will be added via a
|
234 |
|
|
* kindOf relation. Otherwise it will added via a partOf relation
|
235 |
533c3163
|
Patrick Plitzner
|
* @return the new term
|
236 |
a1ab6a74
|
Patrick Plitzner
|
*/
|
237 |
533c3163
|
Patrick Plitzner
|
public TermDto addNewTerm(TermType termType, UUID parentUuid, boolean isKindOf);
|
238 |
a1ab6a74
|
Patrick Plitzner
|
|
239 |
2d993c6e
|
Andreas Müller
|
}
|