e3f27e937897367802f43051cf0a715eae3e62ad
[cdmlib.git] / cdmlib-persistence / src / main / java / eu / etaxonomy / cdm / persistence / dao / common / ITermVocabularyDao.java
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.persistence.dao.common;
11
12
13 import java.util.List;
14 import java.util.Map;
15 import java.util.Set;
16 import java.util.UUID;
17
18 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
19 import eu.etaxonomy.cdm.model.common.TermType;
20 import eu.etaxonomy.cdm.model.common.TermVocabulary;
21 import eu.etaxonomy.cdm.persistence.query.OrderHint;
22
23
24 /**
25 * @author a.mueller
26 *
27 */
28 public interface ITermVocabularyDao extends IIdentifiableDao<TermVocabulary> {
29
30 /**
31 * Return a count of terms that belong to the termVocabulary supplied
32 *
33 * @param termVocabulary The term vocabulary which 'owns' the terms of interest
34 * @return a count of terms
35 */
36 public int countTerms(TermVocabulary termVocabulary);
37
38 /**
39 * Return a List of terms that belong to the termVocabulary supplied
40 *
41 * @param termVocabulary The term vocabulary which 'owns' the terms of interest
42 * @param pageSize The maximum number of terms returned (can be null for all terms)
43 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
44 * @return a List of terms
45 */
46 public <T extends DefinedTermBase> List<T> getTerms(TermVocabulary<T> termVocabulary, Integer pageSize, Integer pageNumber);
47
48 public <T extends DefinedTermBase> TermVocabulary<T> findByUri(String termSourceUri, Class<T> clazz);
49
50 /**
51 * Return a List of terms that belong to the termVocabulary supplied
52 *
53 * @param termVocabulary The term vocabulary which 'owns' the terms of interest
54 * @param pageSize The maximum number of terms returned (can be null for all terms)
55 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
56 * @param orderHints
57 * Supports path like <code>orderHints.propertyNames</code> which
58 * include *-to-one properties like createdBy.username or
59 * authorTeam.persistentTitleCache
60 * @param propertyPaths properties to be initialized
61 * @return a List of terms
62 */
63 public <T extends DefinedTermBase> List<T> getTerms(TermVocabulary<T> vocabulary,Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
64
65 /**
66 * Return a List of vocabularies that belong to the term type supplied
67 *
68 * @param termType The term type corresponding to the vocabularies of interest
69 * @return a List of vocabularies
70 */
71 public <T extends DefinedTermBase> List<TermVocabulary<T>> findByTermType(TermType termType);
72
73
74 /**
75 * Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State.
76 *
77 * @param <TERMTYPE>
78 * @param termType the {@link TermType} of the terms in the vocabulary and of the vocabulary
79 * @param includeSubtypes if <code>true</code> all subtypes will be included for computation of the result
80 * @param limit The maximum number of vocabularies returned (can be null for all vocabularies)
81 * @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)
82 * @param orderHints
83 * Supports path like <code>orderHints.propertyNames</code> which
84 * include *-to-one properties like createdBy.username or
85 * authorTeam.persistentTitleCache
86 * @param propertyPaths properties to be initialized
87 * @return a list of term vocabularies
88 */
89 public List<TermVocabulary> listByTermType(TermType termType, boolean includeSubtypes, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
90
91 /**
92 * Fills the response map with those term uuids which do exist in the requested map
93 * but not in the repository (missing terms). The map key is the vocabulary uuid in both cases.
94 * If parameter vocabularyRepsonse is not <code>null</code> the vocabularies will be fully loaded
95 * and returned within the map. The later is for using this method together with fast termloading.
96 * @param uuidsRequested
97 * @param uuidsRepsonse
98 * @param vocabularyResponse
99 */
100 public void missingTermUuids(Map<UUID, Set<UUID>> uuidsRequested,
101 Map<UUID, Set<UUID>> uuidsRepsonse,
102 Map<UUID, TermVocabulary<?>> vocabularyResponse);
103
104 }