Revision 184a2a6b
Added by Katja Luther about 3 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeSynonymToAcceptedTaxonHandlerE4.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.taxeditor.editor.name.e4.handler; |
11 | 11 |
|
12 |
import java.util.HashSet; |
|
13 |
import java.util.List; |
|
12 | 14 |
import java.util.Set; |
13 | 15 |
import java.util.UUID; |
14 | 16 |
|
... | ... | |
29 | 31 |
|
30 | 32 |
import eu.etaxonomy.cdm.model.metadata.SecReferenceHandlingEnum; |
31 | 33 |
import eu.etaxonomy.cdm.model.name.HomotypicalGroup; |
32 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
33 | 34 |
import eu.etaxonomy.cdm.model.reference.Reference; |
34 | 35 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
35 | 36 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
... | ... | |
103 | 104 |
// TODO get synonyms from homotypical group and add them as homotypic synonyms to new accepted taxon |
104 | 105 |
// apply confirmation dialog |
105 | 106 |
HomotypicalGroup group = synonym.getHomotypicGroup(); |
106 |
Set<TaxonName> namesInGroup = group.getTypifiedNames(); |
|
107 |
List<Synonym> homotypicSynonyms = taxon.getSynonymsInGroup(synonym.getHomotypicGroup()); |
|
108 |
Set<Reference> secRefs = new HashSet<>(); |
|
109 |
boolean nullExist = false; |
|
110 |
for (Synonym synInHomtypicGroup: homotypicSynonyms){ |
|
111 |
if (synInHomtypicGroup.getSec() == null && synonym.getSec() != null){ |
|
112 |
nullExist = true; |
|
113 |
} |
|
114 |
secRefs.add(synInHomtypicGroup.getSec()); |
|
115 |
} |
|
116 |
|
|
107 | 117 |
// FIXME with this implementation we can not create a taxonNode that is a direct child of the classification node |
108 | 118 |
|
109 | 119 |
//compare parentSec and synSec and ask for handling. |
110 | 120 |
SecReferenceHandlingEnum secHandling = PreferencesUtil.getSecReferenceHandlingPreference(); |
111 | 121 |
UUID newSecUuid = null; |
112 |
if ((synSecRef != parentSecRef && secHandling.equals(SecReferenceHandlingEnum.KeepWhenSame) )|| secHandling.equals(SecReferenceHandlingEnum.WarningSelect)){
|
|
122 |
if (((synSecRef != parentSecRef || secRefs.size()>1) && secHandling.equals(SecReferenceHandlingEnum.KeepWhenSame) )|| secHandling.equals(SecReferenceHandlingEnum.WarningSelect)){
|
|
113 | 123 |
|
114 | 124 |
if ((parentSecRef != synSecRef && secHandling.equals(SecReferenceHandlingEnum.KeepWhenSame) )|| secHandling.equals(SecReferenceHandlingEnum.WarningSelect)){ |
115 | 125 |
int result = MessagingUtils.confirmDialog(Messages.ChangeSynonymToAcceptedHandler_Select_Sec_Reference_Handling_title, Messages.ChangeSynonymToAcceptedHandler_Select_Sec_Reference_Handling_message, |
... | ... | |
134 | 144 |
} |
135 | 145 |
|
136 | 146 |
ChangeSynonymToAcceptedTaxonOperation operation = new ChangeSynonymToAcceptedTaxonOperation(Messages.ChangeSynonymToAcceptedTaxonHandler_CHANGE_SYN_TO_ACC_TAXON, EditorUtil.getUndoContext(), |
137 |
taxon, newParentNode, synonym, namesInGroup,
|
|
147 |
taxon, newParentNode, synonym, |
|
138 | 148 |
newSecUuid, secHandling, |
139 | 149 |
this, editor, editor.getEditorInput()); //$NON-NLS-1$ |
140 | 150 |
|
Also available in: Unified diff
ref #9340: secundum handling if synonym in HG has different sec