3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.cdm
.api
.service
;
13 import java
.util
.Collection
;
14 import java
.util
.List
;
16 import java
.util
.UUID
;
18 import eu
.etaxonomy
.cdm
.api
.service
.pager
.Pager
;
19 import eu
.etaxonomy
.cdm
.model
.common
.UuidAndTitleCache
;
20 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceBase
;
21 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
24 public interface IReferenceService
extends IIdentifiableEntityService
<ReferenceBase
> {
27 * FIXME candidate for harmonization?
29 * Finds reference by UUID
31 public abstract ReferenceBase
getReferenceByUuid(UUID uuid
);
34 * FIXME candidate for harmonization?
35 * Finds references by title
37 public List
<ReferenceBase
> getReferencesByTitle(String title
);
40 * FIXME candidate for harmonization?
41 * Finds references of a certain kind by title
43 public List
<ReferenceBase
> getReferencesByTitle(String title
, Class
<ReferenceBase
> clazz
);
46 * FIXME candidate for harmonization?
48 * @deprecated use {@link #getAllReferences(Integer, Integer) instead
51 public abstract List
<ReferenceBase
> getAllReferences(int limit
, int start
);
54 * Gets all references ordered by the properties defined by <code>orderHints</code>
55 * @param pageSize the maximum number of entities returned entries per page. Can be null to return all entities.
56 * @param pageNumber a numeric zero based page index
58 * @return a Pager instance
60 public Pager
<ReferenceBase
> getAllReferences(Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
);
63 * Gets all references unordered
64 * @param pageSize the maximum number of entities returned entries per page. Can be null to return all entities.
65 * @param pageNumber a numeric zero based page index
66 * @return a Pager instance
68 public abstract Pager
<ReferenceBase
> getAllReferences(Integer pageSize
, Integer pageNumber
);
70 // public abstract UUID saveReference(ReferenceBase reference);
73 * FIXME candidate for harmonization?
74 * Saves a reference and return its UUID
76 public abstract UUID
saveReference(ReferenceBase reference
);
78 // public abstract Map<UUID, ReferenceBase> saveReferenceAll(Collection<ReferenceBase> referenceCollection);
81 * FIXME candidate for harmonization?
82 * Saves a collection of references
84 public abstract Map
<UUID
, ReferenceBase
> saveReferenceAll(Collection
<ReferenceBase
> referenceCollection
);
87 * Returns a Paged List of ReferenceBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
89 * @param clazz filter the results by class (or pass null to return all ReferenceBase instances)
91 * @param pageSize The maximum number of references returned (can be null for all matching references)
92 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
94 * Supports path like <code>orderHints.propertyNames</code> which
95 * include *-to-one properties like createdBy.username or
96 * authorTeam.persistentTitleCache
97 * @param propertyPaths properties to be initialized
98 * @return a Pager ReferenceBase instances
99 * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
101 public Pager
<ReferenceBase
> search(Class
<?
extends ReferenceBase
> clazz
, String queryString
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);
104 * Returns a map that holds uuid, titleCache pairs of all references in the current database
107 * a <code>Map</code> containing uuid and titleCache of references
109 public List
<UuidAndTitleCache
> getUuidAndTitleCacheOfReferences();