Project

General

Profile

Revision 18f20e1c

ID18f20e1c506661ff95ba0c8f46b8d4bee95c2fcc
Parent c790dee7
Child 434cbfa8

Added by Andreas Kohlbecker about 2 years ago

ref #7386 adding missing setBasionyms() method to taxonNameDTO - 2

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/model/name/TaxonNameDTO.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.model.name;
10 10

  
11
import java.util.HashMap;
12 11
import java.util.HashSet;
13 12
import java.util.List;
14
import java.util.Map;
15 13
import java.util.Set;
16 14

  
17 15
import org.joda.time.DateTime;
......
90 88
     * @param direction
91 89
     */
92 90
    protected void setRelatedTaxa(Direction direction, NameRelationshipType relType, Set<TaxonName> basionyms) {
93
        Map<Integer, TaxonName> currentBasionymUuids = new HashMap<>();
94
        Set<Integer> basionymsSeen = new HashSet<>();
91
        Set<TaxonName> currentBasionyms = new HashSet<>();
92
        Set<TaxonName> basionymsSeen = new HashSet<>();
95 93

  
96 94
        for(TaxonName tn : name.getRelatedNames(direction, relType)){
97
            currentBasionymUuids.put(tn.getId(), tn);
95
            currentBasionyms.add(tn);
98 96
        }
99 97
        for(TaxonName tn : basionyms){
100
            if(!currentBasionymUuids.containsKey(tn.getId())){
98
            if(!currentBasionyms.contains(tn)){
101 99
                name.addBasionym(tn);
102
            } else {
103
                basionymsSeen.add(tn.getId());
104 100
            }
101
            basionymsSeen.add(tn);
105 102
        }
106
        for(TaxonName tn : basionyms){
107
            if(!basionymsSeen.contains(tn.getId())){
103
        for(TaxonName tn : currentBasionyms){
104
            if(!basionymsSeen.contains(tn)){
108 105
                name.removeRelationWithTaxonName(tn, direction, relType);
109 106
            }
110 107
        }
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNameEditorPresenter.java
10 10

  
11 11
import java.util.Arrays;
12 12
import java.util.EnumSet;
13
import java.util.HashSet;
14 13
import java.util.List;
15
import java.util.Set;
16 14
import java.util.UUID;
17 15

  
18 16
import org.apache.log4j.Logger;
......
28 26
import eu.etaxonomy.cdm.model.agent.Person;
29 27
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
30 28
import eu.etaxonomy.cdm.model.common.TermType;
31
import eu.etaxonomy.cdm.model.name.NameRelationship;
32 29
import eu.etaxonomy.cdm.model.name.Rank;
33 30
import eu.etaxonomy.cdm.model.name.TaxonName;
34 31
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
......
239 236
    @Override
240 237
    protected TaxonNameDTO handleTransientProperties(TaxonNameDTO dto) {
241 238

  
242
        TaxonName bean = cdmEntity(dto);
243 239

  
244 240
        logger.trace(this._toString() + ".onEditorSaveEvent - handling transient properties");
245 241

  
242
        /*
243
        dto.updateTargetEntity();
246 244

  
245
        TaxonName bean = cdmEntity(dto);
247 246
        List<TaxonName> newBasionymNames = getView().getBasionymComboboxSelect().getValueFromNestedFields();
248 247
        Set<TaxonName> oldBasionyms = bean.getBasionyms();
249 248
        Set<TaxonName> updateBasionyms = new HashSet<>();
......
277 276
                bean.addBasionym(addBasionymName);
278 277
            }
279 278
        }
279
        */
280 280
        return dto;
281 281
    }
282 282

  
src/main/java/eu/etaxonomy/vaadin/component/ToManyRelatedEntitiesListSelect.java
549 549
            }
550 550
        }
551 551
        //
552
         */
552 553
        // calling super.commit() is useless if operating on a transient property!!
553 554
        super.commit();
554
        if(getValue().isEmpty() && valueInitiallyWasNull){
555
            setPropertyDataSource(null);
556
        }
557
         */
555
//        if(getValue().isEmpty() && valueInitiallyWasNull){
556
//            setPropertyDataSource(null);
557
//        }
558 558
    }
559 559

  
560 560
    /**

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)