+// $Id$
/**
* Copyright (C) 2007 EDIT
* European Distributed Institute of Taxonomy
package eu.etaxonomy.cdm.api.service;
-import java.util.Collection;
import java.util.List;
-import java.util.UUID;
-import java.util.Map;
import eu.etaxonomy.cdm.api.service.pager.Pager;
-import eu.etaxonomy.cdm.model.reference.ReferenceBase;
+import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
+import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.cdm.persistence.query.OrderHint;
-public interface IReferenceService extends IIdentifiableEntityService<ReferenceBase> {
+public interface IReferenceService extends IIdentifiableEntityService<Reference> {
/**
- * FIXME candidate for harmonization?
- *
- * Finds reference by UUID
+ * Returns a Paged List of Reference instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
+ *
+ * @param clazz filter the results by class (or pass null to return all Reference instances)
+ * @param queryString
+ * @param pageSize The maximum number of references returned (can be null for all matching references)
+ * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
+ * @param orderHints
+ * Supports path like <code>orderHints.propertyNames</code> which
+ * include *-to-one properties like createdBy.username or
+ * authorTeam.persistentTitleCache
+ * @param propertyPaths properties to be initialized
+ * @return a Pager Reference instances
+ * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
*/
- public abstract ReferenceBase getReferenceByUuid(UUID uuid);
-
- /**
- * FIXME candidate for harmonization?
- * Finds references by title
- */
- public List<ReferenceBase> getReferencesByTitle(String title);
-
+ public Pager<Reference> search(Class<? extends Reference> clazz, String queryString, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
+
/**
- * FIXME candidate for harmonization?
- * Finds references of a certain kind by title
+ * Returns a map that holds uuid, titleCache pairs of all references in the current database
+ *
+ * @return
+ * a <code>Map</code> containing uuid and titleCache of references
*/
- public List<ReferenceBase> getReferencesByTitle(String title, Class<ReferenceBase> clazz);
+ public List<UuidAndTitleCache<Reference>> getUuidAndTitle();
/**
- * FIXME candidate for harmonization?
- * Gets all references
- * @deprecated use {@link #getAllReferences(Integer, Integer) instead
+ * TODO candidate for harmonization: rename to listForPublishing
+ * @return
*/
- @Deprecated
- public abstract List<ReferenceBase> getAllReferences(int limit, int start);
+ public List<Reference> getAllReferencesForPublishing();
/**
- * Gets all references
- * @param pageSize the maximum number of entities returned entries per page. Can be null to return all entities.
- * @param pageNumber a numeric zero based page index
- * @return a Pager instance
+ * TODO candidate for harmonization: rename to listNomenclaturalReferences
+ * @return
*/
- public abstract Pager<ReferenceBase> getAllReferences(Integer pageSize, Integer pageNumber);
-
-// public abstract UUID saveReference(ReferenceBase reference);
+ public List<Reference> getAllNomenclaturalReferences();
- /**
- * FIXME candidate for harmonization?
- * Saves a reference and return its UUID
- */
- public abstract UUID saveReference(ReferenceBase reference);
-
-// public abstract Map<UUID, ReferenceBase> saveReferenceAll(Collection<ReferenceBase> referenceCollection);
-
/**
- * FIXME candidate for harmonization?
- * Saves a collection of references
+ * returns
+ *
+ * <ol>
+ * <li>all taxa directly covered by this reference</li>
+ * <li>all taxa covered by the according in references of this reference</li>
+ * </ol>
+ *
+ * searches for taxa using the following relations:
+ * <ul>
+ * <li>taxon.name.nomenclaturalreference</li>
+ * <li>taxon.descriptions.descriptionElement.sources.citation</li>
+ * <li>taxon.descriptions.descriptionSources</li>
+ * <li>taxon.name.descriptions.descriptionElement.sources</li>
+ * <li>taxon.name.descriptions.descriptionSources</li>
+ * </ul>
+ *
+ * @param reference
+ * @param includeSubordinateReferences TODO
+ * @param propertyPaths
+ * @return
*/
- public abstract Map<UUID, ReferenceBase> saveReferenceAll(Collection<ReferenceBase> referenceCollection);
-
+ public List<TaxonBase> listCoveredTaxa(Reference reference, boolean includeSubordinateReferences, List<String> propertyPaths);
}