Project

General

Profile

« Previous | Next » 

Revision 882037f9

Added by Katja Luther almost 6 years ago

fix LazyLoading exception for typeSpecimen of MAN

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/e4/TaxonEditorInputE4.java
116 116
    private void initForTaxonNode(UUID taxonNodeUuid) {
117 117
    	this.getCdmEntitySession().bind();
118 118
        TaxonNode taxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNodeUuid, getTaxonNodePropertyPaths());
119
//    	TaxonNode taxonNode = getCdmEntitySession().remoteLoad(CdmStore.getService(ITaxonNodeService.class), taxonNodeUuid, getTaxonNodePropertyPaths());
119 120
        if(taxonNode == null){
120 121
            MessagingUtils.warningDialog(Messages.TaxonEditorInput_NOT_IMPLEMENTED, TaxonEditorInputE4.class, Messages.TaxonEditorInput_NOT_IMPLEMENTED_MESSAGE);
121 122
        }
......
126 127

  
127 128
    private void initForTaxonBase(UUID taxonBaseUuid) {
128 129
    	this.getCdmEntitySession().bind();
129
        TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(taxonBaseUuid, getTaxonBasePropertyPaths());
130
//        TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(taxonBaseUuid, getTaxonBasePropertyPaths());
131
    	TaxonBase taxonBase = getCdmEntitySession().remoteLoad(CdmStore.getService(ITaxonService.class), taxonBaseUuid, getTaxonBasePropertyPaths());
130 132
        if (taxonBase != null){
131 133
            if(taxonBase.isInstanceOf(Taxon.class)){
132 134
                Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class);
......
180 182
    private void setInputForMultipleNodes(ConversationHolder conversation, Set<TaxonNode> taxonNodes){
181 183
        if(taxonNodes.size() == 1){
182 184
            TaxonNode taxonNode = taxonNodes.iterator().next();
183
            taxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNode.getUuid(), getTaxonNodePropertyPaths());
185
            taxonNode = getCdmEntitySession().remoteLoad(CdmStore.getService(ITaxonNodeService.class), taxonNode.getUuid(), getTaxonNodePropertyPaths());
184 186
            init(taxonNode);
185 187
        }else if(taxonNodes.size() > 1){
186 188
            TaxonNode taxonNode = ChooseFromMultipleTaxonNodesDialog.choose(taxonNodes);
......
332 334

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

  
342 344
            }
343 345
        }
344 346

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

  
354 356
            }
355 357
        }
......
402 404
                "sources", //$NON-NLS-1$
403 405
                "identifiers",
404 406
                "descriptions", //$NON-NLS-1$
405
                "relationsToThisTaxon.relatedFrom.name",//$NON-NLS-1$
406
                "relationsToThisTaxon.relatedFrom.name.taxonBases.taxonNodes", //$NON-NLS-1$
407
                "relationsToThisTaxon.relatedFrom.name.taxonBases.relationsFromThisTaxon", //$NON-NLS-1$
408
                "relationsToThisTaxon.relatedFrom.name.taxonBases.relationsToThisTaxon", //$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$
409 410
                "relationsToThisTaxon.relatedFrom.name.typeDesignations.typeSpecimen.derivedFrom.originals",//$NON-NLS-1$
410 411
                "relationsToThisTaxon.relatedFrom.name.typeDesignations.typeName",//$NON-NLS-1$
411
                "relationsFromThisTaxon.relatedTo.name",//$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",
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 415
                "relationsFromThisTaxon.relatedTo.name.typeDesignations.typeSpecimen.derivedFrom.originals",//$NON-NLS-1$
416 416
                "relationsFromThisTaxon.relatedTo.name.typeDesignations.typeName",//$NON-NLS-1$
417 417
                "taxonNodes", //$NON-NLS-1$
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

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

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

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

  
65 79
		SpecimenTypeDesignationStatus typeStatus = HibernateProxyHelper
66 80
				.deproxy(entity.getTypeStatus(), SpecimenTypeDesignationStatus.class);

Also available in: Unified diff