fix #6056: when creating checklisteditorInput don't init session at the beginning...
authorKatja Luther <k.luther@bgbm.org>
Mon, 19 Sep 2016 11:07:56 +0000 (13:07 +0200)
committerKatja Luther <k.luther@bgbm.org>
Mon, 19 Sep 2016 11:07:56 +0000 (13:07 +0200)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditorInput.java

index fda70e878a2e40649782563275cb74168ff02478..0d5cee3e09c5db800d7e100aa26f3acc51a9df5c 100644 (file)
@@ -477,11 +477,14 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I
     /** {@inheritDoc} */
     @Override
     public void dispose() {
-        this.checklistEditorInput.dispose();
-
+       this.checklistEditorInput.dispose();
+       super.dispose();
+        
         conversation.unregisterForDataStoreChanges(this);
-        conversation.close();
-        super.dispose();
+        conversation.unbind();
+       
+        //conversation.close();
+               conversation = null;
     }
 
     /** {@inheritDoc} */
@@ -838,4 +841,6 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I
 
         return conversation;
     }
+    
+    
 }
index e922646171264d8cce3cf4ea0554dbe26ac3aee4..a49afaedfa2b6a02a067eb0245dfac24daed0b7f 100644 (file)
@@ -21,6 +21,7 @@ import org.eclipse.ui.IPersistable;
 import org.eclipse.ui.IPersistableElement;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
 import eu.etaxonomy.cdm.api.service.ITaxonService;
 import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
@@ -54,12 +55,16 @@ public class ChecklistEditorInput extends CdmEntitySessionInput implements IEdit
      * @param taxonNode
      */
     public ChecklistEditorInput(TaxonNode taxonNode){
-        super(true);
+        super(false);
+        System.out.println(this.toString());
         this.conversation = CdmStore.createConversation();
-        this.taxonNode = CdmStore.getCurrentApplicationConfiguration().getTaxonNodeService().load(taxonNode.getUuid());
+        this.taxonNode =CdmStore.getService(ITaxonNodeService.class).load(taxonNode.getUuid(), getTaxonNodePropertyPaths());
        // getChildTaxa(taxonNode);
         classification = taxonNode.getClassification();
+        initSession();
+        System.out.println(this.toString());
     }
+    
 
     /**
      * @param taxonNode2
@@ -241,5 +246,59 @@ public class ChecklistEditorInput extends CdmEntitySessionInput implements IEdit
     public ConversationHolder getConversation() {
         return conversation;
     }
+    
+    private List<String> getTaxonNodePropertyPaths() {
+        List<String> taxonNodePropertyPaths = new ArrayList<String>();
+        for(String propertyPath : getTaxonBasePropertyPaths()) {
+            taxonNodePropertyPaths.add("taxon." + propertyPath);
+        }
+        return taxonNodePropertyPaths;
+    }
+
+    private List<String> getTaxonBasePropertyPaths() {
+        List<String> taxonBasePropertyPaths = Arrays.asList(new String[] {
+                "sec",
+                "createdBy",
+                "updatedBy",
+                "annotations",
+                "markers",
+                "credits",
+                "extensions",
+                "rights",
+                "sources",
+                "descriptions",
+                "relationsToThisTaxon",
+                "relationsFromThisTaxon",
+                "taxonNodes",
+                "descriptions.descriptionElements.feature",
+                "descriptions.descriptionElements.area",
+                "descriptions.descriptionElements.status",
+                "descriptions.markers",
+                "name.descriptions",
+                "name.typeDesignations",
+                "name.status",
+                "name.nomenclaturalReference.inReference",
+                "name.taxonBases.taxonNodes",
+                "name.relationsFromThisName",
+                "name.relationsToThisName",
+                "name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.synonym.name.status",
+                "name.homotypicalGroup.typifiedNames.relationsToThisName.fromName",
+                "synonymRelations.synonym.name.status.type",
+                "synonymRelations.synonym.name.relationsToThisName.fromName",
+                "synonymRelations.synonym.name.nomenclaturalReference.inReference.authorship",
+                "synonymRelations.synonym.name.nomenclaturalReference.authorship",
+                "synonymRelations.synonym.name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations"
+        });
+
+        return taxonBasePropertyPaths;
+    }
+    
+//    @Override
+//    public void dispose(){
+//     conversation.unbind();
+//     conversation.close();
+//     getCdmEntitySession().dispose();
+//     super.dispose();
+//    }
 
 }