2 * Copyright (C) 2007 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
.persistence
.dao
.common
;
12 import java
.util
.List
;
14 import org
.hibernate
.criterion
.Criterion
;
16 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableEntity
;
17 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableSource
;
18 import eu
.etaxonomy
.cdm
.model
.common
.LSID
;
19 import eu
.etaxonomy
.cdm
.model
.common
.UuidAndTitleCache
;
20 import eu
.etaxonomy
.cdm
.model
.media
.Rights
;
21 import eu
.etaxonomy
.cdm
.persistence
.dao
.BeanInitializer
;
22 import eu
.etaxonomy
.cdm
.persistence
.query
.MatchMode
;
23 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
25 public interface IIdentifiableDao
<T
extends IdentifiableEntity
> extends IAnnotatableDao
<T
>, ITitledDao
<T
>, ISearchableDao
<T
>{
28 * Return an object by LSID. NOTE: Because of the fact that LSIDs are supposed to
29 * be globally resolvable, this method behaves in a different way to other methods
31 * 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
32 * revision part, then this will be used in the query, but if not, then it is expected that the request is for the 'current'
33 * version of the object and the revision part will not be used as a matching criteria in the query.
35 * If the object does not appear in the current view (i.e. it has been deleted), then this method will search the history
36 * tables for a match, again using the revision if it exists, but ignoring it if not.
38 * @param lsid a LifeScience Identifier identifying the desired object
40 public T
find(LSID lsid
);
43 * Return a count of the sources for this identifiable entity
45 * @param identifiableEntity The identifiable entity
46 * @return a count of OriginalSource instances
48 public int countSources(T identifiableEntity
);
51 * Return a List of the sources for this identifiable entity
53 * @param identifiableEntity The identifiable entity
54 * @param pageSize The maximum number of sources returned (can be null for all sources)
55 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
56 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
57 * @return a List of OriginalSource instances
59 public List
<IdentifiableSource
> getSources(T identifiableEntity
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
62 * Return a count of the rights for this identifiable entity
64 * @param identifiableEntity The identifiable entity
65 * @return a count of Rights instances
67 public int countRights(T identifiableEntity
);
70 * Return a List of the rights for this identifiable entity
72 * @param identifiableEntity The identifiable entity
73 * @param pageSize The maximum number of rights returned (can be null for all rights)
74 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
75 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
76 * @return a List of Rights instances
78 public List
<Rights
> getRights(T identifiableEntity
, Integer pageSize
, Integer pageNumber
, List
<String
> propertyPaths
);
80 // TODO Migrated from IOriginalSourceDao
81 public List
<T
> findOriginalSourceByIdInSource(String idInSource
, String idNamespace
);
84 * Return a list of all uuids mapped to titleCache in the convenient <code>UuidAndTitleCache</code> object.
85 * Retrieving this list is considered to be significantly faster than initializing the fully fledged buiseness
86 * objects. To be used in cases where you want to present large amount of data and provide details after
87 * a selection has been made.
89 * @return a list of <code>UuidAndTitleCache</code> instances
91 public List
<UuidAndTitleCache
<T
>> getUuidAndTitleCache();
94 * Return a List of objects matching the given query string, optionally filtered by class, optionally with a particular MatchMode
96 * @param clazz filter by class - can be null to include all instances of type T
97 * @param queryString the query string to filter by
98 * @param matchmode use a particular type of matching (can be null - defaults to exact matching)
99 * @param criteria extra restrictions to apply
100 * @param pageSize The maximum number of rights returned (can be null for all rights)
101 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
102 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
104 * Supports path like <code>orderHints.propertyNames</code> which
105 * include *-to-one properties like createdBy.username or
106 * authorTeam.persistentTitleCache
107 * @return a List of instances of type T matching the queryString
109 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
);
112 * Return a List of objects matching the given query string, optionally filtered by class, optionally with a particular MatchMode
114 * @param clazz filter by class - can be null to include all instances of type T
115 * @param queryString the query string to filter by
116 * @param matchmode use a particular type of matching (can be null - defaults to exact matching)
117 * @param criteria extra restrictions to apply
118 * @param pageSize The maximum number of rights returned (can be null for all rights)
119 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
120 * @param propertyPaths properties to initialize - see {@link BeanInitializer#initialize(Object, List)}
122 * Supports path like <code>orderHints.propertyNames</code> which
123 * include *-to-one properties like createdBy.username or
124 * authorTeam.persistentTitleCache
125 * @return a List of instances of type T matching the queryString
127 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
);
130 * Return a count of objects matching the given query string, optionally filtered by class, optionally with a particular MatchMode
132 * @param clazz filter by class - can be null to include all instances of type T
133 * @param queryString the query string to filter by
134 * @param matchmode use a particular type of matching (can be null - defaults to exact matching)
135 * @param criteria extra restrictions to apply
136 * @return a count of instances of type T matching the queryString
138 public int countByTitle(Class
<?
extends T
> clazz
, String queryString
, MatchMode matchmode
, List
<Criterion
> criteria
);