X-Git-Url: https://dev.e-taxonomy.eu/gitweb/cdmlib.git/blobdiff_plain/bcb513cdb7d40d2b593920d88f0a7136b4f911cf..22697c602300bc25c4a6780635698d56996b1d11:/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IOccurrenceService.java diff --git a/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IOccurrenceService.java b/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IOccurrenceService.java index 0df2ee05b0..4581eb7e60 100644 --- a/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IOccurrenceService.java +++ b/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IOccurrenceService.java @@ -1,60 +1,80 @@ +// $Id$ /** -* Copyright (C) 2008 EDIT -* European Distributed Institute of Taxonomy +* Copyright (C) 2009 EDIT +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -*/ +* +* The contents of this file are subject to the Mozilla Public License Version 1.1 +* See LICENSE.TXT at the top of this package for the full license terms. +*/ package eu.etaxonomy.cdm.api.service; import java.util.List; -import java.util.Map; -import java.util.UUID; +import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; +import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException; import eu.etaxonomy.cdm.api.service.pager.Pager; +import eu.etaxonomy.cdm.model.common.UuidAndTitleCache; +import eu.etaxonomy.cdm.model.description.DescriptionBase; +import eu.etaxonomy.cdm.model.description.IndividualsAssociation; +import eu.etaxonomy.cdm.model.description.TaxonDescription; import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry; import eu.etaxonomy.cdm.model.media.Media; -import eu.etaxonomy.cdm.model.occurrence.Collection; +import eu.etaxonomy.cdm.model.name.HomotypicalGroup; +import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; import eu.etaxonomy.cdm.model.occurrence.DerivationEvent; +import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase; import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent; +import eu.etaxonomy.cdm.model.occurrence.FieldObservation; import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; +import eu.etaxonomy.cdm.model.taxon.Taxon; +import eu.etaxonomy.cdm.model.taxon.TaxonBase; +import eu.etaxonomy.cdm.persistence.dao.BeanInitializer; +import eu.etaxonomy.cdm.persistence.query.OrderHint; /** * @author a.babadshanjan * @created 01.09.2008 */ public interface IOccurrenceService extends IIdentifiableEntityService { - - /** - * FIXME candidate for harmonization? - * Computes all specimen or observation bases. - * @param limit - * @param start - * @return - */ - public abstract List getAllSpecimenOrObservationBases(int limit, int start); - - /** - * FIXME candidate for harmonization? - * Saves a collection of specimen or observation bases. - * @return Map with UUID as key and SpecimenOrObservationBase as value. - */ - public abstract Map - saveSpecimenOrObservationBaseAll(java.util.Collection specimenOrObservationBaseCollection); - - /** - * FIXME candidate for harmonizaion? - * save a specimen or observation and return its UUID - */ - public abstract UUID saveSpecimenOrObservationBase (SpecimenOrObservationBase specimenOrObservationBase); public WaterbodyOrCountry getCountryByIso(String iso639); public List getWaterbodyOrCountryByName(String name); - /** */ - public abstract List searchCollectionByCode(String code); - - public abstract UUID saveCollection(Collection collection); + /** + * Returns a paged list of occurrences that have been determined to belong + * to the taxon concept determinedAs, optionally restricted to objects + * belonging to a class that that extends SpecimenOrObservationBase. + *

+ * In contrast to {@link #listByAnyAssociation(Class, Taxon, List)} this + * method only takes SpecimenOrObservationBase instances into account which + * are actually determined as the taxon specified by + * determinedAs. + * + * @param type + * The type of entities to return (can be null to count all + * entities of type ) + * @param determinedAs + * the taxon concept that the occurrences have been determined to + * belong to + * @param pageSize + * The maximum number of objects returned (can be null for all + * matching objects) + * @param pageNumber + * The offset (in pageSize chunks) from the start of the result + * set (0 - based, can be null, equivalent of starting at the + * beginning of the recordset) + * @param orderHints + * Supports path like orderHints.propertyNames which + * include *-to-one properties like createdBy.username or + * authorTeam.persistentTitleCache + * @param propertyPaths + * properties to be initialized + * @return + */ + public Pager list(Class type, TaxonBase determinedAs, Integer limit, Integer start, List orderHints, List propertyPaths); /** * Returns a List of Media that are associated with a given occurence @@ -62,19 +82,21 @@ public interface IOccurrenceService extends IIdentifiableEntityService getMedia(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber); + public Pager getMedia(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber, List propertyPaths); /** * Returns a List of determinations that have been made for a given occurence * - * @param occurence the occurence associated with these determinations + * @param occurence the occurence associated with these determinations (can be null for all occurrences) + * @param taxonbase the taxon concept associated with these determinations (can be null for all taxon concepts) * @param pageSize The maximum number of determinations returned (can be null for all related determinations) * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based) * @return a Pager of determination instances */ - public Pager getDeterminations(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber); + public Pager getDeterminations(SpecimenOrObservationBase occurence, TaxonBase taxonBase, Integer pageSize, Integer pageNumber, List propertyPaths); /** * Returns a list of derivation events that have involved creating new DerivedUnits from this occurence @@ -84,5 +106,52 @@ public interface IOccurrenceService extends IIdentifiableEntityService getDerivationEvents(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber); + public Pager getDerivationEvents(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber, List propertyPaths); + + /** + * Returns a Paged List of SpecimenOrObservationBase 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 SpecimenOrObservationBase instances) + * @param queryString + * @param pageSize The maximum number of occurrences returned (can be null for all matching occurrences) + * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based) + * @param orderHints + * Supports path like orderHints.propertyNames which + * include *-to-one properties like createdBy.username or + * authorTeam.persistentTitleCache + * @param propertyPaths properties to be initialized + * @return a Pager SpecimenOrObservationBase instances + * @see Apache Lucene - Query Parser Syntax + */ + public Pager search(Class clazz, String query, Integer pageSize,Integer pageNumber, List orderHints,List propertyPaths); + + public List> getFieldObservationUuidAndTitleCache(); + + public List> getDerivedUnitBaseUuidAndTitleCache(); + + public DerivedUnitFacade getDerivedUnitFacade(DerivedUnitBase derivedUnit, List propertyPaths) throws DerivedUnitFacadeNotSupportedException; + + public List listDerivedUnitFacades(DescriptionBase description, List propertyPaths); + + /** + * Lists all instances of {@link SpecimenOrObservationBase} which are associated with the taxon specified as parameter. + * SpecimenOrObservationBase instances can be associated to taxa in multiple ways, all these possible relations are taken into account: + *

    + *
  • The {@link IndividualsAssociation} elements in a {@link TaxonDescription} contain {@link DerivedUnitBase}s
  • + *
  • {@link SpecimenTypeDesignation}s may be associated with any {@link HomotypicalGroup} related to the specific {@link Taxon}.
  • + *
  • A {@link Taxon} may be referenced by the {@link DeterminationEvent} of the {@link SpecimenOrObservationBase}
  • + *
+ * + * @param + * @param type + * @param associatedTaxon + * @param limit + * @param start + * @param orderHints + * @param propertyPaths + * @return + */ + public List listByAnyAssociation(Class type, + Taxon associatedTaxon, Integer limit, Integer start, List orderHints, List propertyPaths); + }