Project

General

Profile

Download (5.98 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 org.apache.log4j.Logger;
12

    
13
import eu.etaxonomy.cdm.api.service.ITaxonService;
14
import eu.etaxonomy.cdm.model.description.TaxonDescription;
15
import eu.etaxonomy.cdm.model.taxon.Classification;
16
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
17
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
18
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
19

    
20
/**
21
 * This class is used to configure taxon node deletion.
22
 * It is initialized with the following default settings:
23
 * <ul>
24
 *  <li> deleteSynonymRelations: <b>true</b></li>
25
 *  <li> deleteSynonymsIfPossible: <b>true</b></li>
26
 *  <li> deleteMisappliedNamesAndInvalidDesignations: <b>true</b></li>
27
 *  <li> deleteNameIfPossible: <b>true</b></li>
28
 *  <li> nameDeletionConfig: see {@link NameDeletionConfigurator}</li>
29
 *  <li> taxonNodeConfig: see {@link TaxonNodeDeletionConfigurator}</li>
30
 *  <li> deleteTaxonNodes: <b>true</b></li>
31
 *  <li> deleteTaxonRelationships: <b>true</b>; </li>
32
 *  <li> deleteDescriptions: <b>true</b></li>
33
 *  <li> deleteInAllClassifications: <b>true</b></li>
34
 * </ul>
35
 *
36
 * @see ITaxonService#deleteTaxon(eu.etaxonomy.cdm.model.taxon.Taxon)
37
 *
38
 * @author a.mueller
39
 * @since 09.11.2011
40
 *
41
 */
42
public class TaxonDeletionConfigurator extends TaxonBaseDeletionConfigurator {
43
    @SuppressWarnings("unused")
44
    private static final Logger logger = Logger.getLogger(TaxonDeletionConfigurator.class);
45

    
46

    
47

    
48
    private boolean deleteSynonymsIfPossible = true;
49

    
50
    private boolean deleteMisappliedNamesAndInvalidDesignations = true;
51

    
52
    private boolean deleteConceptRelationships = false;
53

    
54
    //private NameDeletionConfigurator nameDeletionConfig = new NameDeletionConfigurator();
55

    
56

    
57
    private TaxonNodeDeletionConfigurator taxonNodeConfig = new TaxonNodeDeletionConfigurator();
58

    
59

    
60
    private boolean deleteTaxonNodes = true;
61

    
62
    private boolean deleteTaxonRelationships = true;
63

    
64
    private boolean deleteDescriptions = true;
65

    
66
    private boolean deleteInAllClassifications = false;
67

    
68

    
69

    
70

    
71
	public boolean isDeleteInAllClassifications() {
72
        return deleteInAllClassifications;
73
    }
74

    
75

    
76
    public void setDeleteInAllClassifications(boolean deleteInAllClassifications) {
77
        this.deleteInAllClassifications = deleteInAllClassifications;
78
    }
79

    
80

    
81

    
82

    
83
    /**
84
     * If <code>true</code> related taxa with  {@link TaxonRelationshipType} misappliedName or invalidDesignation will be removed if possible
85
     * It is possible to remove a related taxon if it is not used in any other context, e.g. any
86
     * other @link {@link TaxonRelationship} or in another @link {@link Classification}
87
     * @return
88
     */
89
    public boolean isDeleteMisappliedNamesAndInvalidDesignations() {
90
        return deleteMisappliedNamesAndInvalidDesignations;
91
    }
92

    
93

    
94
    public void setDeleteMisappliedNamesAndInvalidDesignations(
95
            boolean deleteMisappliedNamesAndInvalidDesignations) {
96
        this.deleteMisappliedNamesAndInvalidDesignations = deleteMisappliedNamesAndInvalidDesignations;
97
    }
98

    
99

    
100

    
101

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

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

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

    
119

    
120

    
121

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

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

    
136

    
137

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

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

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

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

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

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

    
177

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

    
185

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

    
193

    
194

    
195

    
196
}
(23-23/25)