1
|
/**
|
2
|
* Copyright (C) 2009 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.api.service.config;
|
10
|
|
11
|
import java.util.UUID;
|
12
|
|
13
|
import org.apache.log4j.Logger;
|
14
|
|
15
|
import eu.etaxonomy.cdm.api.service.ITaxonService;
|
16
|
import eu.etaxonomy.cdm.model.description.TaxonDescription;
|
17
|
import eu.etaxonomy.cdm.model.taxon.Classification;
|
18
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
19
|
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
|
20
|
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
|
21
|
|
22
|
/**
|
23
|
* This class is used to configure taxon node deletion.
|
24
|
* It is initialized with the following default settings:
|
25
|
* <ul>
|
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>
|
36
|
* </ul>
|
37
|
*
|
38
|
* @see ITaxonService#deleteTaxon(eu.etaxonomy.cdm.model.taxon.Taxon)
|
39
|
*
|
40
|
* @author a.mueller
|
41
|
* @since 09.11.2011
|
42
|
*/
|
43
|
public class TaxonDeletionConfigurator extends TaxonBaseDeletionConfigurator {
|
44
|
|
45
|
private static final long serialVersionUID = -4932682946459109886L;
|
46
|
|
47
|
@SuppressWarnings("unused")
|
48
|
private static final Logger logger = Logger.getLogger(TaxonDeletionConfigurator.class);
|
49
|
|
50
|
|
51
|
private boolean deleteSynonymsIfPossible = true;
|
52
|
|
53
|
private boolean deleteMisappliedNames = true;
|
54
|
|
55
|
private boolean deleteConceptRelationships = false;
|
56
|
|
57
|
//private NameDeletionConfigurator nameDeletionConfig = new NameDeletionConfigurator();
|
58
|
|
59
|
private TaxonNodeDeletionConfigurator taxonNodeConfig = new TaxonNodeDeletionConfigurator();
|
60
|
|
61
|
private boolean deleteTaxonNodes = true;
|
62
|
|
63
|
private boolean deleteTaxonRelationships = true;
|
64
|
|
65
|
private boolean deleteDescriptions = true;
|
66
|
|
67
|
private boolean deleteInAllClassifications = false;
|
68
|
|
69
|
private UUID classificationUuid = null;
|
70
|
|
71
|
|
72
|
public boolean isDeleteInAllClassifications() {
|
73
|
return deleteInAllClassifications;
|
74
|
}
|
75
|
public void setDeleteInAllClassifications(boolean deleteInAllClassifications) {
|
76
|
this.deleteInAllClassifications = deleteInAllClassifications;
|
77
|
}
|
78
|
|
79
|
/**
|
80
|
* If <code>true</code> related taxa with {@link TaxonRelationshipType} misappliedName
|
81
|
* will be removed if possible.<BR>
|
82
|
* It is possible to remove a related taxon if it is not used in any other context, e.g. any
|
83
|
* other @link {@link TaxonRelationship} or in another @link {@link Classification}
|
84
|
* @return
|
85
|
*/
|
86
|
public boolean isDeleteMisappliedNames() {
|
87
|
return deleteMisappliedNames;
|
88
|
}
|
89
|
public void setDeleteMisappliedNames(
|
90
|
boolean deleteMisappliedNames) {
|
91
|
this.deleteMisappliedNames = deleteMisappliedNames;
|
92
|
}
|
93
|
|
94
|
/**
|
95
|
* The configurator for node deletion. Only evaluated if {@link #isDeleteNode()}
|
96
|
* is <code>true</code>.
|
97
|
* @see TaxonNodeDeletionConfigurator
|
98
|
* @see #isDeleteNode()
|
99
|
* @see #isDeleteSynonymsIfPossible()
|
100
|
* @return
|
101
|
*/
|
102
|
|
103
|
public TaxonNodeDeletionConfigurator getTaxonNodeConfig() {
|
104
|
return taxonNodeConfig;
|
105
|
}
|
106
|
public void setTaxonNodeConfig(TaxonNodeDeletionConfigurator taxonNodeConfig) {
|
107
|
this.taxonNodeConfig = taxonNodeConfig;
|
108
|
}
|
109
|
|
110
|
/**
|
111
|
* If <code>true</code> synonyms will be removed if possible but only if {@link #isDeleteSynonymRelations()}
|
112
|
* is also <code>true</code>.
|
113
|
* It is possible to remove a synonym if it is not used in any other context
|
114
|
* @return
|
115
|
*/
|
116
|
public boolean isDeleteSynonymsIfPossible() {
|
117
|
return deleteSynonymsIfPossible;
|
118
|
}
|
119
|
public void setDeleteSynonymsIfPossible(boolean deleteSynonymsIfPossible) {
|
120
|
this.deleteSynonymsIfPossible = deleteSynonymsIfPossible;
|
121
|
}
|
122
|
|
123
|
/**
|
124
|
* If <code>true</code> all {@link TaxonNode taxon nodes} this taxon belongs to
|
125
|
* are deleted. If <code>false</code> an exception is thrown if this taxon belongs
|
126
|
* to a taxon node.
|
127
|
* @return
|
128
|
*/
|
129
|
public boolean isDeleteTaxonNodes() {
|
130
|
return deleteTaxonNodes;
|
131
|
}
|
132
|
public void setDeleteTaxonNodes(boolean deleteTaxonNodes) {
|
133
|
this.deleteTaxonNodes = deleteTaxonNodes;
|
134
|
}
|
135
|
|
136
|
/**
|
137
|
* If <code>true</code> all {@link TaxonRelationship taxon relationships} linked to
|
138
|
* the taxon are removed.
|
139
|
*/
|
140
|
// TODO how to handle missapllied names
|
141
|
public boolean isDeleteTaxonRelationships() {
|
142
|
return deleteTaxonRelationships;
|
143
|
}
|
144
|
public void setDeleteTaxonRelationships(boolean deleteTaxonRelationships) {
|
145
|
this.deleteTaxonRelationships = deleteTaxonRelationships;
|
146
|
}
|
147
|
|
148
|
/**
|
149
|
* If <code>true</code> all {@link TaxonDescription taxon descriptions} linked to
|
150
|
* the taxon are deleted.
|
151
|
*/
|
152
|
public boolean isDeleteDescriptions() {
|
153
|
return deleteDescriptions;
|
154
|
}
|
155
|
public void setDeleteDescriptions(boolean deleteDescriptions) {
|
156
|
this.deleteDescriptions = deleteDescriptions;
|
157
|
}
|
158
|
|
159
|
/**
|
160
|
* @return the deleteConceptRelationships
|
161
|
*/
|
162
|
public boolean isDeleteConceptRelationships() {
|
163
|
return deleteConceptRelationships;
|
164
|
}
|
165
|
/**
|
166
|
* @param deleteConceptRelationships the deleteConceptRelationships to set
|
167
|
*/
|
168
|
public void setDeleteConceptRelationships(boolean deleteConceptRelationships) {
|
169
|
this.deleteConceptRelationships = deleteConceptRelationships;
|
170
|
}
|
171
|
|
172
|
public UUID getClassificationUuid() {
|
173
|
return classificationUuid;
|
174
|
}
|
175
|
public void setClassificationUuid(UUID classificationUuid) {
|
176
|
this.classificationUuid = classificationUuid;
|
177
|
}
|
178
|
}
|