1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* 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 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.api.service;
|
11
|
|
12
|
import java.net.URI;
|
13
|
import java.util.Collection;
|
14
|
import java.util.Enumeration;
|
15
|
import java.util.List;
|
16
|
import java.util.Locale;
|
17
|
import java.util.Map;
|
18
|
import java.util.Set;
|
19
|
import java.util.UUID;
|
20
|
|
21
|
import eu.etaxonomy.cdm.api.service.config.TermDeletionConfigurator;
|
22
|
import eu.etaxonomy.cdm.api.service.pager.Pager;
|
23
|
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
|
24
|
import eu.etaxonomy.cdm.model.common.Language;
|
25
|
import eu.etaxonomy.cdm.model.common.LanguageString;
|
26
|
import eu.etaxonomy.cdm.model.common.LanguageStringBase;
|
27
|
import eu.etaxonomy.cdm.model.common.Representation;
|
28
|
import eu.etaxonomy.cdm.model.common.TermType;
|
29
|
import eu.etaxonomy.cdm.model.common.TermVocabulary;
|
30
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
31
|
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
|
32
|
import eu.etaxonomy.cdm.model.location.NamedAreaType;
|
33
|
import eu.etaxonomy.cdm.model.media.Media;
|
34
|
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
|
35
|
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
|
36
|
import eu.etaxonomy.cdm.persistence.query.OrderHint;
|
37
|
|
38
|
public interface ITermService extends IIdentifiableEntityService<DefinedTermBase> {
|
39
|
|
40
|
/**
|
41
|
* Returns a term according to it's uri
|
42
|
* @param uri
|
43
|
* @return
|
44
|
*/
|
45
|
public DefinedTermBase getByUri(URI uri);
|
46
|
|
47
|
public UUID saveLanguageData(LanguageStringBase languageData);
|
48
|
|
49
|
public List<LanguageString> getAllLanguageStrings(int limit, int start);
|
50
|
|
51
|
public List<Representation> getAllRepresentations(int limit, int start);
|
52
|
|
53
|
public Language getLanguageByIso(String iso639);
|
54
|
|
55
|
public List<Language> getLanguagesByLocale(Enumeration<Locale> locales);
|
56
|
|
57
|
public NamedArea getAreaByTdwgAbbreviation(String tdwgAbbreviation);
|
58
|
|
59
|
/**
|
60
|
* Returns a paged list of Media that represent a given DefinedTerm instance
|
61
|
*
|
62
|
* @param definedTerm the definedTerm represented by these media
|
63
|
* @param pageSize The maximum number of media returned (can be null for all related media)
|
64
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
65
|
* @return a Pager of media instances
|
66
|
*/
|
67
|
public Pager<Media> getMedia(DefinedTermBase definedTerm, Integer pageSize, Integer pageNumber);
|
68
|
|
69
|
/**
|
70
|
* Returns a paged list of NamedArea instances (optionally filtered by type or level)
|
71
|
*
|
72
|
* @param level restrict the result set to named areas of a certain level (can be null)
|
73
|
* @param type restrict the result set to named areas of a certain type (can be null)
|
74
|
* @param pageSize The maximum number of namedAreas returned (can be null for all named areas)
|
75
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
76
|
* @return a Pager of named areas
|
77
|
*/
|
78
|
public Pager<NamedArea> list(NamedAreaLevel level, NamedAreaType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
|
79
|
|
80
|
/**
|
81
|
* Return a paged list of terms which are specializations of a given definedTerm
|
82
|
*
|
83
|
* @param definedTerm The term which is a generalization of the terms returned
|
84
|
* @param pageSize The maximum number of terms returned (can be null for all specializations)
|
85
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
86
|
* @return a Pager of DefinedTerms
|
87
|
*/
|
88
|
public <T extends DefinedTermBase> Pager<T> getGeneralizationOf(T definedTerm, Integer pageSize, Integer pageNumber);
|
89
|
|
90
|
/**
|
91
|
* Return a paged list of distinct terms which include the terms supplied
|
92
|
*
|
93
|
* @param definedTerms the set of terms which are part of the terms of interest
|
94
|
* @param pageSize The maximum number of terms returned (can be null for all terms)
|
95
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
96
|
* @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
|
97
|
* @return a Pager of DefinedTerms
|
98
|
*/
|
99
|
public <T extends DefinedTermBase> Pager<T> getPartOf(Set<T> definedTerms, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
|
100
|
|
101
|
/**
|
102
|
* Return a paged list of terms which are part of the terms supplied
|
103
|
*
|
104
|
* @param definedTerms the set of terms which include the terms of interest
|
105
|
* @param pageSize The maximum number of terms returned (can be null for all terms)
|
106
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
107
|
* @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
|
108
|
* @return a Pager of DefinedTerms
|
109
|
*/
|
110
|
public <T extends DefinedTermBase> Pager<T> getIncludes(Collection<T> definedTerms, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
|
111
|
|
112
|
/**
|
113
|
* Return a paged list of terms which have representations that match the supplied string in the text (description)
|
114
|
*
|
115
|
* @param label a string to match (exactly)
|
116
|
* @param pageSize The maximum number of terms returned (can be null for all terms)
|
117
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
118
|
* @return a Pager of DefinedTerms
|
119
|
*/
|
120
|
public <T extends DefinedTermBase> Pager<T> findByRepresentationText(String label, Class<T> clazz, Integer pageSize, Integer pageNumber);
|
121
|
|
122
|
/**
|
123
|
* Return a paged list of terms which have representations that match the supplied string in the abbreviated label
|
124
|
*
|
125
|
* @param label a string to match (exactly)
|
126
|
* @param pageSize The maximum number of terms returned (can be null for all terms)
|
127
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
128
|
* @return a Pager of DefinedTerms
|
129
|
*/
|
130
|
public <T extends DefinedTermBase> Pager<T> findByRepresentationAbbreviation(String abbrev, Class<T> clazz, Integer pageSize, Integer pageNumber);
|
131
|
|
132
|
/**
|
133
|
* Retrieves all {@link DefinedTermBase}s with the given {@link TermType}
|
134
|
* @param termType the term type to filter the terms
|
135
|
* @param limit
|
136
|
* @param start
|
137
|
* @param orderHints
|
138
|
* @param propertyPaths
|
139
|
* @return a list containing the terms
|
140
|
*/
|
141
|
public <T extends DefinedTermBase> List<T> listByTermType(TermType termType, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
|
142
|
|
143
|
/**
|
144
|
* Delete the given term according to the given delete configuration.
|
145
|
* In case a problem occurrs while deleting the term the result will reflect this
|
146
|
* via its status.
|
147
|
* @param term the term to delete
|
148
|
* @param config the configurator
|
149
|
* @return DeleteResult which holds the status of the deletion.
|
150
|
*/
|
151
|
public DeleteResult delete(DefinedTermBase term, TermDeletionConfigurator config);
|
152
|
|
153
|
/**
|
154
|
* Returns the term with the given idInVocabulary for the given vocabulary.
|
155
|
* If the same idInVocabulary exists with same vocabulary for multiple terms (though this is against the general
|
156
|
* contract of idInVocabulary) always the same term should be returned.
|
157
|
* @param id idInVocabulary
|
158
|
* @param vocabularyUuid uuid of vocabulary
|
159
|
* @param clazz term clazz filter on certain term classes. May be <code>null</code> for no filter.
|
160
|
* @return the term
|
161
|
* @throws IllegalArgumentException if id or vocabularyUuid is <code>null</code>
|
162
|
*/
|
163
|
public <TERM extends DefinedTermBase> TERM findByIdInVocabulary(String id, UUID vocabularyUuid, Class<TERM> clazz)
|
164
|
throws IllegalArgumentException;
|
165
|
|
166
|
/**
|
167
|
* @param termUuid
|
168
|
* @param config
|
169
|
* @return
|
170
|
*/
|
171
|
public DeleteResult delete(UUID termUuid, TermDeletionConfigurator config);
|
172
|
|
173
|
/**
|
174
|
* @param label
|
175
|
* @return
|
176
|
*/
|
177
|
public Language getLanguageByLabel(String label);
|
178
|
|
179
|
/**
|
180
|
* @param representations
|
181
|
* @return
|
182
|
*/
|
183
|
public Map<UUID, Representation> saveOrUpdateRepresentations(Collection<Representation> representations);
|
184
|
|
185
|
|
186
|
/**
|
187
|
* @param vocs
|
188
|
* @param limit
|
189
|
* @param pattern
|
190
|
* @param lang
|
191
|
* @return
|
192
|
*/
|
193
|
List<UuidAndTitleCache<NamedArea>> getUuidAndTitleCache(List<TermVocabulary> vocs, Integer limit, String pattern,
|
194
|
Language lang);
|
195
|
}
|