Project

General

Profile

Download (5.96 KB) Statistics
| Branch: | Tag: | Revision:
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.Collection;
14
import java.util.List;
15
import java.util.Map;
16
import java.util.Set;
17
import java.util.UUID;
18

    
19
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
20
import eu.etaxonomy.cdm.model.common.TermType;
21
import eu.etaxonomy.cdm.model.common.TermVocabulary;
22
import eu.etaxonomy.cdm.persistence.dto.TermDto;
23
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
24
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
25
import eu.etaxonomy.cdm.persistence.query.OrderHint;
26

    
27

    
28
/**
29
 * @author a.mueller
30
 *
31
 */
32
public interface ITermVocabularyDao extends IIdentifiableDao<TermVocabulary> {
33

    
34
	/**
35
	 * Return a count of terms that belong to the termVocabulary supplied
36
	 *
37
	 * @param termVocabulary The term vocabulary which 'owns' the terms of interest
38
	 * @return a count of terms
39
	 */
40
	public long countTerms(TermVocabulary termVocabulary);
41

    
42
	/**
43
	 * Return a List of terms that belong to the termVocabulary supplied
44
	 *
45
	 * @param termVocabulary The term vocabulary which 'owns' the terms of interest
46
	 * @param pageSize The maximum number of terms returned (can be null for all terms)
47
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
48
	 * @return a List of terms
49
	 */
50
	public <T extends DefinedTermBase> List<T> getTerms(TermVocabulary<T> termVocabulary, Integer pageSize, Integer pageNumber);
51

    
52
	public <T extends DefinedTermBase> TermVocabulary<T> findByUri(String termSourceUri, Class<T> clazz);
53

    
54
	/**
55
	 * Return a List of terms that belong to the termVocabulary supplied
56
	 *
57
	 * @param termVocabulary The term vocabulary which 'owns' the terms of interest
58
	 * @param pageSize The maximum number of terms returned (can be null for all terms)
59
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
60
	 * @param orderHints
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 List of terms
66
	 */
67
	public <T extends DefinedTermBase> List<T> getTerms(TermVocabulary<T> vocabulary,Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
68

    
69
    /**
70
     * Return a List of vocabularies that belong to the term type supplied
71
     *
72
     * @param termType The term type corresponding to the vocabularies of interest
73
     * @param propertyPaths
74
     * @return a List of vocabularies
75
     */
76
    public <T extends DefinedTermBase> List<TermVocabulary<T>> findByTermType(TermType termType, List<String> propertyPaths);
77

    
78

    
79
	/**
80
     * Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State.
81
     *
82
     * @param <TERMTYPE>
83
     * @param termType the {@link TermType} of the terms in the vocabulary and of the vocabulary
84
     * @param includeSubtypes if <code>true</code> all subtypes will be included for computation of the result
85
     * @param limit The maximum number of vocabularies returned (can be null for all vocabularies)
86
     * @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)
87
     * @param orderHints
88
     *            Supports path like <code>orderHints.propertyNames</code> which
89
     *            include *-to-one properties like createdBy.username or
90
     *            authorTeam.persistentTitleCache
91
     * @param propertyPaths properties to be initialized
92
     * @return a list of term vocabularies
93
     */
94
	public List<TermVocabulary> listByTermType(TermType termType, boolean includeSubtypes, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
95

    
96
	/**
97
	 * Fills the response map with those term uuids which do exist in the requested map
98
	 * but not in the repository (missing terms). The map key is the vocabulary uuid in both cases.
99
	 * If parameter vocabularyRepsonse is not <code>null</code> the vocabularies will be fully loaded
100
	 * and returned within the map. The later is for using this method together with fast termloading.
101
	 * @param uuidsRequested
102
	 * @param uuidsRepsonse
103
	 * @param vocabularyResponse
104
	 */
105
	public void missingTermUuids(Map<UUID, Set<UUID>> uuidsRequested,
106
			Map<UUID, Set<UUID>> uuidsRepsonse,
107
			Map<UUID, TermVocabulary<?>> vocabularyResponse);
108

    
109
    /**
110
     * Loads all top level terms, i.e. terms that have no parent terms, for the given vocabulary
111
     * @param vocabularyUuid the id of the vocabulary
112
     * @return a collection of top level terms
113
     */
114
    public Collection<TermDto> getTopLevelTerms(UUID vocabularyUuid);
115

    
116
    /**
117
     * Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State.
118
     *
119
     * @param termType the {@link TermType} of the terms in the vocabulary and of the vocabulary
120
     * @return a list of term vocabularies
121
     */
122
    public List<TermVocabularyDto> findVocabularyDtoByTermType(TermType termType);
123

    
124
    /**
125
     *
126
     * Like {@link #getUuidAndTitleCache(Class, Integer, String)} but filtering
127
     * the results by {@link TermType} of the vocabularies.
128
     *
129
     *
130
     * @param clazz
131
     *            the (sub)class
132
     * @param termType
133
     *            the {@link TermType} of the vocabularies to be retrieved
134
     * @param limit
135
     *            max number of results
136
     * @param pattern
137
     *            search pattern
138
     * @return a list of {@link UuidAndTitleCache}
139
     *
140
     * @see #getUuidAndTitleCache(Class, Integer, String))
141
     */
142
    public <S extends TermVocabulary> List<UuidAndTitleCache<S>> getUuidAndTitleCache(Class<S> clazz, TermType termType,
143
            Integer limit, String pattern);
144
}
(23-23/28)