Project

General

Profile

« Previous | Next » 

Revision 5affe60a

Added by Katja Luther over 3 years ago

ref #8774: do not allow duplicates in character editor

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/character/CharacterEditor.java
76 76
import eu.etaxonomy.cdm.model.term.VocabularyEnum;
77 77
import eu.etaxonomy.cdm.persistence.dto.CharacterDto;
78 78
import eu.etaxonomy.cdm.persistence.dto.CharacterNodeDto;
79
import eu.etaxonomy.cdm.persistence.dto.TermDto;
79 80
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
80 81
import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
81 82
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
......
640 641

  
641 642
    @Override
642 643
    public boolean checkDuplicates(UUID termUuid, UUID treeUuid) {
643
//        for (TermDto dto: characterTreeEditorComposite.getFeatureTree().getTerms()){
644
//            if (dto.getUuid().equals(termUuid)){
645
//                return true;
646
//            }
647
//        }
644
        for (TermDto dto: characterTreeEditorComposite.getFeatureTree().getTerms()){
645
            if (dto != null && dto.getUuid().equals(termUuid)){
646
                return true;
647
            }
648
        }
648 649
        return false;
649 650
    }
650 651

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeDtoEditorComposite.java
213 213

  
214 214
    private void addChildNodesToMap(TermNodeDto root) {
215 215
        this.nodeUuidMap.put(root.getUuid(), root);
216
        if (root.getTerm() != null){
217
            this.featureTree.addTerm(root.getTerm());
218
        }
216 219
        for (TermNodeDto child: root.getChildren()){
217 220
            addChildNodesToMap(child);
218 221
        }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/AbstractAddFeatureHandler.java
23 23

  
24 24
import eu.etaxonomy.cdm.model.description.Character;
25 25
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
26
import eu.etaxonomy.cdm.model.term.TermType;
26 27
import eu.etaxonomy.cdm.persistence.dto.CharacterDto;
27 28
import eu.etaxonomy.cdm.persistence.dto.CharacterNodeDto;
28 29
import eu.etaxonomy.cdm.persistence.dto.TermDto;
......
32 33
import eu.etaxonomy.taxeditor.featuretree.e4.ICharacterEditor;
33 34
import eu.etaxonomy.taxeditor.featuretree.e4.IFeatureTreeEditor;
34 35
import eu.etaxonomy.taxeditor.featuretree.e4.operation.AddFeatureOperation;
36
import eu.etaxonomy.taxeditor.l10n.Messages;
35 37
import eu.etaxonomy.taxeditor.model.MessagingUtils;
36 38
import eu.etaxonomy.taxeditor.store.StoreUtil;
37 39

  
......
50 52
            return;
51 53
        }
52 54
        TermNodeDto parent = getParent(selection);
53
        AvailableFeaturesWizard wizard = new AvailableFeaturesWizard(parent.getTerm().getTermType());
55
        TermType type = null;
56
        if (parent.getTerm() == null){
57
            type = parent.getTree().getTermType();
58
        }else{
59
            type = parent.getTerm().getTermType();
60
        }
61
        AvailableFeaturesWizard wizard = new AvailableFeaturesWizard(type);
54 62
        WizardDialog dialog = new WizardDialog(shell, wizard);
55 63

  
56 64
        if (dialog.open() == IStatus.OK) {
......
60 68
                if (!parent.getTree().isAllowDuplicate()){
61 69
                    boolean isDuplicate = editor.checkDuplicates(term.getUuid(), parent.getTree().getUuid());
62 70
                    if (isDuplicate){
63
                        MessagingUtils.informationDialog("No duplicates allowed", "This term tree does not allow duplicates.");
71
                        MessagingUtils.informationDialog(Messages.AddFeatureHandler_Duplicates_not_allowed, Messages.AddFeatureHandler_Duplicates_not_allowed_message);
64 72
                        return;
65 73
                    }
66 74
                }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java
372 372
    public static String FeatureTreeSelectionDialog_NEW_TREE;
373 373
    public static String FeatureTreeSelectionDialog_TREE_LABEL;
374 374

  
375
    public static String AddFeatureHandler_Duplicates_not_allowed;
376
    public static String AddFeatureHandler_Duplicates_not_allowed_message;
377

  
375 378

  
376 379
	public static String NonViralNameDetails_confirmDeleteOfZoologicalNameParts;
377 380
	public static String NonViralNameDetails_descriptionDeleteZoologicalNameParts;
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties
306 306
FeatureTreeSelectionDialog_NEW_TREE=New Term tree
307 307
FeatureTreeSelectionDialog_TREE_LABEL=Term tree label
308 308

  
309
AddFeatureHandler_Duplicates_not_allowed=No duplicates allowed
310
AddFeatureHandler_Duplicates_not_allowed_message=This term tree does not allow duplicates and there exist a node with this term already.
311

  
309 312
NonViralNameDetails_confirmDeleteOfZoologicalNameParts=The publication and original publication year needs to be removed
310 313
NonViralNameDetails_descriptionDeleteZoologicalNameParts=If you click Yes, the original publication and publication year is removed and the nomenclatural code is changed.
311 314
NonViralNameDetails_confirmDeleteOfBacterialNameParts=The name approbiation needs to be removed
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties
306 306
FeatureTreeSelectionDialog_NEW_TREE=Neuer Termbaum
307 307
FeatureTreeSelectionDialog_TREE_LABEL=Termbaumname
308 308

  
309
AddFeatureHandler_Duplicates_not_allowed=Keine Duplikate erlaubt
310
AddFeatureHandler_Duplicates_not_allowed_message=Der Termbaum erlaubt keine Duplikate und f?r diesen Term existiert bereits ein Knoten.
311

  
309 312
NonViralNameDetails_confirmDeleteOfZoologicalNameParts=Breed, Publication Date und Original Publication Date m?ssen entfernt werden.
310 313
NonViralNameDetails_descriptionDeleteZoologicalNameParts=Best?tigen Sie, wenn Sie Breed, Publication Date und Original Publication Date l?schen und den Nomenklatorischen Code des Namens ?ndern wollen.
311 314
NonViralNameDetails_confirmDeleteOfBacterialNameParts=Name Approbiation muss entfernt werden.

Also available in: Unified diff