Project

General

Profile

« Previous | Next » 

Revision 26cc98f0

Added by Katja Luther almost 6 years ago

fix #7472: fix lazy loading exceptions for MAN with type specimen

View differences:

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

  
68 68
    private TaxonNode taxonNode;
69 69

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

  
75 75

  
76 76
    private Set<AbstractPostTaxonOperation> operations = new HashSet<>();
......
307 307
    }
308 308

  
309 309
    public void addToSaveNewSynonym(Synonym toSaveNew) {
310
        this.toSaveNewSynonym.add(toSaveNew);
310
        this.toSaveNewSynonyms.add(toSaveNew);
311 311
    }
312 312
    public void addToSaveNewConcept(Taxon toSaveNew) {
313
        this.toSaveNewConcept.add(toSaveNew);
313
        if (!toSaveNew.isPersited()){
314
            this.toSaveNewConcepts.add(toSaveNew);
315
        }
314 316
    }
315 317

  
316 318
    @Override
......
323 325
        if (!this.getCdmEntitySession().isActive()){
324 326
            this.getCdmEntitySession().bind();
325 327
        }
326
        for(Entry<TaxonBase, TaxonBaseDeletionConfigurator> entry:toDelete.entrySet()){
328
        for(Entry<TaxonBase, TaxonBaseDeletionConfigurator> entry:toDeletes.entrySet()){
327 329
            delete(entry.getKey(), entry.getValue());
328 330
        }
329
        toDelete.clear();
331
        toDeletes.clear();
330 332
        for(AbstractPostOperation entry:operations){
331 333
            EditorUtil.executeOperation(entry,sync);
332 334
        }
333 335
        operations.clear();
334 336

  
335
        for (Synonym syn: toSaveNewSynonym){
337
        for (Synonym syn: toSaveNewSynonyms){
336 338
            for (HybridRelationship rel : syn.getName().getHybridChildRelations()){
337 339
                if (!rel.getParentName().isPersited()) {
338
                    toSaveNewName.add(rel.getParentName());
340
                    toSaveNewNames.add(rel.getParentName());
339 341
                }
340 342
                    if (!rel.getHybridName().isPersited()) {
341
                   toSaveNewName.add(rel.getHybridName());
343
                   toSaveNewNames.add(rel.getHybridName());
342 344
                }
343 345

  
344 346
            }
345 347
        }
346 348

  
347
        for (TaxonBase concept: toSaveNewConcept){
349
        for (TaxonBase concept: toSaveNewConcepts){
348 350
            for (HybridRelationship rel : concept.getName().getHybridChildRelations()){
349 351
                if (!rel.getParentName().isPersited()) {
350
                    toSaveNewName.add(rel.getParentName());
352
                    toSaveNewNames.add(rel.getParentName());
351 353
                }
352 354
                if (!rel.getHybridName().isPersited()) {
353
                    toSaveNewName.add(rel.getHybridName());
355
                    toSaveNewNames.add(rel.getHybridName());
354 356
                }
355 357

  
356 358
            }
357 359
        }
358
        CdmStore.getService(INameService.class).saveOrUpdate(toSaveNewName);
359
        CdmStore.getService(ITaxonService.class).saveOrUpdate(toSaveNewConcept);
360
        CdmStore.getService(INameService.class).save(toSaveNewNames);
361
        CdmStore.getService(ITaxonService.class).save(toSaveNewConcepts);
360 362

  
361
        toSaveNewName.clear();
362
        toSaveNewConcept.clear();
363
        toSaveNewNames.clear();
364
        toSaveNewConcepts.clear();
363 365

  
364 366
        CdmStore.getService(ITaxonNodeService.class).merge(taxonNode, true);
365 367

  
......
404 406
                "sources", //$NON-NLS-1$
405 407
                "identifiers",
406 408
                "descriptions", //$NON-NLS-1$
407
//                "relationsToThisTaxon.relatedFrom.name.taxonBases.taxonNodes", //$NON-NLS-1$
408
//                "relationsToThisTaxon.relatedFrom.name.taxonBases.relationsFromThisTaxon", //$NON-NLS-1$
409
//                "relationsToThisTaxon.relatedFrom.name.taxonBases.relationsToThisTaxon", //$NON-NLS-1$
410
                "relationsToThisTaxon.relatedFrom.name.typeDesignations.typeSpecimen.derivedFrom.originals",//$NON-NLS-1$
411
                "relationsToThisTaxon.relatedFrom.name.typeDesignations.typeName",//$NON-NLS-1$
412
//                "relationsFromThisTaxon.relatedTo.name.taxonBases.taxonNodes", //$NON-NLS-1$
413
//                "relationsFromThisTaxon.relatedTo.name.taxonBases.relationsFromThisTaxon", //$NON-NLS-1$
414
//                "relationsFromThisTaxon.relatedTo.name.taxonBases.relationsToThisTaxon",
415
                "relationsFromThisTaxon.relatedTo.name.typeDesignations.typeSpecimen.derivedFrom.originals",//$NON-NLS-1$
416
                "relationsFromThisTaxon.relatedTo.name.typeDesignations.typeName",//$NON-NLS-1$
417 409
                "taxonNodes", //$NON-NLS-1$
418 410
                "descriptions.descriptionElements.feature", //$NON-NLS-1$
419 411
                "descriptions.descriptionElements.area", //$NON-NLS-1$
......
432 424
                "synonyms.name.relationsToThisName.fromName", //$NON-NLS-1$
433 425
                "synonyms.name.nomenclaturalReference.inReference.authorship", //$NON-NLS-1$
434 426
                "synonyms.name.nomenclaturalReference.authorship", //$NON-NLS-1$
435
//                "synonyms.name.homotypicalGroup", //$NON-NLS-1$
436
//                "synonyms.synonym.name.homotypicalGroup.typifiedNames", //$NON-NLS-1$
437 427
                "synonyms.name.homotypicalGroup.typifiedNames.taxonBases.synonyms" //$NON-NLS-1$
438 428
        });
439 429

  
......
445 435
     * @param deleteConfig
446 436
     */
447 437
    public void addTaxonBaseToDelete(TaxonBase selectedElement, TaxonBaseDeletionConfigurator deleteConfig) {
448
        this.toDelete.put(selectedElement, deleteConfig);
438
        this.toDeletes.put(selectedElement, deleteConfig);
449 439

  
450 440
    }
451 441

  
......
453 443
     * @param newName
454 444
     */
455 445
    public void addToSaveNewName(TaxonName newName) {
456
        this.toSaveNewName.add(newName);
446
        this.toSaveNewNames.add(newName);
457 447
    }
458 448

  
459 449
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SpecimenTypeDesignationElement.java
9 9

  
10 10
package eu.etaxonomy.taxeditor.ui.section.name;
11 11

  
12
import java.util.Arrays;
13
import java.util.List;
14

  
15 12
import org.eclipse.swt.events.SelectionListener;
16 13

  
17
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
18 14
import eu.etaxonomy.cdm.api.service.name.TypeDesignationStatusComparator;
19 15
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
20 16
import eu.etaxonomy.cdm.model.common.TermType;
......
22 18
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
23 19
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
24 20
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
25
import eu.etaxonomy.taxeditor.store.CdmStore;
26 21
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
27 22
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
28 23
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
......
64 59
	/** {@inheritDoc} */
65 60
	@Override
66 61
	public void setEntity(SpecimenTypeDesignation entity) {
67
	    List<String> prop = Arrays.asList(new String[] {
68
	            "derivedFrom.originals",
69
	            "descriptions"
70
	    });
71

  
72 62
	    super.setEntity(entity);
73 63
        if (entity.getTypeSpecimen() != null){
74
            selection_typeSpecimen.setEntity((DerivedUnit)CdmStore.getService(IOccurrenceService.class).load(entity.getTypeSpecimen().getUuid(), prop));
64
            selection_typeSpecimen.setEntity(entity.getTypeSpecimen());
75 65
        }else{
76 66
            selection_typeSpecimen.setEntity(entity.getTypeSpecimen());
77 67
        }

Also available in: Unified diff