Revision 0e1aa80c
Added by Katja Luther almost 7 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/TaxonServiceImpl.java | ||
---|---|---|
796 | 796 |
(configurator.getPageNumber(), numberOfResults, configurator.getPageSize(), results); |
797 | 797 |
} |
798 | 798 |
|
799 |
public List<UuidAndTitleCache<TaxonBase>> getTaxonUuidAndTitleCache(){ |
|
800 |
return dao.getUuidAndTitleCache(); |
|
799 |
public List<UuidAndTitleCache<TaxonBase>> getTaxonUuidAndTitleCache(Integer limit, String pattern){
|
|
800 |
return dao.getUuidAndTitleCache(limit, pattern);
|
|
801 | 801 |
} |
802 | 802 |
|
803 | 803 |
@Override |
... | ... | |
1017 | 1017 |
|
1018 | 1018 |
} |
1019 | 1019 |
} else{ |
1020 |
TaxonDeletionConfigurator configRelTaxon = new TaxonDeletionConfigurator(); |
|
1021 |
configRelTaxon.setDeleteTaxonNodes(false); |
|
1022 |
configRelTaxon.setDeleteConceptRelationships(true); |
|
1023 |
|
|
1020 | 1024 |
for (TaxonRelationship taxRel: taxon.getTaxonRelations()){ |
1021 | 1025 |
if (config.isDeleteMisappliedNamesAndInvalidDesignations()){ |
1022 | 1026 |
if (taxRel.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR()) || taxRel.getType().equals(TaxonRelationshipType.INVALID_DESIGNATION_FOR())){ |
1023 | 1027 |
if (taxon.equals(taxRel.getToTaxon())){ |
1024 |
|
|
1025 | 1028 |
this.deleteTaxon(taxRel.getFromTaxon().getUuid(), config, classificationUuid); |
1026 | 1029 |
} |
1027 | 1030 |
} |
1031 |
} else if (config.isDeleteConceptRelationships() && taxRel.getType().isConceptRelationship()){ |
|
1032 |
|
|
1033 |
if (taxon.equals(taxRel.getToTaxon()) && isDeletable(taxRel.getFromTaxon(), configRelTaxon).isOk()){ |
|
1034 |
this.deleteTaxon(taxRel.getFromTaxon().getUuid(), configRelTaxon, classificationUuid); |
|
1035 |
}else if (isDeletable(taxRel.getToTaxon(), configRelTaxon).isOk()){ |
|
1036 |
this.deleteTaxon(taxRel.getToTaxon().getUuid(), configRelTaxon, classificationUuid); |
|
1037 |
} |
|
1028 | 1038 |
} |
1029 | 1039 |
taxon.removeTaxonRelation(taxRel); |
1030 | 1040 |
|
... | ... | |
1157 | 1167 |
taxon.setName(null); |
1158 | 1168 |
} |
1159 | 1169 |
|
1170 |
|
|
1160 | 1171 |
if ((taxon.getTaxonNodes() == null || taxon.getTaxonNodes().size()== 0) && result.isOk()){ |
1161 | 1172 |
try{ |
1162 | 1173 |
UUID uuid = dao.delete(taxon); |
... | ... | |
1576 | 1587 |
} |
1577 | 1588 |
|
1578 | 1589 |
@Override |
1579 |
public List<UuidAndTitleCache<TaxonBase>> getUuidAndTitleCacheTaxon() { |
|
1580 |
return dao.getUuidAndTitleCacheTaxon(); |
|
1590 |
public List<UuidAndTitleCache<TaxonBase>> getUuidAndTitleCacheTaxon(Integer limit, String pattern) {
|
|
1591 |
return dao.getUuidAndTitleCacheTaxon(limit, pattern);
|
|
1581 | 1592 |
} |
1582 | 1593 |
|
1583 | 1594 |
@Override |
1584 |
public List<UuidAndTitleCache<TaxonBase>> getUuidAndTitleCacheSynonym() { |
|
1585 |
return dao.getUuidAndTitleCacheSynonym(); |
|
1595 |
public List<UuidAndTitleCache<TaxonBase>> getUuidAndTitleCacheSynonym(Integer limit, String pattern) {
|
|
1596 |
return dao.getUuidAndTitleCacheSynonym(limit, pattern);
|
|
1586 | 1597 |
} |
1587 | 1598 |
|
1588 | 1599 |
@Override |
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/config/SynonymDeletionConfigurator.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2009 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.cdm.api.service.config; |
11 |
|
|
12 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
|
13 |
|
|
11 | 14 |
/** |
12 | 15 |
* This class is used to configure synonym deletion. |
13 |
*
|
|
14 |
* @see ITaxonService#deleteSynonym(eu.etaxonomy.cdm.model.taxon.Synonym)
|
|
15 |
*
|
|
16 |
* |
|
17 |
* @see ITaxonService#deleteSynonym(eu.etaxonomy.cdm.model.taxon.Synonym) |
|
18 |
* |
|
16 | 19 |
* @author k.luther |
17 | 20 |
* @date 09.11.2011 |
18 | 21 |
* |
... | ... | |
27 | 30 |
public void setNewHomotypicGroupIfNeeded(boolean newHomotypicGroupIfNeeded) { |
28 | 31 |
this.newHomotypicGroupIfNeeded = newHomotypicGroupIfNeeded; |
29 | 32 |
} |
30 |
|
|
31 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
32 | 37 |
} |
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/config/TaxonBaseDeletionConfigurator.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2009 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.cdm.api.service.config; |
11 | 11 |
|
12 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
|
13 |
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship; |
|
14 |
|
|
12 | 15 |
/** |
13 | 16 |
* This class is used to configure taxonbase deletion. |
14 |
*
|
|
15 |
* @see ITaxonService#deleteTaxon(eu.etaxonomy.cdm.model.taxon.Taxon) and ITaxonService#deleteSynonym(eu.etaxonomy.cdm.model.taxon.Synonym)
|
|
16 |
*
|
|
17 |
* |
|
18 |
* @see ITaxonService#deleteTaxon(eu.etaxonomy.cdm.model.taxon.Taxon) and ITaxonService#deleteSynonym(eu.etaxonomy.cdm.model.taxon.Synonym) |
|
19 |
* |
|
17 | 20 |
* @author k.luther |
18 | 21 |
* @date 09.11.2011 |
19 | 22 |
* |
... | ... | |
21 | 24 |
public class TaxonBaseDeletionConfigurator extends DeleteConfiguratorBase{ |
22 | 25 |
|
23 | 26 |
private boolean deleteNameIfPossible = true; |
24 |
|
|
27 |
private boolean deleteSynonymRelations = true; |
|
28 |
|
|
25 | 29 |
private NameDeletionConfigurator nameDeletionConfig = new NameDeletionConfigurator(); |
26 |
|
|
30 |
|
|
27 | 31 |
/** |
28 | 32 |
* If true the taxons name will be deleted if this is possible. |
29 | 33 |
* It is possible if the name is not linked in a way that it can not be deleted. |
... | ... | |
38 | 42 |
public void setDeleteNameIfPossible(boolean deleteNameIfPossible) { |
39 | 43 |
this.deleteNameIfPossible = deleteNameIfPossible; |
40 | 44 |
} |
41 |
|
|
45 |
|
|
42 | 46 |
/** |
43 | 47 |
* The configurator for name deletion. Only evaluated if {@link #isDeleteNameIfPossible()} |
44 | 48 |
* is <code>true</code>. |
... | ... | |
54 | 58 |
public void setNameDeletionConfig(NameDeletionConfigurator nameDeletionConfig) { |
55 | 59 |
this.nameDeletionConfig = nameDeletionConfig; |
56 | 60 |
} |
61 |
|
|
62 |
/** |
|
63 |
* |
|
64 |
* If <code>true</code> all {@link SynonymRelationship relations from taxon to synonyms} will be |
|
65 |
* removed. |
|
66 |
* Synonyms itself will be removed depending on {@link #deleteSynonymsIfPossible}. |
|
67 |
* @return |
|
68 |
*/ |
|
69 |
public boolean isDeleteSynonymRelations() { |
|
70 |
return deleteSynonymRelations; |
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* @param deleteSynonymRelations the deleteSynonymRelations to set |
|
75 |
*/ |
|
76 |
public void setDeleteSynonymRelations(boolean deleteSynonymRelations) { |
|
77 |
this.deleteSynonymRelations = deleteSynonymRelations; |
|
78 |
} |
|
57 | 79 |
} |
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/config/TaxonDeletionConfigurator.java | ||
---|---|---|
45 | 45 |
@SuppressWarnings("unused") |
46 | 46 |
private static final Logger logger = Logger.getLogger(TaxonDeletionConfigurator.class); |
47 | 47 |
|
48 |
private boolean deleteSynonymRelations = true; |
|
48 |
|
|
49 | 49 |
|
50 | 50 |
private boolean deleteSynonymsIfPossible = true; |
51 | 51 |
|
52 | 52 |
private boolean deleteMisappliedNamesAndInvalidDesignations = true; |
53 | 53 |
|
54 |
// private boolean deleteNameIfPossible = true;
|
|
54 |
private boolean deleteConceptRelationships = false;
|
|
55 | 55 |
|
56 | 56 |
//private NameDeletionConfigurator nameDeletionConfig = new NameDeletionConfigurator(); |
57 | 57 |
|
... | ... | |
119 | 119 |
} |
120 | 120 |
|
121 | 121 |
|
122 |
/** |
|
123 |
* |
|
124 |
* If <code>true</code> all {@link SynonymRelationship relations to synonyms} will be |
|
125 |
* removed. |
|
126 |
* Synonyms itself will be removed depending on {@link #deleteSynonymsIfPossible}. |
|
127 |
* @return |
|
128 |
*/ |
|
129 |
public boolean isDeleteSynonymRelations() { |
|
130 |
return deleteSynonymRelations; |
|
131 |
} |
|
132 |
|
|
133 |
public void setDeleteSynonymRelations(boolean deleteSynonymRelations) { |
|
134 |
this.deleteSynonymRelations = deleteSynonymRelations; |
|
135 |
} |
|
136 | 122 |
|
137 | 123 |
|
138 | 124 |
/** |
... | ... | |
192 | 178 |
} |
193 | 179 |
|
194 | 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 |
|
|
195 | 197 |
|
196 | 198 |
|
197 | 199 |
} |
Also available in: Unified diff
improve delete configurator for taxa and synonyms