Project

General

Profile

« Previous | Next » 

Revision f63b9efb

Added by Katja Luther almost 6 years ago

fix #7472: always merge taxon relations in name editor before merging

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/e4/TaxonEditorInputE4.java
69 69

  
70 70
    private Map<TaxonBase, TaxonBaseDeletionConfigurator> toDeletes = new HashMap<>();
71 71
    private Set<Synonym> toSaveNewSynonyms = new HashSet<>();
72
    private Set<TaxonBase> toSaveNewConcepts = new HashSet<>();
73
    private Set<TaxonName> toSaveNewNames = new HashSet<>();
72
    private List<TaxonBase> toSaveNewConcepts = new ArrayList<>();
73
    private List<TaxonName> toSaveNewNames = new ArrayList<>();
74 74

  
75 75

  
76 76
    private Set<AbstractPostTaxonOperation> operations = new HashSet<>();
......
312 312
        this.toSaveNewSynonyms.add(toSaveNew);
313 313
    }
314 314
    public void addToSaveNewConcept(Taxon toSaveNew) {
315
        if (!toSaveNew.isPersited()){
316
            this.toSaveNewConcepts.add(toSaveNew);
317
        }
315
       this.toSaveNewConcepts.add(toSaveNew);
316

  
318 317
    }
319 318

  
320 319
    @Override
......
338 337

  
339 338
        for (Synonym syn: toSaveNewSynonyms){
340 339
            for (HybridRelationship rel : syn.getName().getHybridChildRelations()){
341
                if (!rel.getParentName().isPersited()) {
340
//                if (!rel.getParentName().isPersited()) {
342 341
                    toSaveNewNames.add(rel.getParentName());
343
                }
344
                    if (!rel.getHybridName().isPersited()) {
342
//                }
343
//                    if (!rel.getHybridName().isPersited()) {
345 344
                   toSaveNewNames.add(rel.getHybridName());
346
                }
345
//                }
347 346

  
348 347
            }
349 348
        }
350 349

  
351 350
        for (TaxonBase concept: toSaveNewConcepts){
352 351
            for (HybridRelationship rel : concept.getName().getHybridChildRelations()){
353
                if (!rel.getParentName().isPersited()) {
352
//                if (!rel.getParentName().isPersited()) {
354 353
                    toSaveNewNames.add(rel.getParentName());
355
                }
356
                if (!rel.getHybridName().isPersited()) {
354
//                }
355
//                if (!rel.getHybridName().isPersited()) {
357 356
                    toSaveNewNames.add(rel.getHybridName());
358
                }
357
//                }
359 358

  
360 359
            }
361 360
        }
362
        CdmStore.getService(INameService.class).save(toSaveNewNames);
363
        CdmStore.getService(ITaxonService.class).save(toSaveNewConcepts);
361
        CdmStore.getService(INameService.class).merge(toSaveNewNames, true);
362
        CdmStore.getService(ITaxonService.class).merge(toSaveNewConcepts, true);
364 363

  
365 364
        toSaveNewNames.clear();
366 365
        toSaveNewConcepts.clear();

Also available in: Unified diff