InspectSessionsDialog : added filtering
authorCherian Mathew <c.mathew@bgbm.org>
Wed, 20 May 2015 12:24:16 +0000 (12:24 +0000)
committerCherian Mathew <c.mathew@bgbm.org>
Wed, 20 May 2015 12:24:16 +0000 (12:24 +0000)
CdmStore : clearing caches and session before connecting
ParseHandler : using NonViralName instead of TaxonNameBase
AbstractPostTaxonOperation, AbstractPostOperation, AbstractPersistentPostOperation : added CdmEntitySessionEnabled object to constructor
NewTaxonNodeWizard : explicitly fire changes

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTaxonNodeWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPersistentPostOperation.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostOperation.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostTaxonOperation.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/ParseHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/InspectSessionsDialog.java
eu.etaxonomy.taxeditor.store/src/test/java/eu/etaxonomy/taxeditor/store/operations/AbstractTaxeditorOperationTestBase.java

index e2dcdb6ff825b6448445a5c50087a37fb52f8f9b..6c7f7161ca02dc3b2441591ed2cd4a673f622ea1 100644 (file)
@@ -3,12 +3,15 @@
  */
 package eu.etaxonomy.taxeditor.newWizard;
 
  */
 package eu.etaxonomy.taxeditor.newWizard;
 
+import java.util.HashSet;
+import java.util.Set;
 import java.util.UUID;
 
 import org.apache.commons.lang.StringUtils;
 
 import eu.etaxonomy.cdm.api.service.IClassificationService;
 import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
 import java.util.UUID;
 
 import org.apache.commons.lang.StringUtils;
 
 import eu.etaxonomy.cdm.api.service.IClassificationService;
 import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
@@ -49,7 +52,10 @@ public class NewTaxonNodeWizard extends AbstractNewEntityWizard<ITaxonTreeNode>{
                                TaxonNode taxonNode = parent.addChildTaxon(taxon, parent.getReference(), parent.getMicroReference());
                                taxonNode = CdmStore.getService(ITaxonNodeService.class).merge(taxonNode);
                                generatedTaxonNodeUuid = taxonNode.getUuid();
                                TaxonNode taxonNode = parent.addChildTaxon(taxon, parent.getReference(), parent.getMicroReference());
                                taxonNode = CdmStore.getService(ITaxonNodeService.class).merge(taxonNode);
                                generatedTaxonNodeUuid = taxonNode.getUuid();
-                               CdmStore.getCurrentSessionManager().getActiveSession().addEvent(taxonNode, EventType.INSERT);
+                               Set<CdmBase> affectedObjects = new HashSet<CdmBase>();
+                       affectedObjects.add((TaxonNode)parent);
+                               CdmStore.getCurrentSessionManager().getActiveSession().addEvent(taxonNode, affectedObjects, EventType.INSERT);
+                               CdmStore.getCurrentSessionManager().getActiveSession().fireNotifications();
                        }catch(IllegalArgumentException e){
                                MessagingUtils.warningDialog("Taxon already exists in classfication", getClass(), e.getMessage());
                        }
                        }catch(IllegalArgumentException e){
                                MessagingUtils.warningDialog("Taxon already exists in classfication", getClass(), e.getMessage());
                        }
index 09a2a532aa574018ce778b6948a509b2267e60ea..5811603ba9dbe6a96b2d3a0096539c3acd412d25 100644 (file)
@@ -33,7 +33,7 @@ import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
  */
 public abstract class AbstractPersistentPostOperation extends AbstractPostTaxonOperation {
        private final IConversationEnabled conversationEnabled;
  */
 public abstract class AbstractPersistentPostOperation extends AbstractPostTaxonOperation {
        private final IConversationEnabled conversationEnabled;
-       private final ICdmEntitySessionEnabled cdmEntitySessionEnabled;
+
        protected ITaxonTreeNode parentNode;
 
        /**
        protected ITaxonTreeNode parentNode;
 
        /**
@@ -48,9 +48,8 @@ public abstract class AbstractPersistentPostOperation extends AbstractPostTaxonO
                        IPostOperationEnabled postOperationEnabled,
                        IConversationEnabled conversationEnabled,
                        ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
                        IPostOperationEnabled postOperationEnabled,
                        IConversationEnabled conversationEnabled,
                        ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
-               super(label, undoContext, postOperationEnabled);
+               super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
                this.conversationEnabled = conversationEnabled;
                this.conversationEnabled = conversationEnabled;
-               this.cdmEntitySessionEnabled = cdmEntitySessionEnabled;
        }
 
        /**
        }
 
        /**
@@ -67,9 +66,9 @@ public abstract class AbstractPersistentPostOperation extends AbstractPostTaxonO
                        IPostOperationEnabled postOperationEnabled,
                        IConversationEnabled conversationEnabled,
                        ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
                        IPostOperationEnabled postOperationEnabled,
                        IConversationEnabled conversationEnabled,
                        ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
-               super(label, undoContext, taxonNode, postOperationEnabled);
+               super(label, undoContext, taxonNode, postOperationEnabled, cdmEntitySessionEnabled);
                this.conversationEnabled = conversationEnabled;
                this.conversationEnabled = conversationEnabled;
-               this.cdmEntitySessionEnabled = cdmEntitySessionEnabled;
+
        }
 
        /**
        }
 
        /**
@@ -86,10 +85,10 @@ public abstract class AbstractPersistentPostOperation extends AbstractPostTaxonO
                        IPostOperationEnabled postOperationEnabled,
                        IConversationEnabled conversationEnabled,
             ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
                        IPostOperationEnabled postOperationEnabled,
                        IConversationEnabled conversationEnabled,
             ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
-               super(label, undoContext, postOperationEnabled);
+               super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
                this.parentNode = parentNode;
                this.conversationEnabled = conversationEnabled;
                this.parentNode = parentNode;
                this.conversationEnabled = conversationEnabled;
-               this.cdmEntitySessionEnabled = cdmEntitySessionEnabled;
+
        }
 
        /* (non-Javadoc)
        }
 
        /* (non-Javadoc)
@@ -105,8 +104,8 @@ public abstract class AbstractPersistentPostOperation extends AbstractPostTaxonO
                        conversationEnabled.getConversationHolder().bind();
                        conversationEnabled.getConversationHolder().commit(true);
                }
                        conversationEnabled.getConversationHolder().bind();
                        conversationEnabled.getConversationHolder().commit(true);
                }
-               if(cdmEntitySessionEnabled != null) {
-                   cdmEntitySessionEnabled.getCdmEntitySession().fireNotifications();
+               if(getCdmEntitySessionEnabled() != null) {
+                   getCdmEntitySessionEnabled().getCdmEntitySession().fireNotifications();
                }
                IStatus status = super.postExecute(objectAffectedByOperation);
 
                }
                IStatus status = super.postExecute(objectAffectedByOperation);
 
@@ -118,6 +117,9 @@ public abstract class AbstractPersistentPostOperation extends AbstractPostTaxonO
         */
        public void bind(){
                conversationEnabled.getConversationHolder().bind();
         */
        public void bind(){
                conversationEnabled.getConversationHolder().bind();
+               if(getCdmEntitySessionEnabled() != null) {
+                   getCdmEntitySessionEnabled().getCdmEntitySession().bind();
+        }
        }
 
 }
        }
 
 }
index 5b7c68ec8230074a7de6ef72c0fd5ae812bb3636..c313d1f0f9f236ea48bcc8c0e558ad82a5e8a84a 100644 (file)
@@ -16,6 +16,7 @@ import org.eclipse.core.runtime.Status;
 
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.ICdmBase;
 
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
 
 /**
  * @author pplitzner
 
 /**
  * @author pplitzner
@@ -35,6 +36,8 @@ public abstract class AbstractPostOperation<T extends ICdmBase> extends Abstract
      */
     protected IPostOperationEnabled postOperationEnabled;
 
      */
     protected IPostOperationEnabled postOperationEnabled;
 
+    private ICdmEntitySessionEnabled cdmEntitySessionEnabled;
+
 
     /**
      * <p>Constructor for AbstractPostOperation.</p>
 
     /**
      * <p>Constructor for AbstractPostOperation.</p>
@@ -71,6 +74,15 @@ public abstract class AbstractPostOperation<T extends ICdmBase> extends Abstract
         this.postOperationEnabled = postOperationEnabled;
     }
 
         this.postOperationEnabled = postOperationEnabled;
     }
 
+    public AbstractPostOperation(String label, IUndoContext undoContext,
+            T element, IPostOperationEnabled postOperationEnabled,
+            ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+        this(label, undoContext);
+        this.element = element;
+        this.postOperationEnabled = postOperationEnabled;
+        this.cdmEntitySessionEnabled = cdmEntitySessionEnabled;
+    }
+
     /**
      * This method will try to call the post operation on a possibly registered
      * IPostOperationEnabled implementor. Objects that were affected by the operation
     /**
      * This method will try to call the post operation on a possibly registered
      * IPostOperationEnabled implementor. Objects that were affected by the operation
@@ -80,10 +92,11 @@ public abstract class AbstractPostOperation<T extends ICdmBase> extends Abstract
      * @return a {@link org.eclipse.core.runtime.IStatus} object.
      */
     protected IStatus postExecute(CdmBase objectAffectedByOperation) {
      * @return a {@link org.eclipse.core.runtime.IStatus} object.
      */
     protected IStatus postExecute(CdmBase objectAffectedByOperation) {
-       if(postOperationEnabled != null){
-               return postOperationEnabled.postOperation(objectAffectedByOperation) ? Status.OK_STATUS : Status.CANCEL_STATUS;
-       }
-       return Status.OK_STATUS;
+
+        if(postOperationEnabled != null){
+            return postOperationEnabled.postOperation(objectAffectedByOperation) ? Status.OK_STATUS : Status.CANCEL_STATUS;
+        }
+        return Status.OK_STATUS;
     }
 
     /**
     }
 
     /**
@@ -92,7 +105,34 @@ public abstract class AbstractPostOperation<T extends ICdmBase> extends Abstract
      * @return a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
      */
     public IPostOperationEnabled getPostOperationEnabled() {
      * @return a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
      */
     public IPostOperationEnabled getPostOperationEnabled() {
-       return postOperationEnabled;
+        return postOperationEnabled;
+    }
+
+//    protected IStatus updateSession(CdmBase clientObjectAffectedByOperation, UpdateResult updateResult) {
+//        Set<CdmBase> affectedObjects;
+//        if(updateResult == null) {
+//            affectedObjects = new HashSet<CdmBase>();
+//        } else {
+//            affectedObjects = updateResult.getUpdatedObjects();
+//        }
+//
+//        if(cdmEntitySessionEnabled != null) {
+//            cdmEntitySessionEnabled.getCdmEntitySession().update(clientObjectAffectedByOperation, affectedObjects);
+//        }
+//        return Status.OK_STATUS;
+//    }
+//
+//    protected IStatus updateSession(UUID uuid) {
+//
+//        if(cdmEntitySessionEnabled != null) {
+//            CdmBase cdmBase = cdmEntitySessionEnabled.getCdmEntitySession().remoteLoad(CdmStore.getService(IService.class),uuid);
+//            cdmEntitySessionEnabled.getCdmEntitySession().update(null, cdmBase);
+//        }
+//        return Status.OK_STATUS;
+//    }
+
+    public ICdmEntitySessionEnabled getCdmEntitySessionEnabled() {
+        return cdmEntitySessionEnabled;
     }
 
 }
\ No newline at end of file
     }
 
 }
\ No newline at end of file
index b37c5401060a7b0dc3825b3e1210422ba01ac992..6604f27bb22cd09fda681b1fd62231c5182e681d 100644 (file)
@@ -1,11 +1,11 @@
 /**
 /**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
 
 package eu.etaxonomy.taxeditor.operation;
 
 
 package eu.etaxonomy.taxeditor.operation;
 
@@ -16,6 +16,7 @@ import org.eclipse.core.commands.operations.IUndoContext;
 import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
 
 /**
  * <p>Abstract AbstractPostOperation class.</p>
 
 /**
  * <p>Abstract AbstractPostOperation class.</p>
@@ -27,64 +28,78 @@ import eu.etaxonomy.cdm.model.taxon.TaxonNode;
  */
 public abstract class AbstractPostTaxonOperation extends AbstractPostOperation<Taxon> {
 
  */
 public abstract class AbstractPostTaxonOperation extends AbstractPostOperation<Taxon> {
 
-       /**
-        * A reference to the taxons TaxonNode
-        */
-       protected ITaxonTreeNode taxonNode;
-
-       protected UUID parentNodeUuid;
-
-
-       /**
-        * <p>Constructor for AbstractPostOperation.</p>
-        *
-        * @param label a {@link java.lang.String} object.
-        * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
-        * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
-        * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
-        */
-       public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
-                       Taxon taxon, IPostOperationEnabled postOperationEnabled) {
-               super(label, undoContext, taxon, postOperationEnabled);
-       }
-
-       /**
-        * <p>Constructor for AbstractPostOperation.</p>
-        *
-        * @param label a {@link java.lang.String} object.
-        * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
-        * @param taxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
-        * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
-        */
-       public AbstractPostTaxonOperation(String label, IUndoContext undoContext, TaxonNode taxonNode, IPostOperationEnabled postOperationEnabled){
-               this(label, undoContext, taxonNode.getTaxon(), postOperationEnabled);
-               this.taxonNode = taxonNode;
-       }
-
-       /**
-        * <p>Constructor for AbstractPostOperation.</p>
-        *
-        * @param label a {@link java.lang.String} object.
-        * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
-        * @param parentNodeUuid a {@link java.util.UUID} object.
-        * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
-        */
-       public AbstractPostTaxonOperation(String label, IUndoContext undoContext, UUID parentNodeUuid, IPostOperationEnabled postOperationEnabled){
-               super(label, undoContext, null, postOperationEnabled);
-               this.parentNodeUuid = parentNodeUuid;
-       }
-
-       /**
-        * <p>Constructor for AbstractPostOperation.</p>
-        *
-        * @param label a {@link java.lang.String} object.
-        * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
-        * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
-        */
-       public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
-                       IPostOperationEnabled postOperationEnabled) {
-               super(label, undoContext, null, postOperationEnabled);
-       }
+    /**
+     * A reference to the taxons TaxonNode
+     */
+    protected ITaxonTreeNode taxonNode;
+
+    protected UUID parentNodeUuid;
+
+
+    /**
+     * <p>Constructor for AbstractPostOperation.</p>
+     *
+     * @param label a {@link java.lang.String} object.
+     * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+     * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
+     * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
+     */
+    public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
+            Taxon taxon, IPostOperationEnabled postOperationEnabled) {
+        super(label, undoContext, taxon, postOperationEnabled, null);
+    }
+
+    public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
+            Taxon taxon, IPostOperationEnabled postOperationEnabled, ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+        super(label, undoContext, taxon, postOperationEnabled, cdmEntitySessionEnabled);
+    }
+
+    /**
+     * <p>Constructor for AbstractPostOperation.</p>
+     *
+     * @param label a {@link java.lang.String} object.
+     * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+     * @param taxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
+     * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
+     */
+    public AbstractPostTaxonOperation(String label, IUndoContext undoContext, TaxonNode taxonNode, IPostOperationEnabled postOperationEnabled){
+        this(label, undoContext, taxonNode, postOperationEnabled, null);
+    }
+
+    public AbstractPostTaxonOperation(String label, IUndoContext undoContext, TaxonNode taxonNode, IPostOperationEnabled postOperationEnabled, ICdmEntitySessionEnabled cdmEntitySessionEnabled){
+        this(label, undoContext, taxonNode.getTaxon(), postOperationEnabled, cdmEntitySessionEnabled);
+        this.taxonNode = taxonNode;
+    }
+
+    /**
+     * <p>Constructor for AbstractPostOperation.</p>
+     *
+     * @param label a {@link java.lang.String} object.
+     * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+     * @param parentNodeUuid a {@link java.util.UUID} object.
+     * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
+     */
+    public AbstractPostTaxonOperation(String label, IUndoContext undoContext, UUID parentNodeUuid, IPostOperationEnabled postOperationEnabled){
+        super(label, undoContext, null, postOperationEnabled, null);
+        this.parentNodeUuid = parentNodeUuid;
+    }
+
+    /**
+     * <p>Constructor for AbstractPostOperation.</p>
+     *
+     * @param label a {@link java.lang.String} object.
+     * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+     * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
+     */
+    public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
+            IPostOperationEnabled postOperationEnabled) {
+        super(label, undoContext, null, postOperationEnabled, null);
+    }
+
+    public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
+            IPostOperationEnabled postOperationEnabled, ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+        super(label, undoContext, null, postOperationEnabled, cdmEntitySessionEnabled);
+    }
 
     /**
      * @param text
 
     /**
      * @param text
index 0bae265df446e3be9ffed310b7b0d004ed525372..2059f5d7a16ee215d9796a719119475b7e685ba9 100644 (file)
@@ -89,8 +89,8 @@ public class ParseHandler{
         * @param unparsedNameString a {@link java.lang.String} object.
         * @return a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
         */
         * @param unparsedNameString a {@link java.lang.String} object.
         * @return a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
         */
-       public static TaxonNameBase parseReferencedName(String unparsedNameString, Rank rank){
-               TaxonNameBase name = nonViralNameParser.parseReferencedName(unparsedNameString,
+       public static NonViralName parseReferencedName(String unparsedNameString, Rank rank){
+           NonViralName name = nonViralNameParser.parseReferencedName(unparsedNameString,
                                PreferencesUtil.getPreferredNomenclaturalCode(), rank);
 
 //             if (name.hasProblem()) {
                                PreferencesUtil.getPreferredNomenclaturalCode(), rank);
 
 //             if (name.hasProblem()) {
@@ -100,8 +100,8 @@ public class ParseHandler{
                return name;
        }
 
                return name;
        }
 
-       public static TaxonNameBase parseName(String unparsedNameString, Rank rank){
-               TaxonNameBase name = nonViralNameParser.parseFullName(unparsedNameString,
+       public static NonViralName parseName(String unparsedNameString, Rank rank){
+               NonViralName name = nonViralNameParser.parseFullName(unparsedNameString,
                                PreferencesUtil.getPreferredNomenclaturalCode(), rank);
 
                return name;
                                PreferencesUtil.getPreferredNomenclaturalCode(), rank);
 
                return name;
@@ -113,7 +113,7 @@ public class ParseHandler{
         *
         * @return a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
         */
         *
         * @return a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
         */
-       public static TaxonNameBase createEmptyName(){
+       public static NonViralName createEmptyName(){
                return nonViralNameParser.getNonViralNameInstance("", PreferencesUtil.getPreferredNomenclaturalCode());
        }
 
                return nonViralNameParser.getNonViralNameInstance("", PreferencesUtil.getPreferredNomenclaturalCode());
        }
 
index 89a898b8a21c71bf80fc27c307a845d471f772d2..e0464916882977fa2af2110b02710ad5a38713c3 100644 (file)
@@ -25,8 +25,6 @@ import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContext;
 import org.springframework.security.core.context.SecurityContextHolder;
 
 import org.springframework.security.core.context.SecurityContext;
 import org.springframework.security.core.context.SecurityContextHolder;
 
-
-import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration;
 import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
 import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
 import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
@@ -45,7 +43,7 @@ import eu.etaxonomy.taxeditor.io.ImportManager;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-
+import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
 import eu.etaxonomy.taxeditor.session.mock.MockCdmEntitySessionManager;
 import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
 import eu.etaxonomy.taxeditor.session.mock.MockCdmEntitySessionManager;
 import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
@@ -91,7 +89,7 @@ public class CdmStore {
        private ICdmSource cdmSource;
 
        private boolean isConnected;
        private ICdmSource cdmSource;
 
        private boolean isConnected;
-       
+
 
 
        /**
 
 
        /**
@@ -120,6 +118,7 @@ public class CdmStore {
 
                ICdmSource cdmSource;
                try {
 
                ICdmSource cdmSource;
                try {
+
                        cdmSource = CdmDataSourceRepository.getCurrentCdmSource();
                        connect(cdmSource);
                } catch (Exception e) {
                        cdmSource = CdmDataSourceRepository.getCurrentCdmSource();
                        connect(cdmSource);
                } catch (Exception e) {
@@ -150,6 +149,13 @@ public class CdmStore {
        private static void connect(final ICdmSource cdmSource,
                        final DbSchemaValidation dbSchemaValidation,
                        final Resource applicationContextBean) {
        private static void connect(final ICdmSource cdmSource,
                        final DbSchemaValidation dbSchemaValidation,
                        final Resource applicationContextBean) {
+           if(isActive()) {
+               // before we connect we clear the caches and the sessions
+               CdmRemoteCacheManager.getInstance().getDefaultCacheManager().removalAll();
+               if(getCurrentSessionManager() != null) {
+                   getCurrentSessionManager().disposeAll();
+               }
+           }
                MessagingUtils.info("Connecting to datasource: " + cdmSource);
 
                job = new CdmStoreConnector(Display.getDefault(), cdmSource,
                MessagingUtils.info("Connecting to datasource: " + cdmSource);
 
                job = new CdmStoreConnector(Display.getDefault(), cdmSource,
@@ -256,10 +262,10 @@ public class CdmStore {
                }
                return conversation;
        }
                }
                return conversation;
        }
-       
+
        //FIXME:Remoting should be removed after moving completely to remoting
        private MockCdmEntitySessionManager mockCdmEntitySessionManager;
        //FIXME:Remoting should be removed after moving completely to remoting
        private MockCdmEntitySessionManager mockCdmEntitySessionManager;
-       
+
        private ICdmEntitySessionManager getSessionManager() {
                //FIXME:Remoting we should only have CdmApplicationRemoteConfiguration after move to remoting
                //               bad hack which should be finally removed
        private ICdmEntitySessionManager getSessionManager() {
                //FIXME:Remoting we should only have CdmApplicationRemoteConfiguration after move to remoting
                //               bad hack which should be finally removed
@@ -269,10 +275,10 @@ public class CdmStore {
                        if(mockCdmEntitySessionManager == null) {
                                mockCdmEntitySessionManager = new MockCdmEntitySessionManager();
                        }
                        if(mockCdmEntitySessionManager == null) {
                                mockCdmEntitySessionManager = new MockCdmEntitySessionManager();
                        }
-                       return mockCdmEntitySessionManager;                     
+                       return mockCdmEntitySessionManager;
                }
        }
                }
        }
-       
+
        public static  ICdmEntitySessionManager getCurrentSessionManager() {
                if (getDefault() != null) {
                        return getDefault().getSessionManager();
        public static  ICdmEntitySessionManager getCurrentSessionManager() {
                if (getDefault() != null) {
                        return getDefault().getSessionManager();
index 82db7c539083a2a6d45bffcd11bee736002f9c3f..003ecb2157cdcc707662c5028ed0ecdf079fa124 100644 (file)
@@ -1,12 +1,12 @@
 // $Id$
 /**
 // $Id$
 /**
-* Copyright (C) 2015 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2015 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
 package eu.etaxonomy.taxeditor.view.sessions;
 
 import java.util.List;
 package eu.etaxonomy.taxeditor.view.sessions;
 
 import java.util.List;
@@ -14,6 +14,7 @@ import java.util.List;
 import net.sf.ehcache.Cache;
 import net.sf.ehcache.Element;
 
 import net.sf.ehcache.Cache;
 import net.sf.ehcache.Element;
 
+import org.eclipse.jface.viewers.ILabelProvider;
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.StyledCellLabelProvider;
 import org.eclipse.jface.viewers.StyledString;
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.StyledCellLabelProvider;
 import org.eclipse.jface.viewers.StyledString;
@@ -24,6 +25,7 @@ import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.SashForm;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.custom.SashForm;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
@@ -33,7 +35,8 @@ import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.dialogs.FilteredTree;
+import org.eclipse.ui.dialogs.PatternFilter;
 import org.eclipse.wb.swt.SWTResourceManager;
 
 import eu.etaxonomy.taxeditor.remoting.cache.CdmModelFieldPropertyFromClass;
 import org.eclipse.wb.swt.SWTResourceManager;
 
 import eu.etaxonomy.taxeditor.remoting.cache.CdmModelFieldPropertyFromClass;
@@ -111,21 +114,25 @@ public class InspectSessionsDialog extends Dialog {
         sashForm = new SashForm(shlInspectSessions, SWT.VERTICAL);
         sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
 
         sashForm = new SashForm(shlInspectSessions, SWT.VERTICAL);
         sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
 
-                treeViewer = new TreeViewer(sashForm, SWT.BORDER);
-                Tree tree = treeViewer.getTree();
+        PatternFilter filter = new PatternFilter();
+        FilteredTree tree = new FilteredTree(sashForm, SWT.MULTI | SWT.H_SCROLL | SWT.BORDER
+                | SWT.V_SCROLL, filter, true);
+        treeViewer = tree.getViewer();
+        //treeViewer = new TreeViewer(sashForm, SWT.BORDER);
+        //Tree tree = treeViewer.getTree();
 
 
-                                compositeDebug = new Composite(sashForm, SWT.NONE);
-                                                        compositeDebug.setLayout(new GridLayout(1, false));
+        compositeDebug = new Composite(sashForm, SWT.NONE);
+        compositeDebug.setLayout(new GridLayout(1, false));
 
 
-                                                        lblDebugInformation = new Label(compositeDebug, SWT.NONE);
-                                                        lblDebugInformation.setAlignment(SWT.CENTER);
-                                                        lblDebugInformation.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1));
-                                                        lblDebugInformation.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
-                                                        lblDebugInformation.setText("Debug Information");
+        lblDebugInformation = new Label(compositeDebug, SWT.NONE);
+        lblDebugInformation.setAlignment(SWT.CENTER);
+        lblDebugInformation.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1));
+        lblDebugInformation.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+        lblDebugInformation.setText("Debug Information");
 
 
-                                                                                        txtDebugInfo = new Text(compositeDebug, SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
-                                                                                        txtDebugInfo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
-                                sashForm.setWeights(new int[] {338, 184});
+        txtDebugInfo = new Text(compositeDebug, SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
+        txtDebugInfo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+        sashForm.setWeights(new int[] {338, 184});
 
         btnClose = new Button(shlInspectSessions, SWT.NONE);
         btnClose.addSelectionListener(new SelectionAdapter() {
 
         btnClose = new Button(shlInspectSessions, SWT.NONE);
         btnClose.addSelectionListener(new SelectionAdapter() {
@@ -221,7 +228,7 @@ public class InspectSessionsDialog extends Dialog {
 
     }
 
 
     }
 
-    class SessionsTreeLabelProvider extends StyledCellLabelProvider {
+    class SessionsTreeLabelProvider extends StyledCellLabelProvider implements ILabelProvider {
 
         @Override
         public void update(ViewerCell cell) {
 
         @Override
         public void update(ViewerCell cell) {
@@ -234,6 +241,24 @@ public class InspectSessionsDialog extends Dialog {
             cell.setStyleRanges(text.getStyleRanges());
             super.update(cell);
         }
             cell.setStyleRanges(text.getStyleRanges());
             super.update(cell);
         }
+
+        /* (non-Javadoc)
+         * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+         */
+        @Override
+        public Image getImage(Object element) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        /* (non-Javadoc)
+         * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+         */
+        @Override
+        public String getText(Object element) {
+            CdmEntityInfo cei = (CdmEntityInfo)element;
+            return cei.getLabel();
+        }
     }
 }
 
     }
 }
 
index 0bef7f3e843bd7ff8e6f4341284f069a8d0523d4..8e6ea37042e3beb3d7c0b50b2eada98879ca17f4 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
 
 /**
  * @author n.hoffmann
 
 /**
  * @author n.hoffmann
@@ -24,13 +25,14 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
  * @version 1.0
  */
 public abstract class AbstractTaxeditorOperationTestBase {
  * @version 1.0
  */
 public abstract class AbstractTaxeditorOperationTestBase {
-       
+
        public static final IUndoContext undoContext = null;
        public static final IUndoContext undoContext = null;
-       
+
        public static final IProgressMonitor monitor = null;
        public static final IProgressMonitor monitor = null;
-       public static final IAdaptable info = null;     
+       public static final IAdaptable info = null;
        public static final IPostOperationEnabled postOperation = null;
        public static final IPostOperationEnabled postOperation = null;
-       
+       public static final ICdmEntitySessionEnabled cdmEntitySessionEnabled = null;
+
        protected static AbstractPostOperation operation;
        protected static Taxon taxon;
 }
        protected static AbstractPostOperation operation;
        protected static Taxon taxon;
 }