2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.cdm
.api
.service
.config
;
11 import java
.util
.UUID
;
13 import org
.apache
.logging
.log4j
.LogManager
;
14 import org
.apache
.logging
.log4j
.Logger
;
16 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonService
;
17 import eu
.etaxonomy
.cdm
.model
.description
.TaxonDescription
;
18 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
19 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
21 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
24 * This class is used to configure taxon node deletion.
25 * It is initialized with the following default settings:
27 * <li> deleteSynonymRelations: <b>true</b></li>
28 * <li> deleteSynonymsIfPossible: <b>true</b></li>
29 * <li> deleteMisappliedNamesAndInvalidDesignations: <b>true</b></li>
30 * <li> deleteNameIfPossible: <b>true</b></li>
31 * <li> nameDeletionConfig: see {@link NameDeletionConfigurator}</li>
32 * <li> taxonNodeConfig: see {@link TaxonNodeDeletionConfigurator}</li>
33 * <li> deleteTaxonNodes: <b>true</b></li>
34 * <li> deleteTaxonRelationships: <b>true</b>; </li>
35 * <li> deleteDescriptions: <b>true</b></li>
36 * <li> deleteInAllClassifications: <b>true</b></li>
39 * @see ITaxonService#deleteTaxon(eu.etaxonomy.cdm.model.taxon.Taxon)
44 public class TaxonDeletionConfigurator
extends TaxonBaseDeletionConfigurator
{
46 private static final long serialVersionUID
= -4932682946459109886L;
47 @SuppressWarnings("unused")
48 private static final Logger logger
= LogManager
.getLogger();
50 private boolean deleteSynonymsIfPossible
= true;
52 private boolean deleteMisappliedNames
= true;
54 private boolean deleteConceptRelationships
= false;
56 //private NameDeletionConfigurator nameDeletionConfig = new NameDeletionConfigurator();
58 private TaxonNodeDeletionConfigurator taxonNodeConfig
= new TaxonNodeDeletionConfigurator();
60 private boolean deleteTaxonNodes
= true;
62 private boolean deleteTaxonRelationships
= true;
64 private boolean deleteDescriptions
= true;
66 private boolean deleteInAllClassifications
= false;
68 private UUID classificationUuid
= null;
71 public boolean isDeleteInAllClassifications() {
72 return deleteInAllClassifications
;
74 public void setDeleteInAllClassifications(boolean deleteInAllClassifications
) {
75 this.deleteInAllClassifications
= deleteInAllClassifications
;
79 * If <code>true</code> related taxa with {@link TaxonRelationshipType} misappliedName
80 * will be removed if possible.<BR>
81 * It is possible to remove a related taxon if it is not used in any other context, e.g. any
82 * other @link {@link TaxonRelationship} or in another @link {@link Classification}
85 public boolean isDeleteMisappliedNames() {
86 return deleteMisappliedNames
;
88 public void setDeleteMisappliedNames(
89 boolean deleteMisappliedNames
) {
90 this.deleteMisappliedNames
= deleteMisappliedNames
;
94 * The configurator for node deletion. Only evaluated if {@link #isDeleteNode()}
95 * is <code>true</code>.
96 * @see TaxonNodeDeletionConfigurator
97 * @see #isDeleteNode()
98 * @see #isDeleteSynonymsIfPossible()
102 public TaxonNodeDeletionConfigurator
getTaxonNodeConfig() {
103 return taxonNodeConfig
;
105 public void setTaxonNodeConfig(TaxonNodeDeletionConfigurator taxonNodeConfig
) {
106 this.taxonNodeConfig
= taxonNodeConfig
;
110 * If <code>true</code> synonyms will be removed if possible but only if {@link #isDeleteSynonymRelations()}
111 * is also <code>true</code>.
112 * It is possible to remove a synonym if it is not used in any other context
115 public boolean isDeleteSynonymsIfPossible() {
116 return deleteSynonymsIfPossible
;
118 public void setDeleteSynonymsIfPossible(boolean deleteSynonymsIfPossible
) {
119 this.deleteSynonymsIfPossible
= deleteSynonymsIfPossible
;
123 * If <code>true</code> all {@link TaxonNode taxon nodes} this taxon belongs to
124 * are deleted. If <code>false</code> an exception is thrown if this taxon belongs
128 public boolean isDeleteTaxonNodes() {
129 return deleteTaxonNodes
;
131 public void setDeleteTaxonNodes(boolean deleteTaxonNodes
) {
132 this.deleteTaxonNodes
= deleteTaxonNodes
;
136 * If <code>true</code> all {@link TaxonRelationship taxon relationships} linked to
137 * the taxon are removed.
139 // TODO how to handle missapllied names
140 public boolean isDeleteTaxonRelationships() {
141 return deleteTaxonRelationships
;
143 public void setDeleteTaxonRelationships(boolean deleteTaxonRelationships
) {
144 this.deleteTaxonRelationships
= deleteTaxonRelationships
;
148 * If <code>true</code> all {@link TaxonDescription taxon descriptions} linked to
149 * the taxon are deleted.
151 public boolean isDeleteDescriptions() {
152 return deleteDescriptions
;
154 public void setDeleteDescriptions(boolean deleteDescriptions
) {
155 this.deleteDescriptions
= deleteDescriptions
;
159 * @return the deleteConceptRelationships
161 public boolean isDeleteConceptRelationships() {
162 return deleteConceptRelationships
;
165 * @param deleteConceptRelationships the deleteConceptRelationships to set
167 public void setDeleteConceptRelationships(boolean deleteConceptRelationships
) {
168 this.deleteConceptRelationships
= deleteConceptRelationships
;
171 public UUID
getClassificationUuid() {
172 return classificationUuid
;
174 public void setClassificationUuid(UUID classificationUuid
) {
175 this.classificationUuid
= classificationUuid
;