Merge branch 'develop' of ssh://dev.e-taxonomy.eu/var/git/cdmlib into develop
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / IOccurrenceService.java
index 1b470cb501c300fdb270a65caeffded8c9f9d9a5..f1237765201f32c3962cec67f89b6a0f0e95083b 100644 (file)
@@ -1,4 +1,3 @@
-// $Id$\r
 /**\r
 * Copyright (C) 2009 EDIT\r
 * European Distributed Institute of Taxonomy\r
@@ -12,32 +11,38 @@ package eu.etaxonomy.cdm.api.service;
 \r
 import java.io.IOException;\r
 import java.util.Collection;\r
+import java.util.HashMap;\r
 import java.util.List;\r
+import java.util.Map;\r
 import java.util.Set;\r
 import java.util.UUID;\r
 \r
-import org.apache.lucene.index.CorruptIndexException;\r
-import org.apache.lucene.queryParser.ParseException;\r
 import org.hibernate.search.spatial.impl.Rectangle;\r
+import org.springframework.transaction.annotation.Transactional;\r
 \r
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;\r
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;\r
-import eu.etaxonomy.cdm.api.service.dto.DerivateHierarchyDTO;\r
+import eu.etaxonomy.cdm.api.service.config.FindOccurrencesConfigurator;\r
+import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;\r
+import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;\r
+import eu.etaxonomy.cdm.api.service.dto.DerivateDTO;\r
+import eu.etaxonomy.cdm.api.service.dto.FieldUnitDTO;\r
+import eu.etaxonomy.cdm.api.service.dto.PreservedSpecimenDTO;\r
 import eu.etaxonomy.cdm.api.service.pager.Pager;\r
+import eu.etaxonomy.cdm.api.service.search.LuceneParseException;\r
 import eu.etaxonomy.cdm.api.service.search.SearchResult;\r
 import eu.etaxonomy.cdm.api.service.util.TaxonRelationshipEdge;\r
-import eu.etaxonomy.cdm.model.common.ICdmBase;\r
 import eu.etaxonomy.cdm.model.common.Language;\r
-import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;\r
 import eu.etaxonomy.cdm.model.description.DescriptionBase;\r
+import eu.etaxonomy.cdm.model.description.DescriptionElementBase;\r
 import eu.etaxonomy.cdm.model.description.IndividualsAssociation;\r
-import eu.etaxonomy.cdm.model.description.TaxonDescription;\r
 import eu.etaxonomy.cdm.model.location.Country;\r
+import eu.etaxonomy.cdm.model.location.Point;\r
 import eu.etaxonomy.cdm.model.media.Media;\r
 import eu.etaxonomy.cdm.model.molecular.DnaSample;\r
 import eu.etaxonomy.cdm.model.molecular.Sequence;\r
-import eu.etaxonomy.cdm.model.name.HomotypicalGroup;\r
 import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;\r
+import eu.etaxonomy.cdm.model.name.TaxonName;\r
 import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;\r
 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;\r
 import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;\r
@@ -45,13 +50,13 @@ import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;\r
 import eu.etaxonomy.cdm.model.taxon.Taxon;\r
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;\r
-import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;\r
+import eu.etaxonomy.cdm.persistence.dto.SpecimenNodeWrapper;\r
+import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;\r
 import eu.etaxonomy.cdm.persistence.query.OrderHint;\r
 \r
 /**\r
  * @author a.babadshanjan\r
- * @created 01.09.2008\r
+ * @since 01.09.2008\r
  */\r
 public interface IOccurrenceService extends IIdentifiableEntityService<SpecimenOrObservationBase> {\r
 \r
@@ -62,7 +67,9 @@ public interface IOccurrenceService extends IIdentifiableEntityService<SpecimenO
     /**\r
      * Returns a paged list of occurrences that have been determined to belong\r
      * to the taxon concept determinedAs, optionally restricted to objects\r
-     * belonging to a class that that extends SpecimenOrObservationBase.\r
+     * belonging to a class that that extends SpecimenOrObservationBase. This\r
+     * will also consider specimens that are determined as a taxon concept\r
+     * belonging to the synonymy of the given taxon concept.\r
      * <p>\r
      * In contrast to {@link #listByAnyAssociation(Class, Taxon, List)} this\r
      * method only takes SpecimenOrObservationBase instances into account which\r
@@ -92,6 +99,39 @@ public interface IOccurrenceService extends IIdentifiableEntityService<SpecimenO
      */\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 paged list of occurrences that have been determined to belong\r
+     * to the taxon name determinedAs, optionally restricted to objects\r
+     * belonging to a class that that extends SpecimenOrObservationBase.\r
+     * <p>\r
+     * In contrast to {@link #listByAnyAssociation(Class, Taxon, List)} this\r
+     * method only takes SpecimenOrObservationBase instances into account which\r
+     * are actually determined as the taxon specified by\r
+     * <code>determinedAs</code>.\r
+     *\r
+     * @param type\r
+     *            The type of entities to return (can be null to count all\r
+     *            entities of type <T>)\r
+     * @param determinedAs\r
+     *            the taxon name that the occurrences have been determined to\r
+     *            belong to\r
+     * @param pageSize\r
+     *            The maximum number of objects returned (can be null for all\r
+     *            matching objects)\r
+     * @param pageNumber\r
+     *            The offset (in pageSize chunks) from the start of the result\r
+     *            set (0 - based, can be null, equivalent of starting at the\r
+     *            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\r
+     *            properties to be initialized\r
+     * @return\r
+     */\r
+    public Pager<SpecimenOrObservationBase> list(Class<? extends SpecimenOrObservationBase> type, TaxonName 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
@@ -103,6 +143,17 @@ public interface IOccurrenceService extends IIdentifiableEntityService<SpecimenO
      */\r
     public Pager<Media> getMedia(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber, List<String> propertyPaths);\r
 \r
+    /**\r
+     * Returns all media attached to this occurence and its children. Also takes\r
+     * {@link MediaSpecimen} and molecular images into account.\r
+     *\r
+     * @param occurence the occurence and its children from which the media to get\r
+     * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)\r
+     * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}\r
+     * @return a Pager of media instances\r
+     */\r
+    public Pager<Media> getMediainHierarchy(SpecimenOrObservationBase rootOccurence, Integer pageSize, Integer pageNumber, List<String> propertyPaths);\r
+\r
     /**\r
      * Returns a count of determinations that have been made for a given occurence and for a given taxon concept\r
      *\r
@@ -110,7 +161,7 @@ public interface IOccurrenceService extends IIdentifiableEntityService<SpecimenO
      * @param taxonbase the taxon concept associated with these determinations (can be null for all taxon concepts)\r
      * @return a count of determination events\r
      */\r
-    public int countDeterminations(SpecimenOrObservationBase occurence,TaxonBase taxonbase);\r
+    public long countDeterminations(SpecimenOrObservationBase occurence,TaxonBase taxonbase);\r
 \r
     /**\r
      * Returns a List of determinations that have been made for a given occurence\r
@@ -163,7 +214,7 @@ public interface IOccurrenceService extends IIdentifiableEntityService<SpecimenO
      * {@link DerivedUnit}s found in the data base.\r
      * @return a list of {@link UuidAndTitleCache}\r
      */\r
-    public List<UuidAndTitleCache<DerivedUnit>> getDerivedUnitUuidAndTitleCache();\r
+    public List<UuidAndTitleCache<DerivedUnit>> getDerivedUnitUuidAndTitleCache(Integer limit, String pattern);\r
 \r
     public DerivedUnitFacade getDerivedUnitFacade(DerivedUnit derivedUnit, List<String> propertyPaths) throws DerivedUnitFacadeNotSupportedException;\r
 \r
@@ -203,6 +254,27 @@ public interface IOccurrenceService extends IIdentifiableEntityService<SpecimenO
     public <T extends SpecimenOrObservationBase> List<T> listByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships,\r
             Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
 \r
+    /**\r
+     * The method will search for specimen associated with the taxon nodes.<br>\r
+     * It will search for 3 possible association types: <br>\r
+     * - via IndividualAssociations of the taxon<br>\r
+     *  - via TypeDesignations of the taxon name<br>\r
+     *  - via Determinations of the taxon or taxon name<br>\r
+     * <br>\r
+     * more are covered in\r
+     * {@link IOccurrenceService#findByTitle(IIdentifiableEntityServiceConfigurator)}\r
+     * @param taxonNodeUuids\r
+     *            a list of {@link UUID}s of the taxon nodes\r
+     * @param limit\r
+     * @param start\r
+     * @return a collection of {@link SpecimenNodeWrapper} containing the\r
+     *         {@link TaxonNode} and the corresponding {@link UuidAndTitleCache}\r
+     *         object for the specimen found for this taxon node\r
+     */\r
+    public Collection<SpecimenNodeWrapper> listUuidAndTitleCacheByAssociatedTaxon(List<UUID> taxonNodeUuids,\r
+            Integer limit, Integer start);\r
+\r
+\r
     /**\r
      * Lists all instances of {@link FieldUnit} which are\r
      * associated <b>directly or indirectly</b>with the <code>taxon</code> specified\r
@@ -236,7 +308,12 @@ public interface IOccurrenceService extends IIdentifiableEntityService<SpecimenO
      * @param propertyPaths\r
      * @return\r
      */\r
-    public Collection<FieldUnit> listFieldUnitsByAssociatedTaxon(Set<TaxonRelationshipEdge> includeRelationships,\r
+    public Collection<SpecimenOrObservationBase> listFieldUnitsByAssociatedTaxon(Taxon associatedTaxon, List<OrderHint> orderHints, List<String> propertyPaths);\r
+\r
+    /**\r
+     * See {@link #listFieldUnitsByAssociatedTaxon(Set, Taxon, Integer, Integer, Integer, List, List)}\r
+     */\r
+    public Pager<SpecimenOrObservationBase> pageFieldUnitsByAssociatedTaxon(Set<TaxonRelationshipEdge> includeRelationships,\r
             Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);\r
 \r
     /**\r
@@ -258,10 +335,11 @@ public interface IOccurrenceService extends IIdentifiableEntityService<SpecimenO
     /**\r
      * Retrieves all {@link FieldUnit}s for the {@link SpecimenOrObservationBase} with the given {@link UUID}.<br>\r
      * @param specimenUuid the UUID of the specimen\r
+     * @param propertyPaths the property path\r
      * @return either a collection of FieldUnits this specimen was derived from, the FieldUnit itself\r
      * if this was a FieldUnit or an empty collection if no FieldUnits were found\r
      */\r
-    public Collection<FieldUnit> getFieldUnits(UUID specimenUuid);\r
+    public Collection<FieldUnit> findFieldUnits(UUID specimenUuid, List<String> propertyPaths);\r
 \r
     /**\r
      * @param clazz\r
@@ -278,9 +356,9 @@ public interface IOccurrenceService extends IIdentifiableEntityService<SpecimenO
      * @throws ParseException\r
      */\r
     Pager<SearchResult<SpecimenOrObservationBase>> findByFullText(Class<? extends SpecimenOrObservationBase> clazz,\r
-            String queryString, Rectangle boundingBox, List<Language> languages, boolean highlightFragments, Integer pageSize,\r
-            Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) throws CorruptIndexException,\r
-            IOException, ParseException;\r
+            String queryString, Rectangle boundingBox, List<Language> languages, boolean highlightFragments,\r
+            Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)\r
+            throws IOException, LuceneParseException;\r
     /**\r
      * See {@link #listByAssociatedTaxon(Class, Set, String, Integer, Integer, Integer, List, List)}\r
      *\r
@@ -304,7 +382,16 @@ public interface IOccurrenceService extends IIdentifiableEntityService<SpecimenO
      * @param sequence the Sequence to move\r
      * @return <code>true</code> if successfully moved, <code>false</code> otherwise\r
      */\r
-    public boolean moveSequence(DnaSample from, DnaSample to, Sequence sequence);\r
+    public UpdateResult moveSequence(DnaSample from, DnaSample to, Sequence sequence);\r
+\r
+\r
+    /**\r
+     * @param fromUuid\r
+     * @param toUuid\r
+     * @param sequenceUuid\r
+     * @return\r
+     */\r
+    public UpdateResult moveSequence(UUID fromUuid, UUID toUuid, UUID sequenceUuid);\r
 \r
     /**\r
      * Moves the given {@link DerivedUnit} from one {@link SpecimenOrObservationBase} to another.\r
@@ -313,29 +400,330 @@ public interface IOccurrenceService extends IIdentifiableEntityService<SpecimenO
      * @param derivate the DerivedUnit to move\r
      * @return <code>true</code> if successfully moved, <code>false</code> otherwise\r
      */\r
+    public UpdateResult moveDerivate(UUID specimenFromUuid, UUID specimenToUuid, UUID derivateUuid);\r
+\r
+    /**\r
+     * @param from\r
+     * @param to\r
+     * @param derivate\r
+     * @return\r
+     */\r
     public boolean moveDerivate(SpecimenOrObservationBase<?> from, SpecimenOrObservationBase<?> to, DerivedUnit derivate);\r
 \r
     /**\r
-     * Assembles a {@link DerivateHierarchyDTO} for the given field unit uuid which is associated to the {@link Taxon}.<br>\r
-     * <br>\r
-     * For the meaning of "associated" see also {@link #listFieldUnitsByAssociatedTaxon(Set, Taxon, Integer, Integer, Integer, List, List)}\r
+     * Assembles a {@link FieldUnitDTO} for the given field unit.<br>\r
+     *\r
      * @param fieldUnit\r
-     * @param associatedTaxonUuid\r
-     * @return\r
+     * @return a DTO with all the assembled information\r
      */\r
-    public DerivateHierarchyDTO assembleDerivateHierarchyDTO(FieldUnit fieldUnit, UUID associatedTaxonUuid);\r
+    public FieldUnitDTO assembleFieldUnitDTO(FieldUnit fieldUnit);\r
 \r
     /**\r
-     * Returns a collection of {@link ICdmBase}s that are not persisted via cascading when saving the given specimen (mostly DefinedTerms).\r
-     * @param specimen the specimen that is checked for non-cascaded elements.\r
-     * @return collection of non-cascaded element associated with the specimen\r
+     * Assembles a {@link PreservedSpecimenDTO} for the given derived unit.\r
+     * @param derivedUnit\r
+     * @return a DTO with all the assembled information\r
      */\r
-    public Collection<ICdmBase> getNonCascadedAssociatedElements(SpecimenOrObservationBase<?> specimen);\r
+    public PreservedSpecimenDTO assemblePreservedSpecimenDTO(DerivedUnit derivedUnit);\r
 \r
     /**\r
-     * Deletes the specified specimen and all sub derivates.\r
-     * @param from the specimen which should be deleted with all its sub derivates\r
+     * Deletes the specified specimen according to the setting in the {@link SpecimenDeleteConfigurator}.<br>\r
+     * @param specimen the specimen which shoul be deleted\r
+     * @param config specifies options if and how the specimen should be deleted like e.g. including all\r
+     * of its children\r
      * @return the {@link DeleteResult} which holds information about the outcome of this operation\r
      */\r
-    public DeleteResult deleteDerivateHierarchy(ICdmBase from);\r
+    public DeleteResult delete(SpecimenOrObservationBase<?> specimen, SpecimenDeleteConfigurator config);\r
+\r
+    /**\r
+     * Deletes the specified specimen belonging to the given {@link UUID}\r
+     * according to the setting in the {@link SpecimenDeleteConfigurator}.\r
+     *\r
+     * @param specimen\r
+     *            the specimen which shoul be deleted\r
+     * @param config\r
+     *            specifies options if and how the specimen should be deleted\r
+     *            like e.g. including all of its children\r
+     * @return the {@link DeleteResult} which holds information about the\r
+     *         outcome of this operation\r
+     */\r
+    public DeleteResult delete(UUID specimenUuid, SpecimenDeleteConfigurator config);\r
+\r
+    /**\r
+     * Retrieves all {@link IndividualsAssociation} with the given specimen.<br>\r
+     * @param specimen the specimen for which the associations are retrieved\r
+     * @param limit\r
+     * @param start\r
+     * @param orderHints\r
+     * @param propertyPaths\r
+     * @return collection of all associations\r
+     */\r
+    public Collection<IndividualsAssociation> listIndividualsAssociations(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
+\r
+\r
+    /**\r
+     * Retrieves all taxa linked via {@link IndividualsAssociation} with the given specimen.<br>\r
+     * @param specimen the specimen which is linked to the taxa\r
+     * @param limit\r
+     * @param start\r
+     * @param orderHints\r
+     * @param propertyPaths\r
+     * @return a collection of associated taxa\r
+     */\r
+    public Collection<TaxonBase<?>> listIndividualsAssociationTaxa(SpecimenOrObservationBase<?> specimen,\r
+            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
+    /**\r
+      * @see #listIndividualsAssociationTaxa(SpecimenOrObservationBase, Integer, Integer, List, List)\r
+      */\r
+    public Collection<TaxonBase<?>> listIndividualsAssociationTaxa(SpecimenOrObservationBase<?> specimen, boolean includeUnpublished,\r
+            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
+\r
+    /**\r
+     * Retrieves all associated taxa for the given specimen (via type designations, determination, individuals associations)\r
+     * @param specimen\r
+     * @param limit\r
+     * @param start\r
+     * @param orderHints\r
+     * @param propertyPaths\r
+     * @return\r
+     */\r
+    public Collection<TaxonBase<?>> listAssociatedTaxa(SpecimenOrObservationBase<?> specimen, boolean includeUnpublished,\r
+            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
+    /**\r
+     * @see #listAssociatedTaxa(SpecimenOrObservationBase, Integer, Integer, List, List)axa\r
+     */\r
+    public Collection<TaxonBase<?>> listAssociatedTaxa(SpecimenOrObservationBase<?> specimen,\r
+            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
+\r
+    /**\r
+     * Retrieves all taxa that the given specimen is determined as\r
+     * @param specimen\r
+     * @param limit\r
+     * @param start\r
+     * @param orderHints\r
+     * @param propertyPaths\r
+     * @return collection of all taxa the given specimen is determined as\r
+     */\r
+    public Collection<TaxonBase<?>> listDeterminedTaxa(SpecimenOrObservationBase<?> specimen, boolean includeUnpublished,\r
+            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
+    /**\r
+     * @see #listDeterminedTaxa(SpecimenOrObservationBase, Integer, Integer, List, List)\r
+     */\r
+    public Collection<TaxonBase<?>> listDeterminedTaxa(SpecimenOrObservationBase<?> specimen,\r
+            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
+\r
+    /**\r
+     * Retrieves all {@link DeterminationEvent}s which have the given specimen set as identified unit.\r
+     * @param specimen\r
+     * @param limit\r
+     * @param start\r
+     * @param orderHints\r
+     * @param propertyPaths\r
+     * @return collection of all determination events with the given specimen\r
+     */\r
+    public Collection<DeterminationEvent> listDeterminationEvents(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
+\r
+    /**\r
+     * Retrieves all taxa with a {@link SpecimenTypeDesignation} with the given specimen as a type specimen.\r
+     * @param specimen the type specimen\r
+     * @param specimen\r
+     * @param limit\r
+     * @param start\r
+     * @param orderHints\r
+     * @param propertyPaths\r
+     * @return a collection of all taxa where the given specimen is the type specimen\r
+     */\r
+    public Collection<TaxonBase<?>> listTypeDesignationTaxa(DerivedUnit specimen,\r
+            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
+    /**\r
+     * @see #listTypeDesignationTaxa(DerivedUnit, Integer, Integer, List, List)a\r
+     */\r
+    public Collection<TaxonBase<?>> listTypeDesignationTaxa(DerivedUnit specimen, boolean includeUnpublished,\r
+            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
+\r
+    /**\r
+     * Retrieves all {@link SpecimenTypeDesignation}s which have the given specimens as a type specimen.\r
+     * @param specimens the type specimens\r
+     * @param limit\r
+     * @param start\r
+     * @param orderHints\r
+     * @param propertyPaths\r
+     * @return map of all designations with the given type specimens\r
+     */\r
+    public Map<DerivedUnit, Collection<SpecimenTypeDesignation>> listTypeDesignations(Collection<DerivedUnit> specimens, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
+\r
+    /**\r
+     * Retrieves all {@link SpecimenTypeDesignation}s which have the given specimen as a type specimen.\r
+     * @param specimen the type specimen\r
+     * @param limit\r
+     * @param start\r
+     * @param orderHints\r
+     * @param propertyPaths\r
+     * @return collection of all designations with the given type specimen\r
+     */\r
+    public Collection<SpecimenTypeDesignation> listTypeDesignations(DerivedUnit specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
+\r
+    /**\r
+     * Retrieves all {@link DescriptionBase}s that have the given specimen set as described specimen.\r
+     * @param specimen the described specimen\r
+     * @param limit\r
+     * @param start\r
+     * @param orderHints\r
+     * @param propertyPaths\r
+     * @return collection of all descriptions with the given described specimen\r
+     */\r
+    public Collection<DescriptionBase<?>> listDescriptionsWithDescriptionSpecimen(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);\r
+\r
+    /**\r
+     * Gets all description elements that are used for describing the character\r
+     * states of the given specimen\r
+     *\r
+     * @param specimen\r
+     *            the specimen for which the character state description\r
+     *            elements should be retrieved\r
+     * @return a collection of all character state description elements for this\r
+     *         specimen\r
+     */\r
+    public Collection<DescriptionElementBase> getCharacterDataForSpecimen(SpecimenOrObservationBase<?> specimen);\r
+\r
+    /**\r
+     * Gets all description elements that are used for describing the character\r
+     * states of the given specimen\r
+     *\r
+     * @param specimenUuid\r
+     *            the specimen {@link UUID} for which the character state description\r
+     *            elements should be retrieved\r
+     * @return a collection of all character state description elements for this\r
+     *         specimen\r
+     */\r
+    public Collection<DescriptionElementBase> getCharacterDataForSpecimen(UUID specimenUuid);\r
+\r
+    /**\r
+     * Returns the most significant identifier for the given {@link DerivedUnit}.\r
+     * @param derivedUnit the derived unit to check\r
+     * @return the identifier string\r
+     */\r
+    public String getMostSignificantIdentifier(DerivedUnit derivedUnit);\r
+\r
+    /**\r
+     * Returns the number of specimens that match the given parameters\r
+     * <br>\r
+     * <b>NOTE - issue #6484:</b> the parameters {@link FindOccurrencesConfigurator#getAssignmentStatus()}\r
+     * and {@link FindOccurrencesConfigurator#isRetrieveIndirectlyAssociatedSpecimens()} are not evaluated\r
+     * in the count method\r
+     * @param clazz the class to match\r
+     * @param queryString the queryString to match\r
+     * @param type the {@link SpecimenOrObservationType} to match\r
+     * @param associatedTaxon the taxon these specimens are in any way associated to via\r
+     * determination, type designations, individuals associations, etc.\r
+     * @param matchmode determines how the query string should be matched\r
+     * @param limit\r
+     *            the maximum number of entities returned (can be null to return\r
+     *            all entities)\r
+     * @param start\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
+     * @return the number of found specimens\r
+     */\r
+    public long countOccurrences(IIdentifiableEntityServiceConfigurator<SpecimenOrObservationBase> config);\r
+\r
+    /**\r
+     * Return the all {@link SpecimenOrObservationBase}s of the complete\r
+     * derivative hierarchy i.e. all parent and child derivatives and the given\r
+     * specimen itself.\r
+     *\r
+     * @param specimen\r
+     *            a specimen or observation\r
+     * @return the derivative hierarchy as an unordered list of all specimens or observation\r
+     */\r
+    public List<SpecimenOrObservationBase<?>> getAllHierarchyDerivatives(SpecimenOrObservationBase<?> specimen);\r
+\r
+    /**\r
+     * Returns all child derivatives of the given specimen.\r
+     * @param specimen a specimen or observation\r
+     * @return an unordered list of all child derivatives\r
+     */\r
+    public List<DerivedUnit> getAllChildDerivatives(SpecimenOrObservationBase<?> specimen);\r
+\r
+    /**\r
+     * Returns all child derivatives of the given specimen.\r
+     * @param specimen the UUID of a specimen or observation\r
+     * @return an unordered list of all child derivatives\r
+     */\r
+    public List<DerivedUnit> getAllChildDerivatives(UUID specimenUuid);\r
+\r
+    /**\r
+     * Returns all {@link FieldUnit}s that are referencing this {@link GatheringEvent}\r
+     * @param gatheringEventUuid the {@link UUID} of the gathering event\r
+     * @return a list of field units referencing the gathering event\r
+     */\r
+    public List<FieldUnit> findFieldUnitsForGatheringEvent(UUID gatheringEventUuid);\r
+\r
+\r
+    /**\r
+     * Returns a list of {@link UuidAndTitleCache} for the specimens found with the\r
+     * given configurator\r
+     * @param config the configurator for the search\r
+     * @return a list of UuidAndTitleCache object\r
+     */\r
+    @Transactional(readOnly = true)\r
+    public Pager<UuidAndTitleCache<SpecimenOrObservationBase>> findByTitleUuidAndTitleCache(\r
+            FindOccurrencesConfigurator config);\r
+\r
+    /**\r
+     * Returns a list of {@link PreservedSpecimenDTO} for the specimens found with the\r
+     * given configurator\r
+     * @param config the configurator for the search\r
+     * @return a list of {@link PreservedSpecimenDTO} object\r
+     */\r
+    @Transactional(readOnly = true)\r
+    public List<PreservedSpecimenDTO> findByTitlePreservedSpecimenDTO(\r
+            FindOccurrencesConfigurator config);\r
+\r
+    /**\r
+     * @param queryString\r
+     * @param propertyPaths\r
+     * @return\r
+     * @throws IOException\r
+     */\r
+    FieldUnitDTO findByAccessionNumber(\r
+             String accessionNumberString, List<OrderHint> orderHints,\r
+            List<String> propertyPaths);\r
+\r
+    /**\r
+     * @param includedRelationships\r
+     * @param associatedTaxon\r
+     * @param maxDepth\r
+     * @param pageSize\r
+     * @param pageNumber\r
+     * @param orderHints\r
+     * @param propertyPaths\r
+     * @return\r
+     */\r
+    List<FieldUnitDTO> findFieldUnitDTOByAssociatedTaxon(Set<TaxonRelationshipEdge> includedRelationships,\r
+            UUID associatedTaxonUuid);\r
+\r
+    /**\r
+     * @param derivedUnitUuid\r
+     * @param propertyPaths\r
+     * @return\r
+     */\r
+\r
+    FieldUnitDTO findFieldUnitDTO(DerivateDTO derivedUnitDTO, Collection<FieldUnitDTO> fieldUnits, HashMap<UUID, DerivateDTO> alreadyCollectedSpecimen);\r
+\r
+\r
+    /**\r
+     * @param fieldUnitUuids\r
+     * @return\r
+     */\r
+    public List<Point> findPointsForFieldUnitList(List<UUID> fieldUnitUuids);\r
+\r
+    /**\r
+     * Load the FieldUnitDTO for the given <code>derivedUnitUuid</code> with all intermediate derivatives and {@link eu.etaxonomy.cdm.api.service.dto.GatheringEventDTO}\r
+     * @param derivedUnitUuid\r
+     * @return\r
+     */\r
+    FieldUnitDTO loadFieldUnitDTO(UUID derivedUnitUuid);\r
+\r
 }\r