3 * Copyright (C) 2009 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.api
.service
.config
;
12 import org
.apache
.log4j
.Logger
;
14 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonService
;
15 import eu
.etaxonomy
.cdm
.model
.description
.TaxonDescription
;
16 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
17 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymRelationship
;
18 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
19 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
23 * This class is used to configure taxon node deletion.
24 * It is initialized with the following default settings:
26 * <li> deleteSynonymRelations: <b>true</b></li>
27 * <li> deleteSynonymsIfPossible: <b>true</b></li>
28 * <li> deleteMisappliedNamesAndInvalidDesignations: <b>true</b></li>
29 * <li> deleteNameIfPossible: <b>true</b></li>
30 * <li> nameDeletionConfig: see {@link NameDeletionConfigurator}</li>
31 * <li> taxonNodeConfig: see {@link TaxonNodeDeletionConfigurator}</li>
32 * <li> deleteTaxonNodes: <b>true</b></li>
33 * <li> deleteTaxonRelationships: <b>true</b>; </li>
34 * <li> deleteDescriptions: <b>true</b></li>
35 * <li> deleteInAllClassifications: <b>true</b></li>
38 * @see ITaxonService#deleteTaxon(eu.etaxonomy.cdm.model.taxon.Taxon)
44 public class TaxonDeletionConfigurator
extends TaxonBaseDeletionConfigurator
{
45 @SuppressWarnings("unused")
46 private static final Logger logger
= Logger
.getLogger(TaxonDeletionConfigurator
.class);
48 private boolean deleteSynonymRelations
= true;
50 private boolean deleteSynonymsIfPossible
= true;
52 private boolean deleteMisappliedNamesAndInvalidDesignations
= true;
54 // private boolean deleteNameIfPossible = true;
56 //private NameDeletionConfigurator nameDeletionConfig = new NameDeletionConfigurator();
59 private TaxonNodeDeletionConfigurator taxonNodeConfig
= new TaxonNodeDeletionConfigurator();
62 private boolean deleteTaxonNodes
= true;
64 private boolean deleteTaxonRelationships
= true;
66 private boolean deleteDescriptions
= true;
68 private boolean deleteInAllClassifications
= true;
73 public boolean isDeleteInAllClassifications() {
74 return deleteInAllClassifications
;
78 public void setDeleteInAllClassifications(boolean deleteInAllClassifications
) {
79 this.deleteInAllClassifications
= deleteInAllClassifications
;
86 * If <code>true</code> related taxa with {@link TaxonRelationshipType} misappliedName or invalidDesignation will be removed if possible
87 * It is possible to remove a related taxon if it is not used in any other context, e.g. any
88 * other @link {@link TaxonRelationship} or in another @link {@link Classification}
91 public boolean isDeleteMisappliedNamesAndInvalidDesignations() {
92 return deleteMisappliedNamesAndInvalidDesignations
;
96 public void setDeleteMisappliedNamesAndInvalidDesignations(
97 boolean deleteMisappliedNamesAndInvalidDesignations
) {
98 this.deleteMisappliedNamesAndInvalidDesignations
= deleteMisappliedNamesAndInvalidDesignations
;
105 * The configurator for node deletion. Only evaluated if {@link #isDeleteNode()}
106 * is <code>true</code>.
107 * @see TaxonNodeDeletionConfigurator
108 * @see #isDeleteNode()
109 * @see #isDeleteSynonymsIfPossible()
113 public TaxonNodeDeletionConfigurator
getTaxonNodeConfig() {
114 return taxonNodeConfig
;
117 public void setTaxonNodeConfig(TaxonNodeDeletionConfigurator taxonNodeConfig
) {
118 this.taxonNodeConfig
= taxonNodeConfig
;
124 * If <code>true</code> all {@link SynonymRelationship relations to synonyms} will be
126 * Synonyms itself will be removed depending on {@link #deleteSynonymsIfPossible}.
129 public boolean isDeleteSynonymRelations() {
130 return deleteSynonymRelations
;
133 public void setDeleteSynonymRelations(boolean deleteSynonymRelations
) {
134 this.deleteSynonymRelations
= deleteSynonymRelations
;
139 * If <code>true</code> synonyms will be removed if possible but only if {@link #isDeleteSynonymRelations()}
140 * is also <code>true</code>.
141 * It is possible to remove a synonym if it is not used in any other context, e.g. any
142 * other @link {@link SynonymRelationship}
145 public boolean isDeleteSynonymsIfPossible() {
146 return deleteSynonymsIfPossible
;
149 public void setDeleteSynonymsIfPossible(boolean deleteSynonymsIfPossible
) {
150 this.deleteSynonymsIfPossible
= deleteSynonymsIfPossible
;
156 * If <code>true</code> all {@link TaxonNode taxon nodes} this taxon belongs to
157 * are deleted. If <code>false</code> an exception is thrown if this taxon belongs
161 public boolean isDeleteTaxonNodes() {
162 return deleteTaxonNodes
;
165 public void setDeleteTaxonNodes(boolean deleteTaxonNodes
) {
166 this.deleteTaxonNodes
= deleteTaxonNodes
;
170 * If <code>true</code> all {@link TaxonRelationship taxon relationships} linked to
171 * the taxon are removed.
173 // TODO how to handle missapllied names
174 public boolean isDeleteTaxonRelationships() {
175 return deleteTaxonRelationships
;
178 public void setDeleteTaxonRelationships(boolean deleteTaxonRelationships
) {
179 this.deleteTaxonRelationships
= deleteTaxonRelationships
;
183 * If <code>true</code> all {@link TaxonDescription taxon descriptions} linked to
184 * the taxon are deleted.
186 public boolean isDeleteDescriptions() {
187 return deleteDescriptions
;
190 public void setDeleteDescriptions(boolean deleteDescriptions
) {
191 this.deleteDescriptions
= deleteDescriptions
;