Project

General

Profile

Download (6.11 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2009 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
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.
9
*/
10
package eu.etaxonomy.cdm.api.service.config;
11

    
12
import org.apache.log4j.Logger;
13

    
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;
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
 * @date 09.11.2011
42
 *
43
 */
44
public class TaxonDeletionConfigurator extends TaxonBaseDeletionConfigurator {
45
    @SuppressWarnings("unused")
46
    private static final Logger logger = Logger.getLogger(TaxonDeletionConfigurator.class);
47

    
48

    
49

    
50
    private boolean deleteSynonymsIfPossible = true;
51

    
52
    private boolean deleteMisappliedNamesAndInvalidDesignations = true;
53

    
54
    private boolean deleteConceptRelationships = false;
55

    
56
    //private NameDeletionConfigurator nameDeletionConfig = new NameDeletionConfigurator();
57

    
58

    
59
    private TaxonNodeDeletionConfigurator taxonNodeConfig = new TaxonNodeDeletionConfigurator();
60

    
61

    
62
    private boolean deleteTaxonNodes = true;
63

    
64
    private boolean deleteTaxonRelationships = true;
65

    
66
    private boolean deleteDescriptions = true;
67

    
68
    private boolean deleteInAllClassifications = false;
69

    
70

    
71

    
72

    
73
	public boolean isDeleteInAllClassifications() {
74
        return deleteInAllClassifications;
75
    }
76

    
77

    
78
    public void setDeleteInAllClassifications(boolean deleteInAllClassifications) {
79
        this.deleteInAllClassifications = deleteInAllClassifications;
80
    }
81

    
82

    
83

    
84

    
85
    /**
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}
89
     * @return
90
     */
91
    public boolean isDeleteMisappliedNamesAndInvalidDesignations() {
92
        return deleteMisappliedNamesAndInvalidDesignations;
93
    }
94

    
95

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

    
101

    
102

    
103

    
104
    /**
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()
110
     * @return
111
     */
112

    
113
    public TaxonNodeDeletionConfigurator getTaxonNodeConfig() {
114
        return taxonNodeConfig;
115
    }
116

    
117
    public void setTaxonNodeConfig(TaxonNodeDeletionConfigurator taxonNodeConfig) {
118
        this.taxonNodeConfig = taxonNodeConfig;
119
    }
120

    
121

    
122

    
123

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

    
135
    public void setDeleteSynonymsIfPossible(boolean deleteSynonymsIfPossible) {
136
        this.deleteSynonymsIfPossible = deleteSynonymsIfPossible;
137
    }
138

    
139

    
140

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

    
151
    public void setDeleteTaxonNodes(boolean deleteTaxonNodes) {
152
        this.deleteTaxonNodes = deleteTaxonNodes;
153
    }
154

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

    
164
    public void setDeleteTaxonRelationships(boolean deleteTaxonRelationships) {
165
        this.deleteTaxonRelationships = deleteTaxonRelationships;
166
    }
167

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

    
176
    public void setDeleteDescriptions(boolean deleteDescriptions) {
177
        this.deleteDescriptions = deleteDescriptions;
178
    }
179

    
180

    
181
    /**
182
     * @return the deleteConceptRelationships
183
     */
184
    public boolean isDeleteConceptRelationships() {
185
        return deleteConceptRelationships;
186
    }
187

    
188

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

    
196

    
197

    
198

    
199
}
(19-19/21)