// $Id$\r
/**\r
-* Copyright (C) 2008 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
-*/\r
+*\r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/ \r
\r
package eu.etaxonomy.cdm.api.service;\r
\r
import java.util.List;\r
-import java.util.Map;\r
-import java.util.UUID;\r
\r
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;\r
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;\r
import eu.etaxonomy.cdm.api.service.pager.Pager;\r
+import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;\r
import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry;\r
import eu.etaxonomy.cdm.model.media.Media;\r
-import eu.etaxonomy.cdm.model.occurrence.Collection;\r
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;\r
+import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;\r
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;\r
+import eu.etaxonomy.cdm.model.occurrence.FieldObservation;\r
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;\r
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
import eu.etaxonomy.cdm.persistence.dao.BeanInitializer;\r
+import eu.etaxonomy.cdm.persistence.query.OrderHint;\r
\r
/**\r
* @author a.babadshanjan\r
* @created 01.09.2008\r
*/\r
public interface IOccurrenceService extends IIdentifiableEntityService<SpecimenOrObservationBase> {\r
-\r
- /**\r
- * FIXME candidate for harmonization?\r
- * Computes all specimen or observation bases.\r
- * @param limit\r
- * @param start\r
- * @return\r
- */\r
- public abstract List<SpecimenOrObservationBase> getAllSpecimenOrObservationBases(int limit, int start);\r
-\r
- /**\r
- * FIXME candidate for harmonization? \r
- * Saves a collection of specimen or observation bases.\r
- * @return Map with UUID as key and SpecimenOrObservationBase as value.\r
- */\r
- public abstract Map<UUID, ? extends SpecimenOrObservationBase> \r
- saveSpecimenOrObservationBaseAll(java.util.Collection<? extends SpecimenOrObservationBase> specimenOrObservationBaseCollection);\r
-\r
- /** \r
- * FIXME candidate for harmonizaion?\r
- * save a specimen or observation and return its UUID\r
- */\r
- public abstract UUID saveSpecimenOrObservationBase (SpecimenOrObservationBase specimenOrObservationBase);\r
\r
public WaterbodyOrCountry getCountryByIso(String iso639);\r
\r
public List<WaterbodyOrCountry> getWaterbodyOrCountryByName(String name);\r
\r
- /** */\r
- public abstract List<Collection> searchCollectionByCode(String code);\r
- \r
- public abstract UUID saveCollection(Collection collection);\r
+ /**\r
+ * Returns a paged list of occurrences that have been determined to belong to the taxon concept\r
+ * determinedAs, optionally restricted to objects belonging to a class that that extends \r
+ * SpecimenOrObservationBase\r
+ * \r
+ * @param type The type of entities to return (can be null to count all entities of type <T>)\r
+ * @param determinedAs the taxon concept that the occurrences have been determined to belong to\r
+ * @param pageSize The maximum number of objects returned (can be null for all matching objects)\r
+ * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based, \r
+ * can be null, equivalent of starting at the beginning of the recordset)\r
+ * @param orderHints\r
+ * Supports path like <code>orderHints.propertyNames</code> which\r
+ * include *-to-one properties like createdBy.username or\r
+ * authorTeam.persistentTitleCache\r
+ * @param propertyPaths properties to be initialized\r
+ * @return\r
+ */\r
+ public Pager<SpecimenOrObservationBase> list(Class<? extends SpecimenOrObservationBase> type, TaxonBase determinedAs, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
\r
/**\r
* Returns a List of Media that are associated with a given occurence\r
/**\r
* Returns a List of determinations that have been made for a given occurence\r
* \r
- * @param occurence the occurence associated with these determinations\r
+ * @param occurence the occurence associated with these determinations (can be null for all occurrences)\r
+ * @param taxonbase the taxon concept associated with these determinations (can be null for all taxon concepts)\r
* @param pageSize The maximum number of determinations returned (can be null for all related determinations)\r
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)\r
* @return a Pager of determination instances\r
*/\r
- public Pager<DeterminationEvent> getDeterminations(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber, List<String> propertyPaths);\r
+ public Pager<DeterminationEvent> getDeterminations(SpecimenOrObservationBase occurence, TaxonBase taxonBase, Integer pageSize, Integer pageNumber, List<String> propertyPaths);\r
\r
/**\r
* Returns a list of derivation events that have involved creating new DerivedUnits from this occurence\r
* @return a Pager of derivation events\r
*/\r
public Pager<DerivationEvent> getDerivationEvents(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber, List<String> propertyPaths);\r
+ \r
+ /**\r
+ * Returns a Paged List of SpecimenOrObservationBase instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)\r
+ * \r
+ * @param clazz filter the results by class (or pass null to return all SpecimenOrObservationBase instances)\r
+ * @param queryString\r
+ * @param pageSize The maximum number of occurrences returned (can be null for all matching occurrences)\r
+ * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)\r
+ * @param orderHints\r
+ * Supports path like <code>orderHints.propertyNames</code> which\r
+ * include *-to-one properties like createdBy.username or\r
+ * authorTeam.persistentTitleCache\r
+ * @param propertyPaths properties to be initialized\r
+ * @return a Pager SpecimenOrObservationBase instances\r
+ * @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>\r
+ */\r
+ public Pager<SpecimenOrObservationBase> search(Class<? extends SpecimenOrObservationBase> clazz, String query, Integer pageSize,Integer pageNumber, List<OrderHint> orderHints,List<String> propertyPaths);\r
+ \r
+ public List<UuidAndTitleCache<FieldObservation>> getFieldObservationUuidAndTitleCache();\r
+ \r
+ public List<UuidAndTitleCache<DerivedUnitBase>> getDerivedUnitBaseUuidAndTitleCache();\r
+ \r
+ public DerivedUnitFacade getDerivedUnitFacade(DerivedUnitBase derivedUnit, List<String> propertyPaths) throws DerivedUnitFacadeNotSupportedException;\r
}\r