remove unused property path
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / IClassificationService.java
index 96e32f7af52e341d018f40e71acfee8111475683..2ce702aee90d59e357362bba55892ed7b36fc28c 100644 (file)
@@ -1,4 +1,3 @@
-// $Id$
 /**
 * Copyright (C) 2007 EDIT
 * European Distributed Institute of Taxonomy
@@ -16,45 +15,43 @@ import java.util.Map;
 import java.util.UUID;
 
 import eu.etaxonomy.cdm.api.service.config.CreateHierarchyForClassificationConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.dto.GroupedTaxonDTO;
+import eu.etaxonomy.cdm.api.service.dto.TaxonInContextDTO;
 import eu.etaxonomy.cdm.api.service.pager.Pager;
+import eu.etaxonomy.cdm.compare.taxon.TaxonNodeSortMode;
+import eu.etaxonomy.cdm.exception.FilterException;
+import eu.etaxonomy.cdm.exception.UnpublishedException;
+import eu.etaxonomy.cdm.model.common.MarkerType;
 import eu.etaxonomy.cdm.model.media.MediaRepresentation;
 import eu.etaxonomy.cdm.model.name.Rank;
 import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.persistence.dto.ClassificationLookupDTO;
+import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
 import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
 import eu.etaxonomy.cdm.persistence.query.OrderHint;
 
 
 /**
  * @author n.hoffmann
- * @created Sep 21, 2009
+ * @since Sep 21, 2009
  */
 public interface IClassificationService extends IIdentifiableEntityService<Classification> {
 
-    /**
-     *
-     * @param uuid
-     * @return
-     */
-    public TaxonNode getTaxonNodeByUuid(UUID uuid);
-
-    /**
-     *
-     * @param uuid
-     * @return
-     */
     public ITaxonTreeNode getTreeNodeByUuid(UUID uuid);
 
     /**
-     *
-     * @param limit
-     * @param start
-     * @param orderHints
-     * @param propertyPaths
-     * @return
+     * Returns the root node of the the given classification (specified by its UUID)
+     * @param classificationUuid the uuid of the classification
+     * @return the root node of the classification
      */
+    public TaxonNode getRootNode(UUID classificationUuid);
+
+    public UUID getTaxonNodeUuidByTaxonUuid(UUID classificationUuid, UUID taxonUuid);
+
     public List<Classification> listClassifications(Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
 
     /**
@@ -70,14 +67,28 @@ public interface IClassificationService extends IIdentifiableEntityService<Class
     public TaxonNode loadTaxonNodeByTaxon(Taxon taxon, UUID classificationUuid, List<String> propertyPaths);
 
     /**
+     * Loads all TaxonNodes of the specified classification for a given Rank or lower.
+     * If a branch of the classification tree is not containing a TaxonNode with a Taxon at the given
+     * Rank the according node associated with the next lower Rank is taken as root node in this case.
+     * So the nodes returned may reference Taxa with different Ranks.
      *
-     * @param taxonNode
+     * If the <code>rank</code> is null the absolute root nodes will be returned.
+
+     * @param classification may be null for all classifications
+     * @param subtree filter on a taxonomic subtree
+     * @param rank the set to null for to get the root nodes of classifications
+     * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
+     * @param pageSize The maximum number of relationships returned (can be null for all relationships)
+     * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
      * @param propertyPaths
      * @return
-     * @deprecated use TaxonNodeService instead
+     * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
+     * @deprecated use according DTO method instead
      */
     @Deprecated
-    public TaxonNode loadTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
+    public List<TaxonNode> listRankSpecificRootNodes(Classification classification, TaxonNode subtree,
+            Rank rank, boolean includeUnpublished, Integer pageSize, Integer pageIndex,
+            List<String> propertyPaths);
 
     /**
      * Loads all TaxonNodes of the specified classification for a given Rank or lower.
@@ -86,16 +97,21 @@ public interface IClassificationService extends IIdentifiableEntityService<Class
      * So the nodes returned may reference Taxa with different Ranks.
      *
      * If the <code>rank</code> is null the absolute root nodes will be returned.
-     *
+
      * @param classification may be null for all classifications
+     * @param subtree filter on a taxonomic subtree
      * @param rank the set to null for to get the root nodes of classifications
+     * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
      * @param pageSize The maximum number of relationships returned (can be null for all relationships)
      * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
      * @param propertyPaths
      * @return
+     * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
      *
      */
-    public List<TaxonNode> listRankSpecificRootNodes(Classification classification, Rank rank, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
+    public List<TaxonNodeDto> listRankSpecificRootNodeDtos(Classification classification, TaxonNode subtree,
+            Rank rank, boolean includeUnpublished, Integer pageSize, Integer pageIndex, TaxonNodeDtoSortMode sortMode,
+            List<String> propertyPaths);
 
 
     /**
@@ -107,14 +123,27 @@ public interface IClassificationService extends IIdentifiableEntityService<Class
      * If the <code>rank</code> is null the absolute root nodes will be returned.
      *
      * @param classification may be null for all classifications
+     * @param subtree the taxonomic subtree filter
      * @param rank the set to null for to get the root nodes of classifications
+     * @param includeUnpublished if <code>true</code> unpublished taxa are also exported
      * @param pageSize The maximum number of relationships returned (can be null for all relationships)
      * @param pageIndex The offset (in pageSize chunks) from the start of the result set (0 - based)
      * @param propertyPaths
      * @return
      *
+     * @see #listRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
+     */
+    public Pager<TaxonNode> pageRankSpecificRootNodes(Classification classification, TaxonNode subtree,
+            Rank rank, boolean includeUnpublished, Integer pageSize, Integer pageIndex,
+            List<String> propertyPaths);
+    /**
+     * @see #pageRankSpecificRootNodes(Classification, TaxonNode, Rank, boolean, Integer, Integer, List)
+     * @deprecated keep this for compatibility to older versions, might be removed in versions >5.3
      */
-    public Pager<TaxonNode> pageRankSpecificRootNodes(Classification classification, Rank rank, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
+    @Deprecated
+    public Pager<TaxonNode> pageRankSpecificRootNodes(Classification classification,
+            Rank rank, boolean includeUnpublished, Integer pageSize, Integer pageIndex,
+            List<String> propertyPaths);
 
     /**
      * @param taxonNode
@@ -126,10 +155,18 @@ public interface IClassificationService extends IIdentifiableEntityService<Class
      * @param propertyPaths
      *            the initialization strategy for the returned TaxonNode
      *            instances.
+     * @param includeUnpublished
+     *            if <code>true</code> no {@link UnpublishedException}
+     *            is thrown if any of the taxa in the branch are unpublished
      * @return the path of nodes from the <b>base node</b> to the node of the
-     *         specified taxon.
+     *            specified taxon.
+     * @throws UnpublishedException
+     *            if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown.
      */
-    public List<TaxonNode> loadTreeBranch(TaxonNode taxonNode, Rank baseRank, List<String> propertyPaths);
+    public List<TaxonNode> loadTreeBranch(TaxonNode taxonNode, TaxonNode subtree, Rank baseRank, boolean includeUnpublished,
+            List<String> propertyPaths) throws UnpublishedException;
+    public List<TaxonNode> loadTreeBranch(TaxonNode taxonNode, Rank baseRank, boolean includeUnpublished,
+            List<String> propertyPaths) throws UnpublishedException;
 
     /**
      * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
@@ -144,23 +181,61 @@ public interface IClassificationService extends IIdentifiableEntityService<Class
      *            Nodes of this rank or in case this rank does not exist in the
      *            current branch the next lower rank is taken as as root node for
      *            this rank henceforth called the <b>base node</b>.
+     * @param includeUnpublished
+     *            if <code>true</code> no {@link UnpublishedException}
+     *            is thrown if any of the taxa in the branch are unpublished
      * @param propertyPaths
      *            the initialization strategy for the returned TaxonNode
      *            instances.
      * @return the path of nodes from the <b>base node</b> to the node of the specified
-     *         taxon.
+     *            taxon.
+     * @throws UnpublishedException
+     *            if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown
      */
-    public List<TaxonNode> loadTreeBranchToTaxon(Taxon taxon, Classification classification, Rank baseRank, List<String> propertyPaths);
-
-
+    public List<TaxonNode> loadTreeBranchToTaxon(Taxon taxon, Classification classification,
+            TaxonNode subtree, Rank baseRank,
+            boolean includeUnpublished, List<String> propertyPaths) throws UnpublishedException;
 
     /**
-     * @param taxonUuid
-     * @param classificationUuid
+     * Although this method seems to be a redundant alternative to {@link #loadChildNodesOfTaxonNode(TaxonNode, List)} it is an important
+     * alternative from which web services benefit. Without this method the web service controller method, which operates outside of the
+     * transaction, would have to initialize the full taxon tree with all nodes of the taxon.
+     * This would be rather slow compared to using this method.
+     * @param taxon
+     * @param classification
+     *            the classification to be used
+     * @param baseRank
+     *            specifies the root level of the classification, may be null.
+     *            Nodes of this rank or in case this rank does not exist in the
+     *            current branch the next lower rank is taken as as root node for
+     *            this rank henceforth called the <b>base node</b>.
+     * @param includeUnpublished
+     *            if <code>true</code> no {@link UnpublishedException}
+     *            is thrown if any of the taxa in the branch are unpublished
      * @param propertyPaths
-     * @return
+     *            the initialization strategy for the returned TaxonNode
+     *            instances.
+     * @return the path of nodes from the <b>base node</b> to the node of the specified
+     *            taxon.
+     * @throws UnpublishedException
+     *            if any of the taxa in the path is unpublished an {@link UnpublishedException} is thrown
      */
-    public List<TaxonNode> listChildNodesOfTaxon(UUID taxonUuid, UUID classificationUuid, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
+    public List<TaxonNodeDto> loadTreeBranchDTOsToTaxon(Taxon taxon, Classification classification,
+            TaxonNode subtree, Rank baseRank,
+            boolean includeUnpublished, List<String> propertyPaths) throws UnpublishedException;
+
+    public List<TaxonNode> loadTreeBranchToTaxon(Taxon taxon, Classification classification,
+            Rank baseRank,
+            boolean includeUnpublished, List<String> propertyPaths) throws UnpublishedException;
+
+    public List<TaxonNode> listChildNodesOfTaxon(UUID taxonUuid, UUID classificationUuid, boolean includeUnpublished,
+            Integer pageSize, Integer pageIndex, List<String> propertyPaths);
+
+    public List<TaxonNode> listChildNodesOfTaxon(UUID taxonUuid, UUID classificationUuid, UUID subtreeUuid, boolean includeUnpublished,
+            Integer pageSize, Integer pageIndex, List<String> propertyPaths) throws FilterException;
+
+    public List<TaxonNodeDto> listChildNodeDtosOfTaxon(UUID taxonUuid, UUID classificationUuid, UUID subtreeUuid, boolean includeUnpublished,
+            Integer pageSize, Integer pageIndex, TaxonNodeDtoSortMode comparator) throws FilterException;
 
     /**
      * @param taxonNode
@@ -171,61 +246,12 @@ public interface IClassificationService extends IIdentifiableEntityService<Class
     @Deprecated
     public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths);
 
-    /**
-     *
-     * @param classification
-     * @return
-     */
-    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification, List<UUID> excludeTaxa);
+    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification);
 
-    /**
-     * @param taxon
-     * @param taxTree
-     * @param propertyPaths
-     * @param size
-     * @param height
-     * @param widthOrDuration
-     * @param mimeTypes
-     * @return
-     *
-     * @deprecated use getAllMediaForChildNodes(TaxonNode taxonNode, ...) instead
-     * if you have a classification and a taxon that is in it, you should also have the according taxonNode
-     */
-    @Deprecated
-    public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(Taxon taxon, Classification taxTree, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
-
-    /**
-     *
-     * @param taxonNode
-     * @param propertyPaths
-     * @param size
-     * @param height
-     * @param widthOrDuration
-     * @param mimeTypes
-     * @return
-     */
+    //FIXME seems not to be used anymore
     public Map<UUID, List<MediaRepresentation>> getAllMediaForChildNodes(TaxonNode taxonNode, List<String> propertyPaths, int size, int height, int widthOrDuration, String[] mimeTypes);
 
     /**
-     *
-     * @param taxonNode
-     * @return
-     * @deprecated use TaxonNodeService instead
-     */
-    @Deprecated
-    public UUID removeTaxonNode(TaxonNode taxonNode);
-
-    /**
-     *
-     * @param taxonNode
-     * @return
-     * @deprecated use TaxonNodeService instead
-     */
-    @Deprecated
-    public UUID saveTaxonNode(TaxonNode taxonNode);
-
-    /**
-     *
      * @param taxonNodeCollection
      * @return
      * @deprecated use TaxonNodeService instead
@@ -233,74 +259,67 @@ public interface IClassificationService extends IIdentifiableEntityService<Class
     @Deprecated
     public Map<UUID, TaxonNode> saveTaxonNodeAll(Collection<TaxonNode> taxonNodeCollection);
 
-    /**
-     *
-     * @param treeNode
-     * @return
-     */
-
     public UUID removeTreeNode(ITaxonTreeNode treeNode);
 
-    /**
-     *
-     * @param treeNode
-     * @return
-     */
     public UUID saveTreeNode(ITaxonTreeNode treeNode);
 
-
     public List<TaxonNode> getAllNodes();
 
        public UpdateResult createHierarchyInClassification(Classification classification, CreateHierarchyForClassificationConfigurator configurator);
 
-    /**
-     * @param classificationUuid
-     * @param excludeTaxa
-     * @return
-     */
-    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(UUID classificationUuid, List<UUID> excludeTaxa);
+    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(UUID classificationUuid);
 
-    /**
-     * @param classificationUuid
-     * @param excludeTaxa
-     * @param limit
-     * @param pattern
-     * @return
-     */
-    List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
-            UUID classificationUuid, List<UUID> excludeTaxa, Integer limit, String pattern);
+    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
+            UUID classificationUuid, Integer limit, String pattern);
 
-    /**
-     * @param classification
-     * @param excludeTaxa
-     * @param limit
-     * @param pattern
-     * @return
-     */
-    List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
-            Classification classification, List<UUID> excludeTaxa, Integer limit, String pattern);
+    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
+            Classification classification, Integer limit, String pattern);
+
+    public List<TaxonNode> listSiblingsOfTaxon(UUID taxonUuid, UUID classificationUuid, boolean includeUnpublished,
+            Integer pageSize, Integer pageIndex, List<String> propertyPaths);
+
+    public Pager<TaxonNode> pageSiblingsOfTaxon(UUID taxonUuid, UUID classificationUuid, boolean includeUnpublished, Integer pageSize, Integer pageIndex,
+            List<String> propertyPaths);
+
+    public ClassificationLookupDTO classificationLookup(Classification classification);
+
+    public DeleteResult delete(UUID classificationUuid, TaxonDeletionConfigurator config);
 
     /**
-     * @param taxonUuid
-     * @param classificationUuid
-     * @param pageSize
-     * @param pageIndex
-     * @param propertyPaths
-     * @return
+     * Returns the higher taxon id for each taxon in taxonUuids.
+     * The highter taxon is defined by rank where the lowest rank equal or above minRank
+     * is taken. If maxRank <> null and no taxon exists with minRank <= rank <= maxRank
+     * no higher taxon is returned for this taxon.
      */
-    List<TaxonNode> listSiblingsOfTaxon(UUID taxonUuid, UUID classificationUuid, Integer pageSize, Integer pageIndex,
-            List<String> propertyPaths);
+    public List<GroupedTaxonDTO> groupTaxaByHigherTaxon(List<UUID> taxonUuids, UUID classificationUuid, Rank minRank, Rank maxRank);
+
+    public List<GroupedTaxonDTO> groupTaxaByMarkedParents(List<UUID> taxonUuids, UUID classificationUuid,
+            MarkerType markerType, Boolean value);
 
     /**
-     * @param taxonUuid
-     * @param classificationUuid
-     * @param pageSize
-     * @param pageIndex
-     * @param propertyPaths
-     * @return
+     * Returns the most relevant data of a taxon/taxon node, including children, synonyms
+     * and certain ancestors if required.
      */
-    Pager<TaxonNode> pageSiblingsOfTaxon(UUID taxonUuid, UUID classificationUuid, Integer pageSize, Integer pageIndex,
-            List<String> propertyPaths);
+    public TaxonInContextDTO getTaxonInContext(UUID classificationUuid, UUID taxonUuid,
+            Boolean doChildren, Boolean doSynonyms, boolean includeUnpublished, List<UUID> ancestorMarkers,
+            TaxonNodeSortMode sortMode);
+
+    public UUID saveClassification(Classification classification);
+
+    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
+            UUID classificationUuid, Integer limit, String pattern, boolean searchForClassifications);
 
+    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
+            Classification classification, Integer limit, String pattern, boolean searchForClassifications);
+
+    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
+            UUID classificationUuid, boolean searchForClassifications);
+
+    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
+            Classification classification, boolean searchForClassifications);
+
+    List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
+            UUID classificationUuid, Integer limit, String pattern, boolean searchForClassifications,
+            boolean includeDoubtful);
 
 }