cleanup
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / ITaxonNodeService.java
old mode 100755 (executable)
new mode 100644 (file)
index 7beaece..a7edf29
@@ -1,4 +1,3 @@
-// $Id$
 /**
 * Copyright (C) 2007 EDIT
 * European Distributed Institute of Taxonomy
@@ -15,13 +14,17 @@ import java.util.List;
 import java.util.Set;
 import java.util.UUID;
 
+import eu.etaxonomy.cdm.api.service.config.SecundumForSubtreeConfigurator;
 import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.dto.TaxonDistributionDTO;
 import eu.etaxonomy.cdm.api.service.pager.Pager;
+import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
+import eu.etaxonomy.cdm.filter.TaxonNodeFilter;
 import eu.etaxonomy.cdm.model.common.DefinedTerm;
 import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
-import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
+import eu.etaxonomy.cdm.model.taxon.SynonymType;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation;
@@ -31,8 +34,7 @@ import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
 
 /**
  * @author n.hoffmann
- * @created Apr 9, 2010
- * @version 1.0
+ * @since Apr 9, 2010
  */
 public interface ITaxonNodeService extends IAnnotatableService<TaxonNode>{
 
@@ -44,7 +46,7 @@ public interface ITaxonNodeService extends IAnnotatableService<TaxonNode>{
         * @param recursive
         * @return List<TaxonNode>
         */
-       public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths, boolean recursive, NodeSortMode sortMode);
+       public List<TaxonNode> loadChildNodesOfTaxonNode(TaxonNode taxonNode, List<String> propertyPaths, boolean recursive,  boolean includeUnpublished, NodeSortMode sortMode);
 
        /**
         * Lists all direct child nodes of the given {@link UuidAndTitleCache} which
@@ -55,6 +57,18 @@ public interface ITaxonNodeService extends IAnnotatableService<TaxonNode>{
         */
        public List<UuidAndTitleCache<TaxonNode>> listChildNodesAsUuidAndTitleCache(UuidAndTitleCache<TaxonNode> parent);
 
+    public List<TaxonNode> listChildrenOf(TaxonNode node, Integer pageSize, Integer pageIndex,
+            boolean recursive, boolean includeUnpublished, List<String> propertyPaths);
+
+       /**
+     * Retrieves a list of {@link UuidAndTitleCache} objects that have a matchin titleCache
+     * @param limit the maximum results
+     * @param pattern the titleCache that is searched for
+     * @param classificationUuid if specified only nodes of this classification are retrieved
+     * @return a list of matches
+     */
+       public List<UuidAndTitleCache<TaxonNode>> getUuidAndTitleCache(Integer limit, String pattern, UUID classificationUuid);
+
     /**
      * Retrieves the parent node of the child {@link TaxonNode}
      * @param child the child for which the parent should be retrieved
@@ -89,7 +103,7 @@ public interface ITaxonNodeService extends IAnnotatableService<TaxonNode>{
      *
      * @return List<TaxonNodeDto>
      */
-    public Pager<TaxonNodeDto> pageChildNodesDTOs(UUID taxonNodeUuid, boolean recursive,
+    public Pager<TaxonNodeDto> pageChildNodesDTOs(UUID taxonNodeUuid, boolean recursive, boolean includeUnpublished,
             boolean doSynonyms, NodeSortMode sortMode,
             Integer pageSize, Integer pageIndex);
 
@@ -101,17 +115,33 @@ public interface ITaxonNodeService extends IAnnotatableService<TaxonNode>{
         *
         * @param oldTaxonNode
         * @param newAcceptedTaxonNode
-        * @param synonymRelationshipType
+        * @param synonymType
         * @param citation
         * @param citationMicroReference
         * @return
         *
         */
-       public DeleteResult makeTaxonNodeASynonymOfAnotherTaxonNode(TaxonNode oldTaxonNode, TaxonNode newAcceptedTaxonNode, SynonymRelationshipType synonymRelationshipType, Reference citation, String citationMicroReference) ;
+       public DeleteResult makeTaxonNodeASynonymOfAnotherTaxonNode(TaxonNode oldTaxonNode, TaxonNode newAcceptedTaxonNode, SynonymType synonymType, Reference citation, String citationMicroReference) ;
+
+       /**
+        * Changes the taxa associated with the given taxon nodes into synonyms of the new accepted taxon node.
+        * All data associated with the former taxa are moved to the newly accepted taxon.
+        *
+        * @param oldTaxonNodes
+        * @param newAcceptedTaxonNode
+        * @param synonymType
+        * @param citation
+        * @param citationMicroReference
+        * @return
+        *
+        */
+       UpdateResult makeTaxonNodeSynonymsOfAnotherTaxonNode(Set<UUID> oldTaxonNodeUuids, UUID newAcceptedTaxonNodeUUIDs,
+                       SynonymType synonymType, Reference citation, String citationMicroReference);
+
 
        public UpdateResult makeTaxonNodeASynonymOfAnotherTaxonNode(UUID oldTaxonNodeUuid,
                UUID newAcceptedTaxonNodeUUID,
-               SynonymRelationshipType synonymRelationshipType,
+               SynonymType synonymType,
                Reference citation,
                String citationMicroReference) ;
 
@@ -168,12 +198,7 @@ public interface ITaxonNodeService extends IAnnotatableService<TaxonNode>{
 
 
 
-    /**
-     * @param taxonNodeUuids
-     * @param newParentNodeUuid
-     * @return
-     */
-    UpdateResult moveTaxonNodes(Set<UUID> taxonNodeUuids, UUID newParentNodeUuid, int movingType);
+
 
     /**
      * @param taxonNode
@@ -222,7 +247,7 @@ public interface ITaxonNodeService extends IAnnotatableService<TaxonNode>{
      * @param relationshipType
      * @return
      */
-    UpdateResult addTaxonNodeAgentRelation(UUID taxonNodeUUID, UUID agentUUID, DefinedTerm relationshipType);
+    public UpdateResult addTaxonNodeAgentRelation(UUID taxonNodeUUID, UUID agentUUID, DefinedTerm relationshipType);
 
     /**
      * @param parentNodeUuid
@@ -231,7 +256,115 @@ public interface ITaxonNodeService extends IAnnotatableService<TaxonNode>{
      * @param microref
      * @return
      */
-    UpdateResult createNewTaxonNode(UUID parentNodeUuid, UUID taxonUuid, Reference ref, String microref);
+    public UpdateResult createNewTaxonNode(UUID parentNodeUuid, UUID taxonUuid, Reference ref, String microref);
+
+    /**
+     * Sets the secundum reference for all taxa of the given subtree.
+     * Depending on the configuration, also synonym secundum will be set.
+     * See {@link SetSecundumForSubtreeConfigurator} for further configuration
+     * options.
+     * @param b
+     * @param configurator
+     * @return UpdateResult
+     */
+    public UpdateResult setSecundumForSubtree(SecundumForSubtreeConfigurator config);
+
+
+    /**
+     * Sets the publish flag for all taxa and/or synonyms of the subtree.
+     * @param subtreeUuid
+     * @param publish
+     * @param includeAcceptedTaxa
+     * @param includeSynonyms
+     * @param overwriteExistingAccepted
+     * @param overwriteExistingSynonyms
+     * @param includeSharedTaxa
+     * @param progressMonitor
+     * @return
+     */
+    public UpdateResult setPublishForSubtree(UUID subtreeUuid, boolean publish, boolean includeAcceptedTaxa,
+            boolean includeSynonyms, boolean includeSharedTaxa, IProgressMonitor progressMonitor);
+
+
+    /**
+     * Returns a list of taxon node {@link UUID uuids} according to the given filter.
+     * @param filter
+     * @return
+     */
+    public long count(TaxonNodeFilter filter);
+
+    /**
+     * Returns a list of taxon node {@link UUID uuids} according to the given filter.
+     * @param filter
+     * @return
+     */
+    public List<UUID> uuidList(TaxonNodeFilter filter);
+
+    /**
+     * Returns a list of taxon node IDs according to the given filter.
+     * @param filter
+     * @return
+     */
+    public List<Integer> idList(TaxonNodeFilter filter);
+
+//    /**
+//     * @param configurator
+//     * @return
+//     */
+//    UUID monitSetSecundum(SecundumForSubtreeConfigurator configurator);
+
+
+    /**
+     * @param parent
+     * @return
+     */
+    List<TaxonNodeDto> listChildNodesAsTaxonNodeDto(UuidAndTitleCache<TaxonNode> parent);
+
+    /**
+     * @param parent
+     * @return
+     */
+    List<TaxonNodeDto> listChildNodesAsTaxonNodeDto(ITaxonTreeNode parent);
+
+    /**
+     * @param taxonNodeUuids
+     * @param newParentNodeUuid
+     * @param movingType
+     * @param monitor
+     * @return
+     */
+    UpdateResult moveTaxonNodes(Set<UUID> taxonNodeUuids, UUID newParentNodeUuid, int movingType,
+            IProgressMonitor monitor);
+
+    /**
+     * Retrieves the first taxon node that is direct or indirect parent
+     * to all nodes of the given list of nodes. This can also return
+     * the root node of a classification<br>
+     * If no common parent node could be found <code>null</code> is returned.
+     * @param nodes the direct/indirect child taxon nodes for which the common
+     * parent should be retrieved
+     * @return the common direct/indirect parent of all nodes
+     */
+    public TaxonNodeDto findCommonParentDto(Collection<TaxonNodeDto> nodes);
+
+    /**
+     * @param taxonNodeUuid
+     * @return
+     */
+    TaxonNodeDto dto(UUID taxonNodeUuid);
 
+    /**
+     * @param parentNodeUuid
+     * @param areas
+     * @return
+     */
+    List<TaxonDistributionDTO> getTaxonDistributionDTOForSubtree(UUID parentNodeUuid, List<String> propertyPaths);
+
+    /**
+     * @param parentNodeUuid
+     * @param newTaxonNode
+     * @return
+     */
+    UpdateResult saveNewTaxonNode(TaxonNode newTaxonNode);
 
 }