Project

General

Profile

Download (9.29 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
import java.util.List;
13

    
14
import org.hibernate.criterion.Criterion;
15

    
16
import eu.etaxonomy.cdm.model.common.Credit;
17
import eu.etaxonomy.cdm.model.common.DefinedTerm;
18
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
19
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
20
import eu.etaxonomy.cdm.model.common.LSID;
21
import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
22
import eu.etaxonomy.cdm.model.media.Rights;
23
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
24
import eu.etaxonomy.cdm.persistence.query.MatchMode;
25
import eu.etaxonomy.cdm.persistence.query.OrderHint;
26

    
27
public interface IIdentifiableDao <T extends IdentifiableEntity> extends IAnnotatableDao<T>, ITitledDao<T>, ISearchableDao<T>{
28
	
29
	/**
30
	 * Return an object by LSID. NOTE: Because of the fact that LSIDs are supposed to
31
	 * be globally resolvable, this method behaves in a different way to other methods
32
	 * 
33
	 * In short, it attempts to find an object of type T in the current view using the LSID passed. If the LSID passed has a 
34
	 * revision part, then this will be used in the query, but if not, then it is expected that the request is for the 'current'
35
	 * version of the object and the revision part will not be used as a matching criteria in the query. 
36
	 * 
37
	 * If the object does not appear in the current view (i.e. it has been deleted), then this method will search the history 
38
	 * tables for a match, again using the revision if it exists, but ignoring it if not.
39
	 * 
40
	 *  @param lsid a LifeScience Identifier identifying the desired object
41
	 */
42
	public T find(LSID lsid);
43
	
44
	/**
45
	 * Return a count of the sources for this identifiable entity
46
	 * 
47
	 * @param identifiableEntity The identifiable entity
48
	 * @return a count of OriginalSource instances
49
	 */
50
	public int countSources(T identifiableEntity);
51
	
52
	/**
53
	 * Return a List of the sources for this identifiable entity
54
	 * 
55
	 * @param identifiableEntity The identifiable entity
56
	 * @param pageSize The maximum number of sources returned (can be null for all sources)
57
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
58
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
59
	 * @return a List of OriginalSource instances
60
	 */
61
	public List<IdentifiableSource> getSources(T identifiableEntity, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
62
	
63
	/**
64
	 * Return a count of the rights for this identifiable entity
65
	 * 
66
	 * @param identifiableEntity The identifiable entity
67
	 * @return a count of Rights instances
68
	 */
69
    public int countRights(T identifiableEntity);
70
    
71
    
72
	/**
73
	 * Return a List of the rights for this identifiable entity
74
	 * 
75
	 * @param identifiableEntity The identifiable entity
76
	 * @param pageSize The maximum number of rights returned (can be null for all rights)
77
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
78
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
79
	 * @return a List of Rights instances
80
	 */
81
	public List<Rights> getRights(T identifiableEntity, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
82
	
83
	// TODO Migrated from IOriginalSourceDao
84
	public List<T> findOriginalSourceByIdInSource(String idInSource, String idNamespace);
85
	
86
	/**
87
	 * Return a list of all uuids mapped to titleCache in the convenient <code>UuidAndTitleCache</code> object.
88
	 * Retrieving this list is considered to be significantly faster than initializing the fully fledged buiseness
89
	 * objects. To be used in cases where you want to present large amount of data and provide details after 
90
	 * a selection has been made.  
91
	 * 
92
	 * @return a list of <code>UuidAndTitleCache</code> instances
93
	 */
94
	public List<UuidAndTitleCache<T>> getUuidAndTitleCache(); 
95
	
96
	 /**
97
	 * Return a List of objects matching the given query string, optionally filtered by class, optionally with a particular MatchMode
98
	 * 
99
	 * @param clazz filter by class - can be null to include all instances of type T
100
	 * @param queryString the query string to filter by
101
	 * @param matchmode use a particular type of matching (can be null - defaults to exact matching)
102
	 * @param criteria extra restrictions to apply
103
	 * @param pageSize The maximum number of rights returned (can be null for all rights)
104
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
105
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
106
	 * @param orderHints
107
	 *            Supports path like <code>orderHints.propertyNames</code> which
108
	 *            include *-to-one properties like createdBy.username or
109
	 *            authorTeam.persistentTitleCache
110
	 * @return a List of instances of type T matching the queryString
111
	 */
112
	public List<T> findByTitle(Class<? extends T> clazz, String queryString,MatchMode matchmode, List<Criterion> criteria, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
113
	
114
	
115

    
116
	/**
117
	 * TODO
118
	 * @param clazz
119
	 * @param queryString
120
	 * @param pageSize
121
	 * @param pageNumber
122
	 * @param orderHints
123
	 * @param matchMode
124
	 * @return
125
	 */
126
	public List<T> findTitleCache(Class<? extends T> clazz, String queryString, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, MatchMode matchMode);
127

    
128
	 /**
129
	 * Return a List of objects matching the given query string, optionally filtered by class, optionally with a particular MatchMode
130
	 * 
131
	 * @param clazz filter by class - can be null to include all instances of type T
132
	 * @param queryString the query string to filter by
133
	 * @param matchmode use a particular type of matching (can be null - defaults to exact matching)
134
	 * @param criteria extra restrictions to apply
135
	 * @param pageSize The maximum number of rights returned (can be null for all rights)
136
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
137
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
138
	 * @param orderHints
139
	 *            Supports path like <code>orderHints.propertyNames</code> which
140
	 *            include *-to-one properties like createdBy.username or
141
	 *            authorTeam.persistentTitleCache
142
	 * @return a List of instances of type T matching the queryString
143
	 */
144
	public List<T> findByReferenceTitle(Class<? extends T> clazz, String queryString,MatchMode matchmode, List<Criterion> criteria, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
145
	
146
	/**
147
	 * Return a count of objects matching the given query string in the titleCache, optionally filtered by class, optionally with a particular MatchMode
148
	 * 
149
	 * @param clazz filter by class - can be null to include all instances of type T
150
	 * @param queryString the query string to filter by
151
	 * @param matchmode use a particular type of matching (can be null - defaults to exact matching)
152
	 * @param criteria extra restrictions to apply
153
	 * @return a count of instances of type T matching the queryString
154
	 */
155
	public int countByTitle(Class<? extends T> clazz, String queryString, MatchMode matchmode, List<Criterion> criteria);
156
	
157
	/**
158
	 * Return a count of objects matching the given query string in the title, optionally filtered by class, optionally with a particular MatchMode
159
	 * 
160
	 * @param clazz filter by class - can be null to include all instances of type T
161
	 * @param queryString the query string to filter by
162
	 * @param matchmode use a particular type of matching (can be null - defaults to exact matching)
163
	 * @param criteria extra restrictions to apply
164
	 * @return a count of instances of type T matching the queryString
165
	 */
166
	public int countByReferenceTitle(Class<? extends T> clazz, String queryString, MatchMode matchmode, List<Criterion> criteria);
167

    
168
	/**
169
	 * Return a count of distinct titleCache Strings for a given {@link IdentifiableEntity}, optionally filtered by class, optionally with a particular MatchMode
170
	 * 
171
	 * @param clazz filter by class - can be null to include all instances of type T
172
	 * @param queryString the query string to filter by
173
	 * @param matchmode use a particular type of matching (can be null - defaults to exact matching)
174
	 * @return a count of instances of type T matching the queryString
175
	 */
176
	public abstract Long countTitleCache(Class<? extends T> clazz, String queryString, MatchMode matchMode);
177

    
178
	
179
    /**
180
     * Returns all {@link IdentifiableEntity identifiable entities} which have the according
181
     * identifier attached  
182
     * @param clazz the identiable entity subclass, may be null
183
     * @param identifier the identifer as {@link String}
184
     * @param identifierType the identifier type, maybe null
185
     * @param matchmode 
186
     * @param pageSize
187
     * @param pageNumber
188
     * @param orderHints
189
     * @param propertyPaths
190
     * @return
191
     */
192
    public <T extends IdentifiableEntity> List<T> findByIdentifier(T clazz, String identifier, DefinedTerm identifierType, MatchMode matchmode, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
193

    
194
}
(10-10/25)