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
.reference
.ReferenceBase
;
20 import eu
.etaxonomy
.cdm
.persistence
.query
.OrderHint
;
23 public interface IReferenceService
extends IIdentifiableEntityService
<ReferenceBase
> {
26 * FIXME candidate for harmonization?
28 * Finds reference by UUID
30 public abstract ReferenceBase
getReferenceByUuid(UUID uuid
);
33 * FIXME candidate for harmonization?
34 * Finds references by title
36 public List
<ReferenceBase
> getReferencesByTitle(String title
);
39 * FIXME candidate for harmonization?
40 * Finds references of a certain kind by title
42 public List
<ReferenceBase
> getReferencesByTitle(String title
, Class
<ReferenceBase
> clazz
);
45 * FIXME candidate for harmonization?
47 * @deprecated use {@link #getAllReferences(Integer, Integer) instead
50 public abstract List
<ReferenceBase
> getAllReferences(int limit
, int start
);
53 * Gets all references ordered by the properties defined by <code>orderHints</code>
54 * @param pageSize the maximum number of entities returned entries per page. Can be null to return all entities.
55 * @param pageNumber a numeric zero based page index
57 * @return a Pager instance
59 public Pager
<ReferenceBase
> getAllReferences(Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
);
62 * Gets all references unordered
63 * @param pageSize the maximum number of entities returned entries per page. Can be null to return all entities.
64 * @param pageNumber a numeric zero based page index
65 * @return a Pager instance
67 public abstract Pager
<ReferenceBase
> getAllReferences(Integer pageSize
, Integer pageNumber
);
69 // public abstract UUID saveReference(ReferenceBase reference);
72 * FIXME candidate for harmonization?
73 * Saves a reference and return its UUID
75 public abstract UUID
saveReference(ReferenceBase reference
);
77 // public abstract Map<UUID, ReferenceBase> saveReferenceAll(Collection<ReferenceBase> referenceCollection);
80 * FIXME candidate for harmonization?
81 * Saves a collection of references
83 public abstract Map
<UUID
, ReferenceBase
> saveReferenceAll(Collection
<ReferenceBase
> referenceCollection
);
86 * Returns a Paged List of ReferenceBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
88 * @param clazz filter the results by class (or pass null to return all ReferenceBase instances)
90 * @param pageSize The maximum number of references returned (can be null for all matching references)
91 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
93 * Supports path like <code>orderHints.propertyNames</code> which
94 * include *-to-one properties like createdBy.username or
95 * authorTeam.persistentTitleCache
96 * @param propertyPaths properties to be initialized
97 * @return a Pager ReferenceBase instances
98 * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
100 public Pager
<ReferenceBase
> search(Class
<?
extends ReferenceBase
> clazz
, String queryString
, Integer pageSize
, Integer pageNumber
, List
<OrderHint
> orderHints
, List
<String
> propertyPaths
);