Project

General

Profile

Download (6.17 KB) Statistics
| Branch: | Tag: | Revision:
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
 */
44
public class TaxonDeletionConfigurator extends TaxonBaseDeletionConfigurator {
45

    
46
    private static final long serialVersionUID = -4932682946459109886L;
47

    
48
    @SuppressWarnings("unused")
49
    private static final Logger logger = Logger.getLogger(TaxonDeletionConfigurator.class);
50

    
51

    
52
    private boolean deleteSynonymsIfPossible = true;
53

    
54
    private boolean deleteMisappliedNames = true;
55

    
56
    private boolean deleteConceptRelationships = false;
57

    
58
    //private NameDeletionConfigurator nameDeletionConfig = new NameDeletionConfigurator();
59

    
60

    
61
    private TaxonNodeDeletionConfigurator taxonNodeConfig = new TaxonNodeDeletionConfigurator();
62

    
63

    
64
    private boolean deleteTaxonNodes = true;
65

    
66
    private boolean deleteTaxonRelationships = true;
67

    
68
    private boolean deleteDescriptions = true;
69

    
70
    private boolean deleteInAllClassifications = false;
71

    
72
    private UUID classificationUuid = null;
73

    
74

    
75
	public boolean isDeleteInAllClassifications() {
76
        return deleteInAllClassifications;
77
    }
78
    public void setDeleteInAllClassifications(boolean deleteInAllClassifications) {
79
        this.deleteInAllClassifications = deleteInAllClassifications;
80
    }
81

    
82

    
83
    /**
84
     * If <code>true</code> related taxa with  {@link TaxonRelationshipType} misappliedName
85
     * will be removed if possible.<BR>
86
     * It is possible to remove a related taxon if it is not used in any other context, e.g. any
87
     * other @link {@link TaxonRelationship} or in another @link {@link Classification}
88
     * @return
89
     */
90
    public boolean isDeleteMisappliedNames() {
91
        return deleteMisappliedNames;
92
    }
93
    public void setDeleteMisappliedNames(
94
            boolean deleteMisappliedNames) {
95
        this.deleteMisappliedNames = deleteMisappliedNames;
96
    }
97

    
98

    
99

    
100

    
101
    /**
102
     * The configurator for node deletion. Only evaluated if {@link #isDeleteNode()}
103
     * is <code>true</code>.
104
     * @see TaxonNodeDeletionConfigurator
105
     * @see #isDeleteNode()
106
     * @see #isDeleteSynonymsIfPossible()
107
     * @return
108
     */
109

    
110
    public TaxonNodeDeletionConfigurator getTaxonNodeConfig() {
111
        return taxonNodeConfig;
112
    }
113

    
114
    public void setTaxonNodeConfig(TaxonNodeDeletionConfigurator taxonNodeConfig) {
115
        this.taxonNodeConfig = taxonNodeConfig;
116
    }
117

    
118

    
119

    
120

    
121
    /**
122
     * If <code>true</code> synonyms will be removed if possible but only if {@link #isDeleteSynonymRelations()}
123
     * is also <code>true</code>.
124
     * It is possible to remove a synonym if it is not used in any other context
125
     * @return
126
     */
127
    public boolean isDeleteSynonymsIfPossible() {
128
        return deleteSynonymsIfPossible;
129
    }
130

    
131
    public void setDeleteSynonymsIfPossible(boolean deleteSynonymsIfPossible) {
132
        this.deleteSynonymsIfPossible = deleteSynonymsIfPossible;
133
    }
134

    
135

    
136

    
137
    /**
138
     * If <code>true</code> all {@link TaxonNode taxon nodes} this taxon belongs to
139
     * are deleted. If <code>false</code> an exception is thrown if this taxon belongs
140
     * to a taxon node.
141
     * @return
142
     */
143
    public boolean isDeleteTaxonNodes() {
144
        return deleteTaxonNodes;
145
    }
146

    
147
    public void setDeleteTaxonNodes(boolean deleteTaxonNodes) {
148
        this.deleteTaxonNodes = deleteTaxonNodes;
149
    }
150

    
151
    /**
152
     * If <code>true</code> all {@link TaxonRelationship taxon relationships} linked to
153
     * the taxon are removed.
154
     */
155
     // TODO how to handle missapllied names
156
    public boolean isDeleteTaxonRelationships() {
157
        return deleteTaxonRelationships;
158
    }
159

    
160
    public void setDeleteTaxonRelationships(boolean deleteTaxonRelationships) {
161
        this.deleteTaxonRelationships = deleteTaxonRelationships;
162
    }
163

    
164
    /**
165
     * If <code>true</code> all {@link TaxonDescription taxon descriptions} linked to
166
     * the taxon are deleted.
167
     */
168
    public boolean isDeleteDescriptions() {
169
        return deleteDescriptions;
170
    }
171

    
172
    public void setDeleteDescriptions(boolean deleteDescriptions) {
173
        this.deleteDescriptions = deleteDescriptions;
174
    }
175

    
176

    
177
    /**
178
     * @return the deleteConceptRelationships
179
     */
180
    public boolean isDeleteConceptRelationships() {
181
        return deleteConceptRelationships;
182
    }
183

    
184

    
185
    /**
186
     * @param deleteConceptRelationships the deleteConceptRelationships to set
187
     */
188
    public void setDeleteConceptRelationships(boolean deleteConceptRelationships) {
189
        this.deleteConceptRelationships = deleteConceptRelationships;
190
    }
191

    
192

    
193
    public UUID getClassificationUuid() {
194
        return classificationUuid;
195
    }
196

    
197

    
198
    public void setClassificationUuid(UUID classificationUuid) {
199
        this.classificationUuid = classificationUuid;
200
    }
201

    
202

    
203

    
204

    
205
}
(26-26/29)