2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.api
.service
;
12 import java
.util
.Collection
;
13 import java
.util
.List
;
15 import java
.util
.UUID
;
17 import eu
.etaxonomy
.cdm
.api
.service
.pager
.Pager
;
18 import eu
.etaxonomy
.cdm
.model
.common
.CdmClass
;
19 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
20 import eu
.etaxonomy
.cdm
.model
.term
.DefinedTermBase
;
21 import eu
.etaxonomy
.cdm
.model
.term
.TermType
;
22 import eu
.etaxonomy
.cdm
.model
.term
.TermVocabulary
;
23 import eu
.etaxonomy
.cdm
.persistence
.dto
.TermDto
;
24 import eu
.etaxonomy
.cdm
.persistence
.dto
.TermVocabularyDto
;
25 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
26 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
28 public interface IVocabularyService
extends IIdentifiableEntityService
<TermVocabulary
> {
31 * Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State.
34 * @param termType the {@link TermType} of the terms in the vocabulary and of the vocabulary
35 * @param includeSubTypes if <code>true</code> all subtypes will be included for computation of the result
36 * @param limit The maximum number of vocabularies returned (can be null for all vocabularies)
37 * @param start The offset from the start of the result set (0 - based, can be null - equivalent of starting at the beginning of the recordset)
39 * Supports path like <code>orderHints.propertyNames</code> which
40 * include *-to-one properties like createdBy.username or
41 * authorTeam.persistentTitleCache
42 * @param propertyPaths properties to be initialized
43 * @return a list of term vocabularies
45 public List
<TermVocabulary
> listByTermType(TermType termType
, boolean includeSubTypes
, Integer limit
, Integer start
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
48 * Returns Language Vocabulary
51 //TODO candidate for harmonization: rename to loadLanguageVocabulary(...
52 public TermVocabulary
<Language
> getLanguageVocabulary();
55 * Returns a list of terms belonging to the vocabulary passed as an argument
57 * @param vocabulary The vocabulary for which the list of terms is desired
58 * @param limit The maximum number of terms returned (can be null for all terms in the vocabulary)
59 * @param start The offset from the start of the result set (0 - based, can be null - equivalent of starting at the beginning of the recordset)
61 * Supports path like <code>orderHints.propertyNames</code> which
62 * include *-to-one properties like createdBy.username or
63 * authorTeam.persistentTitleCache
64 * @param propertyPaths properties to be initialized
65 * @return a paged list of terms
67 //TODO candidate for harmonization: rename to getTerms(...
68 public Pager
<DefinedTermBase
> getTerms(TermVocabulary vocabulary
, Integer limit
, Integer start
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
71 * Returns a list of term vocabularies corresponding to a term type
73 * @param termType The term type for which the list of vocabularies is desired
74 * @return a list of vocabularies
76 public <T
extends DefinedTermBase
> List
<TermVocabulary
<T
>> findByTermType(TermType termType
, List
<String
> propertyPaths
);
79 * Loads all top level terms, i.e. terms that have no parent terms, for the given vocabulary
80 * @param vocabularyUuid the uuid of the vocabulary
81 * @return a collection of top level terms
83 public Collection
<TermDto
> getTopLevelTerms(UUID vocabularyUuid
);
86 * Loads all terms for the given vocabulary
87 * @param vocabularyUuid the id of the vocabulary
88 * @return a collection of terms
90 public Collection
<TermDto
> getTerms(UUID vocabularyUuid
);
93 * Loads all terms for the given vocabularies
94 * @param vocabularyUuids the ids of the vocabularies
95 * @return a collection of terms
97 public Collection
<TermDto
> getTerms(List
<UUID
> vocabularyUuids
);
100 * Loads all namedArea term dtos with level informations for the given vocabularies
101 * @param vocabularyUuids the ids of the vocabularies
102 * @return a collection of named areaterm dtos
104 public Collection
<TermDto
> getNamedAreaTerms(List
<UUID
> vocabularyUuids
);
106 * Initializes the complete term hierarchy consisting of {@link TermDto}s
107 * for the given vocabulary
108 * @param vocabularyDto the dto of the term vocabulary
109 * @return a the top level elements for this vocabulary
111 public Collection
<TermDto
> getCompleteTermHierarchy(TermVocabularyDto vocabularyDto
);
114 * Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State.
116 * @param termType the {@link TermType} of the terms in the vocabulary and of the vocabulary
117 * @return a list of term vocabulary DTOs
119 public List
<TermVocabularyDto
> findVocabularyDtoByTermType(TermType termType
);
122 * Returns term vocabularies that contain terms of the given types {@link TermType} e.g. Feature, Modifier, State.
124 * @param termTypes a set of {@link TermType}s of the terms in the vocabulary and of the vocabulary
125 * @return a list of term vocabulary DTOs
127 public List
<TermVocabularyDto
> findVocabularyDtoByTermTypes(Set
<TermType
> termTypes
);
130 * Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State.
132 * @param termType the {@link TermType} of the terms in the vocabulary and of the vocabulary
133 * @param includeSubtypes if <code>true</code> also vocabularies with subtypes of the given type
135 * @return a list of term vocabulary DTOs
137 public List
<TermVocabularyDto
> findVocabularyDtoByTermType(TermType termType
, boolean includeSubtypes
);
140 * Returns term vocabularies that contain terms of the given types {@link TermType} e.g. Feature, Modifier, State.
142 * @param termTypes a set of {@link TermType}s of the terms in the vocabulary and of the vocabulary
143 * @param includeSubtypes if <code>true</code> also vocabularies with subtypes of the given type
145 * @return a list of term vocabulary DTOs
147 public List
<TermVocabularyDto
> findVocabularyDtoByTermTypes(Set
<TermType
> termTypes
, boolean includeSubtypes
);
150 * Creates a new term as a direct child of the given vocabulary.
151 * @param termType the {@link TermType} of the term to create
152 * @param vocabularyUUID the {@link UUID} of the vocabulary
153 * kindOf relation. Otherwise it will added via a partOf relation
154 * @return the new term
156 public TermDto
addNewTerm(TermType termType
, UUID vocabularyUUID
, Language lang
);
160 * Like {@link #getUuidAndTitleCache(Class, Integer, String)} but filtering
161 * the results by {@link TermType} of the vocabularies.
167 * the {@link TermType} of the vocabularies to be retrieved
169 * max number of results
172 * @return a list of {@link UuidAndTitleCache}
174 * @see #getUuidAndTitleCache(Class, Integer, String))
176 public <S
extends TermVocabulary
> List
<UuidAndTitleCache
<S
>> getUuidAndTitleCache(Class
<S
> clazz
, TermType termType
,
177 Integer limit
, String pattern
);
183 public TermVocabularyDto
findVocabularyDtoByVocabularyUuid(UUID vocUuid
);
189 public List
<TermVocabularyDto
> findVocabularyDtoByVocabularyUuids(List
<UUID
> vocUuid
);
191 public List
<TermVocabularyDto
> findVocabularyDtoByTermTypeAndPattern(String pattern
, TermType termType
);
195 * @param includeSubtypes
198 public List
<TermVocabularyDto
> findFeatureVocabularyDtoByTermTypes(Set
<CdmClass
> availableFor
);