ICdmDataChangeService, CdmUIDataChangeService, CdmDataChangeService : added new data...
authorCherian Mathew <c.mathew@bgbm.org>
Fri, 19 Jun 2015 08:31:18 +0000 (10:31 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Fri, 19 Jun 2015 08:43:35 +0000 (10:43 +0200)
CdmApplicationState, CdmStore : added data change service to app state
CdmChangeEvent, ICdmChangeListener : added change listener and even to fire in case of data changes
ICdmEntitySessionEnabled : extends new change service interface
ICdmEntitySession, CdmEntitySession : removed data change un/registration since this is now handled by the new data change service
BaseRemotingTest, MockCdmEntitySession, *Editor, *ViewPart, *Navigator : refactoring with new change listener
RemotingCdmHandler, RemotingCdmOperation, RemotingCdmUpdateOperation : added new handler / operation architecture base classes
AbstractUtility : added method for running async operation with callback to handler
RemotingChangeAcceptedTaxonToSynonymHandler,RemotingChangeAcceptedTaxonToSynonymOperation : first implementations of new handler / operation architecture
plugin.xml : added standalone and remoting handlers for ChangeAcceptedTaxonToSynonym
*Test : adapted for new handler / operation and change service

39 files changed:
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationException.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmChangeEvent.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmDataChangeService.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/ICdmChangeListener.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/ICdmDataChangeService.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/CdmEntitySession.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySession.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySessionEnabled.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/mock/MockCdmEntitySession.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/CdmEntitySessionInput.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInput.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyEditorInput.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphView.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java
eu.etaxonomy.taxeditor.navigation/plugin.xml
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewPart.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingChangeAcceptedTaxonToSynonymHandler.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingChangeAcceptedTaxonToSynonymOperation.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/RemotingCdmHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/RemotingCdmOperation.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/RemotingCdmUpdateOperation.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmUIDataChangeService.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNavigatorTest.java
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/BaseRemotingTest.java
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/RemotingSessionAwareTest.java
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operations/BaseOperationTest.java
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/session/MockSessionOwner.java
eu.etaxonomy.taxeditor.test/src/test/resources/eu/etaxonomy/cdm/model/TaxonNavigatorTest.xml

index a9f3c11b85715ee97d1d86b4e2aff6810b7cc2f2..7f177503aafa798225f2646362407f88a1d2d864 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* 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.
 */
@@ -28,38 +28,29 @@ import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.viewers.TableViewerColumn;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.swt.SWT;
-
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Table;
-import org.eclipse.ui.INullSelectionListener;
-import org.eclipse.ui.ISelectionListener;
-
 import org.eclipse.ui.IWorkbenchPart;
 
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IAgentService;
-import eu.etaxonomy.cdm.api.service.ICommonService;
 import eu.etaxonomy.cdm.api.service.IGroupService;
-
 import eu.etaxonomy.cdm.api.service.INameService;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.api.service.IReferenceService;
 import eu.etaxonomy.cdm.api.service.ITaxonService;
 import eu.etaxonomy.cdm.api.service.IUserService;
-
 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.Group;
-
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
 import eu.etaxonomy.cdm.model.common.User;
 import eu.etaxonomy.cdm.model.name.NonViralName;
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.model.DescriptionHelper;
 import eu.etaxonomy.taxeditor.model.LineSelection;
@@ -79,12 +70,12 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
 
        /** Constant <code>ID="eu.etaxonomy.taxeditor.bulkeditor.refer"{trunked}</code> */
        public static final String ID = "eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects";
-       
+
        private TableViewer viewer;
 
        private String referencedObjectTitleCache;
-       private ConversationHolder conversation; 
-       
+       private ConversationHolder conversation;
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#createViewer(org.eclipse.swt.widgets.Composite)
         */
@@ -100,7 +91,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
                viewer.setLabelProvider(new ReferencingObjectsLabelProvider());
 //             viewer.setInput(new ArrayList<CdmBase>());
        }
-       
+
        /**
         * Create the columns for the table
         * @param viewer
@@ -127,39 +118,39 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
         * @param entity a {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity} object.
         */
        public void updateReferencingObjects(final UUID entityUUID, final Class objectClass) {
-               
+
                final Display display = Display.getCurrent();
-               
+
                Job job = new Job("Update Referencing Objects") {
-                       
+
                        @Override
                        protected IStatus run(IProgressMonitor monitor) {
                                monitor.beginTask("Calculating referencing objects", 10);
-                       
+
                                monitor.worked(3);
-                               
+
                                display.asyncExec(new Runnable() {
-                                       
+
                                        @Override
                                        public void run() {
                                                if (entityUUID != null){
-                                                       
+
                                                        List<CdmBase> referencingObjects = getReferencingObjects(entityUUID, objectClass);
-                                                       
+
                                                        updateView(referencingObjects);
-                                                       
-                                                       
+
+
                                                }
                                        }
                                });
-                               
+
                                monitor.done();
-                               
-                               
+
+
                                return Status.OK_STATUS;
                        }
                };
-               
+
                job.setPriority(Job.DECORATE);
                job.schedule();
        }
@@ -184,31 +175,32 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
                }
                        //referencedObject =(CdmBase) CdmStore.getService(IIdentifiableEntityService.class).load(referencedObject.getUuid());
                Set<CdmBase> setOfReferencingObjects = null;
-               
+
                if (referencedObject != null){
                        referencedObjectTitleCache = ((IdentifiableEntity)referencedObject).getTitleCache();
                        setOfReferencingObjects = CdmStore.getCommonService().getReferencingObjects(referencedObject);
                }
                if (setOfReferencingObjects != null){
-                       List<CdmBase> referencingObjects = new ArrayList<CdmBase>(setOfReferencingObjects);                     
-                       
+                       List<CdmBase> referencingObjects = new ArrayList<CdmBase>(setOfReferencingObjects);
+
                        Collections.sort(referencingObjects, new ReferencingClassComparator());
-                               
+
                        return referencingObjects;
-                       
+
                }
         } catch (Exception e) {
             logger.error("Error retrieving referencing objects", e);
         }
                return null;
        }
-       
+
        class ReferencingClassComparator implements Comparator<CdmBase> {
 
                /* (non-Javadoc)
                 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
                 */
-               public int compare(CdmBase o1, CdmBase o2) {
+               @Override
+        public int compare(CdmBase o1, CdmBase o2) {
                        String string1 = o1.getClass().getSimpleName();
                        String string2 = o2.getClass().getSimpleName();
                        int classCompare = string1.compareToIgnoreCase(string2);
@@ -221,9 +213,9 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
                        }
                }
        }
-       
+
        /**
-        * 
+        *
         */
        private void updateView(List<CdmBase> referencingObjects) {
                if (viewer != null && !viewer.getControl().isDisposed()){
@@ -238,29 +230,30 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
        }
 
        /** {@inheritDoc} */
-       public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+       @Override
+    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
                if(! (part instanceof BulkEditor)){
                        setContentDescription("");
                        showEmptyPage();
                        return;
                }
-               
+
                if(! (selection instanceof LineSelection)){
                        return;
                }
                LineSelection lineSelection = (LineSelection) selection;
-               
+
                if(lineSelection.size() != 1){
                        return;
                }
-                       
+
                if(! (lineSelection.getFirstElement() instanceof IdentifiableEntity)){
                        return;
                }
-               
+
                showViewer(part, lineSelection);
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#showViewer(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
         */
@@ -268,10 +261,10 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
        @Override
        public void showViewer(IWorkbenchPart part, IStructuredSelection selection) {
        //      this.part = part;
-               
+
                updateReferencingObjects(((IdentifiableEntity) selection.getFirstElement()).getUuid(),selection.getFirstElement().getClass() );
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public void dispose() {
@@ -279,7 +272,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
                selectionService.removePostSelectionListener(this);
                selectionService.removeSelectionListener(this);
                super.dispose();
-               
+
        }
 
        /* (non-Javadoc)
@@ -299,7 +292,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
        public void changed(Object object) {
                // no editing in this view
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#onComplete()
         */
@@ -308,15 +301,24 @@ public class ReferencingObjectsView extends AbstractCdmViewPart{
        public boolean onComplete() {
                return false;
        }
-       
+
        public void refresh(){
-               
+
                selectionService.removePostSelectionListener(this);
                selectionService.removeSelectionListener(this);
                selectionService.addPostSelectionListener(this);
                selectionService.addSelectionListener(this);
-               
+
        }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+     */
+    @Override
+    public void onChange(CdmChangeEvent event) {
+        // TODO Auto-generated method stub
+
+    }
+
 
 }
diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationException.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationException.java
new file mode 100644 (file)
index 0000000..c17e167
--- /dev/null
@@ -0,0 +1,23 @@
+// $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.
+*/
+package eu.etaxonomy.cdm.api.application;
+
+/**
+ * @author cmathew
+ * @date 18 Jun 2015
+ *
+ */
+public class CdmApplicationException extends Exception {
+
+    public CdmApplicationException(Exception ex) {
+        super(ex);
+    }
+
+}
index a1982c5c8b5d38313e0fd953ee90bffc835fe0c7..d8a0cb7b1d3bf3235341816b847add0c9a9412ec 100644 (file)
@@ -9,6 +9,13 @@
 */
 package eu.etaxonomy.cdm.api.application;
 
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+
+import eu.etaxonomy.cdm.api.service.ICommonService;
+import eu.etaxonomy.cdm.api.service.IService;
+
 /**
  * @author cmathew
  * @date 17 Jun 2015
@@ -20,6 +27,8 @@ public class CdmApplicationState {
 
     private ICdmApplicationConfiguration appConfig;
 
+    private ICdmDataChangeService dataChangeService;
+
     public static CdmApplicationState getInstance() {
         if(cdmApplicationState == null) {
             cdmApplicationState = new CdmApplicationState();
@@ -43,4 +52,79 @@ public class CdmApplicationState {
         return getInstance().getAppConfig();
     }
 
+    /**
+     * @return the dataChangeService
+     */
+    public ICdmDataChangeService getDataChangeService() {
+        return dataChangeService;
+    }
+
+    /**
+     * @param dataChangeService the dataChangeService to set
+     */
+    public void setDataChangeService(ICdmDataChangeService dataChangeService) {
+        this.dataChangeService = dataChangeService;
+    }
+
+    public static ICdmDataChangeService getCurrentDataChangeService() {
+        return getInstance().getDataChangeService();
+    }
+
+    public static void setCurrentDataChangeService(ICdmDataChangeService dataChangeService) {
+        getInstance().setDataChangeService(dataChangeService);
+    }
+
+    public static void dispose() {
+        getInstance().setCurrentDataChangeService(null);
+        getInstance().setAppConfig(null);
+    }
+
+    /**
+     * Generic method that will scan the getters of {@link ICdmApplicationConfiguration} for the given service
+     * interface. If a matching getter is found the according service implementation is returned by
+     * invoking the getter otherwise the method returns <code>null</code>.
+     *
+     * @param <T>
+     * @param serviceClass
+     * @return the configured implementation of <code>serviceClass</code> or <code>null</code>
+     * @throws CdmApplicationException
+     */
+    public static <T extends IService> T getService(Class<T> serviceClass) throws CdmApplicationException {
+        ICdmApplicationConfiguration configuration = getCurrentAppConfig();
+
+        Method[] methods = ICdmApplicationConfiguration.class.getDeclaredMethods();
+
+        T service = null;
+
+        for (Method method : methods) {
+            Type type = method.getGenericReturnType();
+
+            if (type.equals(serviceClass)) {
+                try {
+                    service = (T) method.invoke(configuration, null);
+                    break;
+                } catch (IllegalArgumentException iae) {
+                    throw new CdmApplicationException(iae);
+                } catch (IllegalAccessException iae) {
+                    throw new CdmApplicationException(iae);
+                } catch (InvocationTargetException ite) {
+                    throw new CdmApplicationException(ite);
+                }
+            }
+        }
+
+        return service;
+    }
+
+    /**
+     * @see #getService(Class)
+     * As ICommonService is not extending IService we need a specific request here
+     */
+    public static ICommonService getCommonService() {
+        ICdmApplicationConfiguration configuration = getCurrentAppConfig();
+
+        return configuration.getCommonService();
+
+    }
+
 }
diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmChangeEvent.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmChangeEvent.java
new file mode 100644 (file)
index 0000000..1df0b48
--- /dev/null
@@ -0,0 +1,78 @@
+// $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.
+*/
+package eu.etaxonomy.cdm.api.application;
+
+import java.util.Set;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+/**
+ * @author cmathew
+ * @date 7 Apr 2015
+ *
+ */
+public class CdmChangeEvent {
+
+    public enum Action {
+        Create,
+        Update,
+        Delete
+    }
+
+    private final Action action;
+    private final Set<? extends CdmBase> changedObjects;
+    private final Class sourceType;
+    private Object source;
+
+    public CdmChangeEvent(Action action, Set<? extends CdmBase> changedObjects, Class sourceType) {
+        this.action = action;
+        this.changedObjects = changedObjects;
+        this.sourceType = sourceType;
+    }
+
+    public CdmChangeEvent(Action action, Set<? extends CdmBase> changedObjects, Object source) {
+        this(action, changedObjects, source.getClass());
+        this.source = source;
+    }
+
+    /**
+     * @return the action
+     */
+    public Action getAction() {
+        return action;
+    }
+
+    /**
+     * @return the changedObjects
+     */
+    public Set<? extends CdmBase> getChangedObjects() {
+        return changedObjects;
+    }
+
+    /**
+     * @return the sourceType
+     */
+    public Class getSourceType() {
+        return sourceType;
+    }
+
+
+    /**
+     * @return the source
+     */
+    public Object getSource() {
+        return source;
+    }
+
+    public boolean hasChanges() {
+        return changedObjects != null && !changedObjects.isEmpty();
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmDataChangeService.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmDataChangeService.java
new file mode 100644 (file)
index 0000000..7a6e41f
--- /dev/null
@@ -0,0 +1,92 @@
+// $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.
+ */
+package eu.etaxonomy.cdm.api.application;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author cmathew
+ * @date 18 Jun 2015
+ *
+ */
+public class CdmDataChangeService implements ICdmDataChangeService {
+
+    protected final List<ICdmChangeListener> listeners;
+
+    private final List<CdmChangeEvent> currentEvents;
+
+    public CdmDataChangeService() {
+        listeners = new ArrayList<ICdmChangeListener>();
+        currentEvents = new ArrayList<CdmChangeEvent>();
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#register(eu.etaxonomy.cdm.api.application.ICdmChangeListener)
+     */
+    @Override
+    public void register(ICdmChangeListener listener) {
+        listeners.add(listener);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.application.ICdmDataChangeService#unregister(eu.etaxonomy.cdm.api.application.ICdmChangeListener)
+     */
+    @Override
+    public void unregister(ICdmChangeListener listener) {
+        listeners.remove(listener);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#addEvent(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+     */
+    @Override
+    public void addEvent(CdmChangeEvent event) {
+        currentEvents.add(event);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#fireCurrentChangeEvents(boolean)
+     */
+    @Override
+    public void fireCurrentChangeEvents(boolean async) {
+        try {
+            for(CdmChangeEvent event : currentEvents) {
+                fireChangeEvent(event,async);
+            }
+        } finally {
+            currentEvents.clear();
+        }
+    }
+
+
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#fireChangeEvent(eu.etaxonomy.cdm.api.application.CdmChangeEvent, boolean)
+     */
+    @Override
+    public void fireChangeEvent(final CdmChangeEvent event, boolean async) {
+
+        for(final ICdmChangeListener listener : listeners) {
+            listener.onChange(event);
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#clear()
+     */
+    @Override
+    public void clear() {
+        listeners.clear();
+        currentEvents.clear();
+    }
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/ICdmChangeListener.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/ICdmChangeListener.java
new file mode 100644 (file)
index 0000000..4ae1834
--- /dev/null
@@ -0,0 +1,21 @@
+// $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.
+*/
+package eu.etaxonomy.cdm.api.application;
+
+/**
+ * @author cmathew
+ * @date 7 Apr 2015
+ *
+ */
+public interface ICdmChangeListener {
+
+    public void onChange(CdmChangeEvent event);
+
+}
diff --git a/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/ICdmDataChangeService.java b/eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/ICdmDataChangeService.java
new file mode 100644 (file)
index 0000000..84bb324
--- /dev/null
@@ -0,0 +1,32 @@
+// $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.
+ */
+package eu.etaxonomy.cdm.api.application;
+
+
+/**
+ * @author cmathew
+ * @date 18 Jun 2015
+ *
+ */
+public interface ICdmDataChangeService {
+
+    public abstract void register(ICdmChangeListener listener);
+
+    public abstract void unregister(ICdmChangeListener listener);
+
+    public abstract void addEvent(CdmChangeEvent event);
+
+    public abstract void fireCurrentChangeEvents(boolean async);
+
+    public abstract void fireChangeEvent(CdmChangeEvent event, boolean async);
+
+    public abstract void clear();
+
+}
\ No newline at end of file
index e5a50fed30adcaa9f72b3fb8f8c37886cd09d854..659cf812a32f146407cf863533a09bb830015ce4 100644 (file)
@@ -169,21 +169,21 @@ public class CdmEntitySession implements ICdmEntitySession  {
         //             }
     }
 
-    /**
-     * Register to get updated after any interaction with the datastore
-     */
-    @Override
-    public void registerForDataStoreChanges(ICdmEntitySessionEnabled observer) {
-        CdmPostDataChangeObservableListener.getDefault().register(observer);
-    }
-
-    /**
-     * Register to get updated after any interaction with the datastore
-     */
-    @Override
-    public void unregisterForDataStoreChanges(ICdmEntitySessionEnabled observer) {
-        CdmPostDataChangeObservableListener.getDefault().unregister(observer);
-    }
+//    /**
+//     * Register to get updated after any interaction with the datastore
+//     */
+//    @Override
+//    public void registerForDataStoreChanges(ICdmEntitySessionEnabled observer) {
+//        CdmPostDataChangeObservableListener.getDefault().register(observer);
+//    }
+//
+//    /**
+//     * Register to get updated after any interaction with the datastore
+//     */
+//    @Override
+//    public void unregisterForDataStoreChanges(ICdmEntitySessionEnabled observer) {
+//        CdmPostDataChangeObservableListener.getDefault().unregister(observer);
+//    }
 
 
 
@@ -201,9 +201,9 @@ public class CdmEntitySession implements ICdmEntitySession  {
     public void dispose() {
 
         cdmTransientEntityCacher.dispose();
-        for(ICdmEntitySessionEnabled observer : changeObservers) {
-            CdmPostDataChangeObservableListener.getDefault().unregister(observer);
-        }
+//        for(ICdmEntitySessionEnabled observer : changeObservers) {
+//            CdmPostDataChangeObservableListener.getDefault().unregister(observer);
+//        }
         changeObservers.clear();
         cdmEntitySessionManager.remove(sessionOwner);
     }
index 1b8c63a6f273e8ff9313cabde9ca2b0d951740fe..4c4c999037e4f45fe24746e71811194d9a48ba5f 100644 (file)
@@ -38,9 +38,9 @@ public interface ICdmEntitySession {
 
     public void bind();
 
-    public void registerForDataStoreChanges(ICdmEntitySessionEnabled observer);
-
-    public void unregisterForDataStoreChanges(ICdmEntitySessionEnabled observer);
+//    public void registerForDataStoreChanges(ICdmEntitySessionEnabled observer);
+//
+//    public void unregisterForDataStoreChanges(ICdmEntitySessionEnabled observer);
 
     public void addEvent(ICdmBase cdmBase, Set<CdmBase> affectedObjects, EventType eventType);
 
index ba70991e03de8387da864a74a464154e9838abca..b99783ef01d5300d2a05790afa222493fcbca386 100644 (file)
@@ -2,10 +2,10 @@ package eu.etaxonomy.taxeditor.session;
 
 import java.util.List;
 
+import eu.etaxonomy.cdm.api.application.ICdmChangeListener;
 import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver;
 
-public interface ICdmEntitySessionEnabled extends ICdmPostDataChangeObserver {
+public interface ICdmEntitySessionEnabled extends ICdmChangeListener {
 
     public ICdmEntitySession getCdmEntitySession();
 
index 369a82c0e5b79f06f1bec431e05a447274cb739e..40e3f0feeae475f9e095891c4584df5f8c33bcdb 100644 (file)
@@ -79,22 +79,22 @@ public class MockCdmEntitySession implements ICdmEntitySession  {
 
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#registerForDataStoreChanges(eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled)
-     */
-    @Override
-    public void registerForDataStoreChanges(ICdmEntitySessionEnabled observer) {
-
-
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#unregisterForDataStoreChanges(eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled)
-     */
-    @Override
-    public void unregisterForDataStoreChanges(ICdmEntitySessionEnabled observer) {
-
-    }
+//    /* (non-Javadoc)
+//     * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#registerForDataStoreChanges(eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled)
+//     */
+//    @Override
+//    public void registerForDataStoreChanges(ICdmEntitySessionEnabled observer) {
+//
+//
+//    }
+//
+//    /* (non-Javadoc)
+//     * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#unregisterForDataStoreChanges(eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled)
+//     */
+//    @Override
+//    public void unregisterForDataStoreChanges(ICdmEntitySessionEnabled observer) {
+//
+//    }
 
 
 
index f55e1b3cac6d86d4307bb85a85db249948cf580b..ea3f2f1ccf7ede665c9750834a35d06d00040b14 100644 (file)
@@ -11,7 +11,6 @@ package eu.etaxonomy.taxeditor.editor;
 
 import eu.etaxonomy.cdm.api.service.IService;
 import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
@@ -29,14 +28,6 @@ public abstract class CdmEntitySessionInput implements ICdmEntitySessionEnabled
         cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
-     */
-    @Override
-    public void update(CdmDataChangeMap changeEvents) {
-       // do nothing
-
-    }
 
     /* (non-Javadoc)
      * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
index 945380745a30ef73e717d6a39793532a8d68151f..7c7530967da8af39ded7606cec5373ac93304666 100644 (file)
@@ -23,6 +23,8 @@ import org.eclipse.ui.IEditorSite;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.forms.editor.FormEditor;
 
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.model.common.CdmBase;
@@ -105,7 +107,7 @@ IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia {
         input = (TaxonEditorInput) getEditorInput();
         conversation = input.getConversationHolder();
         conversation.registerForDataStoreChanges(this);
-        cdmEntitySession.registerForDataStoreChanges(this);
+        CdmApplicationState.getCurrentDataChangeService().register(this);
         try {
             addPage(Page.NAME.getIndex(), new TaxonNameEditor(this),
                     getEditorInput());
@@ -173,7 +175,7 @@ IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia {
                 editorPage.setDisabled();
             }
         }
-        cdmEntitySession.unregisterForDataStoreChanges(this);
+        CdmApplicationState.getCurrentDataChangeService().unregister(this);
         conversation.unregisterForDataStoreChanges(this);
         conversation.close();
         setDirty(false);
@@ -580,4 +582,13 @@ IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia {
     public List<TaxonNode> getRootEntities() {
         return input.getRootEntities();
     }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+     */
+    @Override
+    public void onChange(CdmChangeEvent event) {
+        // TODO Auto-generated method stub
+
+    }
 }
index 793a0d5ad4835b241829a0d53091e7a58066cbd1..be0dce5d1c589e56e4ea1cb9383b3587d209f534 100644 (file)
@@ -20,6 +20,7 @@ import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IMemento;
 import org.eclipse.ui.IPersistableElement;
 
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.IClassificationService;
@@ -466,4 +467,14 @@ public class TaxonEditorInput extends CdmEntitySessionInput implements IEditorIn
     public <T extends CdmBase> void update() {
         taxonNode = getCdmEntitySession().remoteUpdate(service, taxonNode);
     }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+     */
+    @Override
+    public void onChange(CdmChangeEvent event) {
+        // TODO Auto-generated method stub
+
+    }
+
 }
index 68428b6f5d8ffc5e12913b05c6e83273f52d5621..3c74a962f1a72adade1bc8862f448a658570382e 100644 (file)
@@ -7,6 +7,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.UUID;
 
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
 import eu.etaxonomy.cdm.model.description.PolytomousKey;
@@ -100,4 +101,15 @@ public class PolytomousKeyEditorInput extends AbstractIdentificationEditorInput<
     public  List<PolytomousKey> getRootEntities() {
         return Arrays.asList(key);
     }
+
+
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+     */
+    @Override
+    public void onChange(CdmChangeEvent event) {
+        // TODO Auto-generated method stub
+
+    }
 }
index b9e334c458a5027177cc53c1c85ab2cc11a8a852..754832bd43339701e1c43b31bcefc3d721ef8f36 100644 (file)
@@ -42,6 +42,7 @@ import org.eclipse.ui.forms.widgets.ScrolledForm;
 import org.eclipse.ui.forms.widgets.TableWrapLayout;
 import org.eclipse.ui.part.EditorPart;
 
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
@@ -966,4 +967,13 @@ public class TaxonNameEditor extends EditorPart implements
         return null;
     }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+     */
+    @Override
+    public void onChange(CdmChangeEvent event) {
+        // TODO Auto-generated method stub
+
+    }
+
 }
index 92f55fcf138292f024e87f47b768ae2a0bbc96cf..f3685081947b1c9c553e4790fbde4f94588091ff 100644 (file)
@@ -25,6 +25,7 @@ import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchActionConstants;
 import org.eclipse.ui.IWorkbenchPart;
 
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
 import eu.etaxonomy.taxeditor.editor.key.AbstractGraphKeyEditor;
@@ -137,4 +138,13 @@ public class ConceptViewPart extends AbstractCdmEditorViewPart implements IPartC
                getViewer().refresh();
                super.changed(object);
        }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+     */
+    @Override
+    public void onChange(CdmChangeEvent event) {
+        // TODO Auto-generated method stub
+
+    }
 }
index fea7f0511c0331759fc0dcd6b06ebccbd0849b0e..4621fbb6ab89c0c4c26ae94b3e1a0c6f62862f26 100644 (file)
@@ -17,6 +17,7 @@ import org.eclipse.zest.layouts.LayoutAlgorithm;
 import org.eclipse.zest.layouts.LayoutStyles;
 import org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm;
 
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
@@ -123,4 +124,13 @@ public class ConceptGraphView extends AbstractCdmEditorViewPart {
                return layoutAlgoritm;
        }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+     */
+    @Override
+    public void onChange(CdmChangeEvent event) {
+        // TODO Auto-generated method stub
+
+    }
+
 }
index 7556a73d2612f9b93ca11525614197de02a0c09a..a4b95431052963bf9c752e04e8afc44f56d72cfc 100644 (file)
@@ -45,6 +45,7 @@ import org.eclipse.ui.IWorkbenchActionConstants;
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.PartInitException;
 
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.description.DescriptionBase;
 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
@@ -361,4 +362,13 @@ public class DescriptiveViewPart extends AbstractCdmEditorViewPart implements IP
            provider.toggleShowOnlyIndividualAssociations();
            viewer.refresh();
        }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+     */
+    @Override
+    public void onChange(CdmChangeEvent event) {
+        // TODO Auto-generated method stub
+
+    }
 }
index 07cbd473dc5f8a3dd3f4f78d1e2b1bd17d2e64ce..01d9e01c3a4d621e010d3705dc6e90f98b1f1a3b 100644 (file)
@@ -28,6 +28,7 @@ import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchActionConstants;
 import org.eclipse.ui.IWorkbenchPart;
 
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
@@ -167,4 +168,13 @@ public class MediaViewPart extends AbstractCdmEditorViewPart implements IPartCon
     public boolean onComplete() {
                return true;
        }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+     */
+    @Override
+    public void onChange(CdmChangeEvent event) {
+        // TODO Auto-generated method stub
+
+    }
 }
index 6556f6c4229e09353fe4aa3618a6cc04a3c953f8..4feeb3f78947d9d95190a0b045c336954a6862b2 100644 (file)
             name="%command.name.4">
       </command>
       <command
-            defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.ChangeAcceptedTaxonToSynonymHandler"
             id="eu.etaxonomy.taxeditor.navigator.command.update.changeAcceptedToSynonym"
             name="%command.name.5">
       </command>
index 296164c365fdd2ac7a945457ee8a0b874cf31a61..18aab9c865b744050707dd548d6241ae30d50f9d 100644 (file)
@@ -33,6 +33,8 @@ import org.eclipse.ui.commands.ICommandService;
 import org.eclipse.ui.handlers.IHandlerService;
 import org.eclipse.ui.part.ViewPart;
 
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
@@ -199,7 +201,7 @@ public class PolytomousKeyViewPart extends ViewPart implements
                conversation = CdmStore.createConversation();
                conversation.registerForDataStoreChanges(this);
                cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
-        cdmEntitySession.registerForDataStoreChanges(this);
+        CdmApplicationState.getCurrentDataChangeService().register(this);
                List<PolytomousKey> input = CdmStore.getService(IPolytomousKeyService.class).list(PolytomousKey.class, null, null, null, null);
                if(!viewer.getControl().isDisposed()){
                    viewer.setInput(input);
@@ -303,4 +305,13 @@ public class PolytomousKeyViewPart extends ViewPart implements
         return getKeys();
     }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+     */
+    @Override
+    public void onChange(CdmChangeEvent event) {
+        // TODO Auto-generated method stub
+
+    }
+
 }
index 092b49bc8823ed85140deebeef6cacd4c7d55085..663a163cac4f1978ce88e44b19798ccbca574a1b 100644 (file)
@@ -28,6 +28,8 @@ import org.eclipse.ui.IViewSite;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.navigator.CommonNavigator;
 
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.IClassificationService;
@@ -143,7 +145,7 @@ public class TaxonNavigator extends CommonNavigator implements
                }
                if (CdmStore.isActive() && cdmEntitySession == null) {
                    cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
-                   cdmEntitySession.registerForDataStoreChanges(TaxonNavigator.this);
+                   CdmApplicationState.getCurrentDataChangeService().register(this);
                }
                CdmStore.getLoginManager().addObserver(this);
        }
@@ -511,4 +513,13 @@ public class TaxonNavigator extends CommonNavigator implements
         }
         return null;
     }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+     */
+    @Override
+    public void onChange(CdmChangeEvent event) {
+        // TODO Auto-generated method stub
+
+    }
 }
index d833fe31dcfc597fff5303f8c1844e4a8ff7e6e1..9e43acdeb7d4693dc2ff4ea8cc7966422fd2e94b 100644 (file)
@@ -4,14 +4,12 @@
 package eu.etaxonomy.taxeditor.navigation.navigator.handler;
 
 import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
 import java.util.UUID;
 
 import org.apache.log4j.Logger;
 import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.operations.AbstractOperation;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.viewers.TreeSelection;
@@ -20,6 +18,7 @@ import org.eclipse.ui.handlers.HandlerUtil;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock;
 import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingChangeAcceptedTaxonToSynonymOperation;
 import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
 import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
 
@@ -36,14 +35,17 @@ public class RemotingChangeAcceptedTaxonToSynonymHandler extends RemotingCdmHand
             .getLogger(RemotingChangeAcceptedTaxonToSynonymHandler.class);
 
     private static final String CHANGE_ACCEPTED_TAXON_TO_SYNONYM_LABEL = "Change Accepted Taxon to Synonym";
+    private static final String NO_TAXON_SELECTION_MESSAGE = "No taxon tree node selected for operation.";
     private static final String SINGLE_TAXON_SELECTION_MESSAGE = "The operation move accepted taxon to synonymy is available only for a single taxon.";
     private static final String SOURCE_TAXON_HAS_CHILDREN_MESSAGE = "The accepted taxon must not have any childen. You need to move all childen to " +
             "another taxon node in the TaxonNavigator before attempting to turn the accepted " +
             "taxon into a synonym.";
-    private static final String RELATED_EDITORS_NOT_CLOSED_MESSAGE = "Could not close related taxon anme editors. " +
-            "Please close them manually.";
+    private static final String RELATED_EDITOR_NOT_CLOSED_MESSAGE = "Could not close related taxon name editor " +
+            "Please close it manually and try again.";
+    private static final String SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE = "Selected object is not a taxon tree node";
+
+    private ITaxonTreeNode oldTaxonNode;
 
-    private ITaxonTreeNode oldAcceptedTaxonNode;
        /**
      * @param label
      */
@@ -56,37 +58,43 @@ public class RemotingChangeAcceptedTaxonToSynonymHandler extends RemotingCdmHand
     @Override
     public IStatus allowOperations(ExecutionEvent event) {
         TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
-        // check that only a single taxon has been selected
+        // check that only a single taxon tree node has been selected
         if(selection.size() > 1) {
             return new Status(IStatus.ERROR,
                     "unknown",
                     SINGLE_TAXON_SELECTION_MESSAGE);
         }
 
-        Iterator selectionIterator = selection.iterator();
-        Set<ITaxonTreeNode> treeNodes = new HashSet<ITaxonTreeNode>();
-        ITaxonTreeNode treeNode = treeNodes.iterator().next();
-        oldAcceptedTaxonNode = treeNode;
+        // check for no taxon tree node selected
+        if(selection.size() == 0) {
+            return new Status(IStatus.ERROR,
+                    "unknown",
+                    NO_TAXON_SELECTION_MESSAGE);
+        }
 
+        // check that selected object is a taxon node
+        Object obj = selection.iterator().next();
+        if(obj instanceof ITaxonTreeNode) {
+            oldTaxonNode = (ITaxonTreeNode)obj;
+        } else {
+            return new Status(IStatus.ERROR,
+                    "unknown",
+                    SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE);
+        }
         // check that the source taxon node does not have children
-        if(((TaxonNode)oldAcceptedTaxonNode).getCountChildren() > 0) {
+        if(((TaxonNode)oldTaxonNode).getCountChildren() > 0) {
             return new Status(IStatus.ERROR,
                     "unknown",
                     SOURCE_TAXON_HAS_CHILDREN_MESSAGE);
 
         }
 
-        // check all editors related to this taxon node are closed
-        boolean allEditorsClosed = true;
-        for (ITaxonTreeNode tn : treeNodes){
-            if(treeNode instanceof TaxonNode) {
-                allEditorsClosed &= NavigatorHandlerUtils.closeObsoleteEditor(event, (TaxonNode) tn);
-            }
-        }
-        if(allEditorsClosed != true) {
+        // check if corresponding name editor is closed
+        boolean editorClosed = NavigatorHandlerUtils.closeObsoleteEditor(event, (TaxonNode) oldTaxonNode);
+        if(editorClosed != true) {
             return new Status(IStatus.ERROR,
                     "unknown",
-                    RELATED_EDITORS_NOT_CLOSED_MESSAGE);
+                    RELATED_EDITOR_NOT_CLOSED_MESSAGE);
         }
 
         return Status.OK_STATUS;
@@ -95,31 +103,39 @@ public class RemotingChangeAcceptedTaxonToSynonymHandler extends RemotingCdmHand
      * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#doOperations(org.eclipse.core.commands.ExecutionEvent)
      */
     @Override
-    public IStatus doOperations(ExecutionEvent event) {
+    public AbstractOperation prepareOperation(ExecutionEvent event) {
         List<UUID> excludeTaxa = new ArrayList<UUID>();
-        excludeTaxa.add(oldAcceptedTaxonNode.getUuid());
+        excludeTaxa.add(oldTaxonNode.getUuid());
         TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
                 new ConversationHolderMock(),
                 "Choose the accepted taxon",
                 excludeTaxa,
                 null,
-                ((TaxonNode)oldAcceptedTaxonNode).getClassification());
+                ((TaxonNode)oldTaxonNode).getClassification());
 
         if (newAcceptedTaxonNode == null) {
             return null;
         }
 
-        // run operation
-        return Status.OK_STATUS;
+        RemotingChangeAcceptedTaxonToSynonymOperation rcattso =
+                new RemotingChangeAcceptedTaxonToSynonymOperation(event.getTrigger(),
+                        false,
+                        oldTaxonNode,
+                        newAcceptedTaxonNode);
+
+        return rcattso;
     }
+
     /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#postOperations(org.eclipse.core.commands.ExecutionEvent)
+     * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete(org.eclipse.core.commands.ExecutionEvent)
      */
     @Override
-    public void postOperations(ExecutionEvent event) {
+    public void onComplete() {
         // TODO Auto-generated method stub
 
     }
 
 
+
+
 }
index 3e31781bfc31c2209cce3f8fdea5bf589ab0e519..4eb9b3805a63196d3a5cdb39bf4b68a1974bb8a4 100644 (file)
@@ -12,12 +12,13 @@ package eu.etaxonomy.taxeditor.navigation.navigator.operation;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
 import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
 import eu.etaxonomy.cdm.api.service.UpdateResult;
 import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
-import eu.etaxonomy.taxeditor.store.CdmStore;
 
 
 /**
@@ -30,13 +31,16 @@ public class RemotingChangeAcceptedTaxonToSynonymOperation extends RemotingCdmUp
     private final TaxonNode newAcceptedTaxonNode;
     private final ITaxonTreeNode oldTaxonNode;
 
+    private final static String LABEL = "ChangeAcceptedTaxonToSynonymOperation";
+
     /**
      * @param label
      */
-    public RemotingChangeAcceptedTaxonToSynonymOperation(String label,
+    public RemotingChangeAcceptedTaxonToSynonymOperation(Object source,
+            boolean async,
             ITaxonTreeNode oldTaxonNode,
             TaxonNode newAcceptedTaxonNode) {
-        super(label);
+        super(LABEL, Action.Update, source, async);
         this.oldTaxonNode = oldTaxonNode;
         this.newAcceptedTaxonNode = newAcceptedTaxonNode;
     }
@@ -45,8 +49,8 @@ public class RemotingChangeAcceptedTaxonToSynonymOperation extends RemotingCdmUp
      * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
      */
     @Override
-    public UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) {
-        return CdmStore.getService(ITaxonNodeService.class).makeTaxonNodeASynonymOfAnotherTaxonNode(oldTaxonNode.getUuid(), newAcceptedTaxonNode.getUuid(), null, null, null);
+    protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
+        return CdmApplicationState.getService(ITaxonNodeService.class).makeTaxonNodeASynonymOfAnotherTaxonNode(oldTaxonNode.getUuid(), newAcceptedTaxonNode.getUuid(), null, null, null);
     }
 
 }
index 72d73f88278ae621195ab7a1cf121dbb3fde396f..24328358025b1d8fa1aee918bc20c17c7a7318e2 100644 (file)
@@ -21,6 +21,7 @@ import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.commands.NotEnabledException;
 import org.eclipse.core.commands.NotHandledException;
 import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.core.commands.operations.AbstractOperation;
 import org.eclipse.core.commands.operations.IOperationHistory;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -58,6 +59,7 @@ import org.eclipse.ui.themes.IThemeManager;
 import eu.etaxonomy.cdm.model.common.IEnumTerm;
 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
 import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
 import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
 import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
@@ -345,6 +347,49 @@ public abstract class AbstractUtility {
                return Status.OK_STATUS;
        }
 
+          public static IStatus executeOperation(final AbstractOperation operation, final RemotingCdmHandler handler) {
+               if (getOperationHistory() == null) {
+                   throw new IllegalArgumentException(
+                           "There is no operation history for this context");
+               }
+
+               final IAdaptable uiInfoAdapter = WorkspaceUndoUtil
+                       .getUIInfoAdapter(getShell());
+
+               IRunnableWithProgress runnable = new IRunnableWithProgress() {
+
+                   @Override
+                   public void run(IProgressMonitor monitor)
+                           throws InvocationTargetException, InterruptedException {
+                       String operationlabel = operation.getLabel();
+                       monitor.beginTask(operationlabel, 100);
+                       IStatus status = Status.CANCEL_STATUS;
+                       try {
+                           operation.addContext(IOperationHistory.GLOBAL_UNDO_CONTEXT);
+                           status = getOperationHistory().execute(operation, monitor,
+                                   uiInfoAdapter);
+                           handler.postOperation(status);
+                       } catch (ExecutionException e) {
+                           MessagingUtils.operationDialog(this, e, TaxeditorStorePlugin.PLUGIN_ID, operationlabel, null);
+                       } finally {
+                           monitor.done();
+                       }
+
+                       String statusString = status.equals(Status.OK_STATUS) ? "completed"
+                               : "cancelled";
+                       setStatusLine(operationlabel + " " + statusString + ".");
+
+                   }
+               };
+
+               try {
+                   runInUI(runnable, null);
+               } catch (Exception e) {
+                   MessagingUtils.messageDialog("Error executing operation", AbstractUtility.class, "An error occured while executing " + operation.getLabel(), e);
+               }
+
+               return Status.OK_STATUS;
+           }
        /**
         * <p>
         * getOperationHistory
index 4a10e65ff5cf220d8032d7678acaac182763189a..ac906cf9b789b3097bfdd87d0f65769633e7256f 100644 (file)
@@ -12,9 +12,11 @@ package eu.etaxonomy.taxeditor.operation;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.AbstractOperation;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.jface.dialogs.ErrorDialog;
 
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 
 /**
@@ -37,25 +39,27 @@ public abstract class RemotingCdmHandler extends AbstractHandler {
     public Object execute(ExecutionEvent event) throws ExecutionException {
         IStatus allowStatus = allowOperations(event);
         if(allowStatus.isOK()) {
-            IStatus opStatus = doOperations(event);
-            onComplete(event, opStatus);
+            AbstractOperation op = prepareOperation(event);
+            if(op != null) {
+                AbstractUtility.executeOperation(op, this);
+            }
         } else {
             MessagingUtils.warningDialog("Can not perform " + label, event.getTrigger(), allowStatus);
         }
         return null;
     }
 
-    public void onComplete(ExecutionEvent event, IStatus status) {
+    public void postOperation(IStatus status) {
         if(!status.isOK() && status.getException() != null) {
             ErrorDialog.openError(null, "Error executing " + label, null, status);
         }
-        postOperations(event);
+        onComplete();
     }
 
     public abstract IStatus allowOperations(ExecutionEvent event);
 
-    public abstract IStatus doOperations(ExecutionEvent event);
+    public abstract AbstractOperation prepareOperation(ExecutionEvent event);
 
-    public abstract void postOperations(ExecutionEvent event);
+    public abstract void onComplete();
 
 }
index d11f34a3a794b3f924191d2347143ff7e6cdf462..b47560fa4f5d4349abc00054c7c88adabebd71be 100644 (file)
@@ -9,12 +9,20 @@
 */
 package eu.etaxonomy.taxeditor.operation;
 
+import java.util.Set;
+
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.commands.operations.AbstractOperation;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
 /**
  * @author cmathew
  * @date 16 Jun 2015
@@ -22,8 +30,15 @@ import org.eclipse.core.runtime.IStatus;
  */
 public abstract class RemotingCdmOperation extends AbstractOperation {
 
-    public RemotingCdmOperation(String label) {
+    private final Object source;
+    private final Action action;
+    private final boolean async;
+
+    public RemotingCdmOperation(String label, Action action, Object source, boolean async) {
         super(label);
+        this.source = source;
+        this.action = action;
+        this.async = async;
     }
 
     /* (non-Javadoc)
@@ -37,11 +52,24 @@ public abstract class RemotingCdmOperation extends AbstractOperation {
        return onComplete(success);
     }
 
-    public abstract boolean doExecute(IProgressMonitor monitor, IAdaptable info);
+    protected abstract boolean doExecute(IProgressMonitor monitor, IAdaptable info);
+
+    protected void postExecute(boolean success) {}
 
-    public void postExecute(boolean success) {}
+    protected abstract IStatus onComplete(boolean success);
 
-    public abstract IStatus onComplete(boolean success);
+    protected void fireDataChangeEvent(Set<? extends CdmBase> changedObjects) {
+        if(changedObjects != null && !changedObjects.isEmpty()) {
+            CdmApplicationState.getCurrentDataChangeService().fireChangeEvent(new CdmChangeEvent(action, changedObjects, source.getClass()), async);
+        }
+    }
+
+    protected void fireDataChangeEvent(UpdateResult updateResult) {
+        Set<CdmBase> updatedObjects = updateResult.getUpdatedObjects();
+        if(updatedObjects != null && !updatedObjects.isEmpty()) {
+            CdmApplicationState.getCurrentDataChangeService().fireChangeEvent(new CdmChangeEvent(action, updatedObjects, source.getClass()), async);
+        }
+    }
 
     /* (non-Javadoc)
      * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
index 4e326da34dd778f2e3750c123fba4c014671cda0..fb177fa00cc22cff20a029f74eaa4e2a547a9bb4 100644 (file)
@@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.MultiStatus;
 import org.eclipse.core.runtime.Status;
 
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
 import eu.etaxonomy.cdm.api.service.UpdateResult;
 
 /**
@@ -31,26 +32,41 @@ public abstract class RemotingCdmUpdateOperation extends RemotingCdmOperation {
     /**
      * @param label
      */
-    public RemotingCdmUpdateOperation(String label) {
-        super(label);
+    public RemotingCdmUpdateOperation(String label, Action action, Object source, boolean async) {
+        super(label, action, source, async);
     }
 
     /* (non-Javadoc)
      * @see eu.etaxonomy.taxeditor.operation.RemotingCdmOperation#doExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
      */
     @Override
-    public boolean doExecute(IProgressMonitor monitor, IAdaptable info) {
-        updateResult = doUpdateExecute(monitor, info);
+    protected boolean doExecute(IProgressMonitor monitor, IAdaptable info) {
+        try {
+            updateResult = doUpdateExecute(monitor, info);
+        } catch (Exception e) {
+            UpdateResult exceptionResult = new UpdateResult();
+            exceptionResult.addException(e);
+            exceptionResult.setError();
+            updateResult = exceptionResult;
+        }
         return updateResult.isOk();
     }
 
-    public abstract UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info);
+    protected abstract UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception;
+
+    @Override
+    protected void postExecute(boolean success) {
+        if(success && updateResult != null) {
+            fireDataChangeEvent(updateResult);
+        }
+
+    }
 
     /* (non-Javadoc)
      * @see eu.etaxonomy.taxeditor.operation.RemotingCdmOperation#onComplete(boolean)
      */
     @Override
-    public IStatus onComplete(boolean success) {
+    protected IStatus onComplete(boolean success) {
 
         if(updateResult != null) {
             Collection<Exception> exceptions = updateResult.getExceptions();
@@ -59,13 +75,15 @@ public abstract class RemotingCdmUpdateOperation extends RemotingCdmOperation {
             }
 
             Status[] childStatus = new Status[exceptions.size()];
-
+            int count = 0;
             for(Exception ex : exceptions) {
                 Status status = new Status(IStatus.ERROR,
                         "unknown",
                         IStatus.ERROR,
                         ex.getLocalizedMessage(),
                         ex);
+                childStatus[count] = status;
+                count++;
             }
 
             MultiStatus multiStatus = new MultiStatus("unknown",
index ce2a73408f7cf0160642989a64b2c561800aff21..213720753c6421830f0744190d7721731cc8934a 100644 (file)
@@ -9,9 +9,6 @@
 
 package eu.etaxonomy.taxeditor.store;
 
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
 import java.util.EnumSet;
 
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -25,6 +22,7 @@ import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContext;
 import org.springframework.security.core.context.SecurityContextHolder;
 
+import eu.etaxonomy.cdm.api.application.CdmApplicationException;
 import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
 import eu.etaxonomy.cdm.api.application.CdmApplicationState;
 import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
@@ -201,6 +199,7 @@ public class CdmStore {
        private void close() {
                isConnected = false;
                cdmSource = null;
+               CdmApplicationState.dispose();
        }
 
        static void setInstance(ICdmApplicationConfiguration applicationController,
@@ -211,6 +210,7 @@ public class CdmStore {
        private CdmStore(ICdmApplicationConfiguration applicationController,
                        ICdmSource cdmSource) {
                CdmApplicationState.setCurrentAppConfig(applicationController);
+               CdmApplicationState.setCurrentDataChangeService(new CdmUIDataChangeService());
                this.cdmSource = cdmSource;
                isConnected = true;
        }
@@ -301,30 +301,14 @@ public class CdmStore {
         * @return the configured implementation of <code>serviceClass</code> or <code>null</code>
         */
        public static <T extends IService> T getService(Class<T> serviceClass) {
-               ICdmApplicationConfiguration configuration = getCurrentApplicationConfiguration();
-
-               Method[] methods = ICdmApplicationConfiguration.class.getDeclaredMethods();
-
-               T service = null;
-
-               for (Method method : methods) {
-                       Type type = method.getGenericReturnType();
-
-                       if (type.equals(serviceClass)) {
-                               try {
-                                       service = (T) method.invoke(configuration, null);
-                                       break;
-                               } catch (IllegalArgumentException e) {
-                                       MessagingUtils.error(CdmStore.class, e);
-                               } catch (IllegalAccessException e) {
-                                       MessagingUtils.error(CdmStore.class, e);
-                               } catch (InvocationTargetException e) {
-                                       MessagingUtils.error(CdmStore.class, e);
-                               }
-                       }
-               }
+           T service = null;
+           try {
+               service = CdmApplicationState.getService(serviceClass);
+           } catch (CdmApplicationException cae) {
+               MessagingUtils.error(CdmStore.class, cae);
+           }
 
-               return service;
+           return service;
        }
 
        /**
@@ -332,9 +316,7 @@ public class CdmStore {
         * As ICommonService is not extending IService we need a specific request here
         */
        public static ICommonService getCommonService() {
-               ICdmApplicationConfiguration configuration = getCurrentApplicationConfiguration();
-
-               return configuration.getCommonService();
+               return CdmApplicationState.getCommonService();
 
        }
 
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmUIDataChangeService.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmUIDataChangeService.java
new file mode 100644 (file)
index 0000000..0a9d445
--- /dev/null
@@ -0,0 +1,50 @@
+// $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.
+*/
+package eu.etaxonomy.taxeditor.store;
+
+import org.eclipse.swt.widgets.Display;
+
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
+import eu.etaxonomy.cdm.api.application.CdmDataChangeService;
+import eu.etaxonomy.cdm.api.application.ICdmChangeListener;
+
+/**
+ * @author cmathew
+ * @date 18 Jun 2015
+ *
+ */
+public class CdmUIDataChangeService extends CdmDataChangeService {
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#fireChangeEvent(eu.etaxonomy.cdm.api.application.CdmChangeEvent, boolean)
+     */
+    @Override
+    public void fireChangeEvent(final CdmChangeEvent event, boolean async) {
+        for(final ICdmChangeListener listener : listeners) {
+            // Update the user interface asynchronously
+            if(async) {
+                Display.getDefault().asyncExec(new Runnable() {
+                    @Override
+                    public void run() {
+                        listener.onChange(event);
+                    }
+                });
+            }
+            // Update the user interface synchronously
+            Display.getDefault().syncExec(new Runnable() {
+                @Override
+                public void run() {
+                    listener.onChange(event);
+                }
+            });
+        }
+    }
+
+}
index d3f20092474906c4d04a7895f2f9b15320d32b9c..5e508b66925a45b918ca3ea74ea631dfeb9b6812 100644 (file)
@@ -18,6 +18,7 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchPart;
 
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.description.Feature;
@@ -149,4 +150,13 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC
     public boolean onComplete() {
                return true;
        }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+     */
+    @Override
+    public void onChange(CdmChangeEvent event) {
+        // TODO Auto-generated method stub
+
+    }
 }
index e11d053243353024fb75d2553ecdf44d767c6193..c264db3d1d67c4187262faafa60298001f3435d1 100644 (file)
@@ -19,6 +19,7 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.part.EditorPart;
 
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
 import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
 import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
@@ -125,4 +126,14 @@ public class SupplementalDataViewPart extends AbstractCdmEditorViewPart {
        }
 
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+     */
+    @Override
+    public void onChange(CdmChangeEvent event) {
+        // TODO Auto-generated method stub
+
+    }
+
+
 }
index 90bfaf128d3209daf48e614ab56bf91ede585b49..82c36e0e203f9157a0741acc63844f2eaa57b11a 100644 (file)
@@ -14,7 +14,6 @@ import java.util.UUID;
 import org.apache.log4j.Logger;
 import org.eclipse.core.commands.ExecutionException;
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.unitils.dbunit.annotation.DataSet;
 
@@ -22,8 +21,9 @@ import eu.etaxonomy.cdm.api.service.IClassificationService;
 import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
 import eu.etaxonomy.cdm.api.service.ITaxonService;
 import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.navigation.navigator.operation.ChangeAcceptedTaxonToSynonymOperation;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingChangeAcceptedTaxonToSynonymOperation;
 import eu.etaxonomy.taxeditor.operations.BaseOperationTest;
 
 /**
@@ -43,26 +43,32 @@ public class TaxonNavigatorTest extends BaseOperationTest {
     Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
 
 
-    @Ignore
+
     @Test
     public void changeAcceptedTaxonToSynonymTest() throws ExecutionException {
-        UUID oldTaxonNodeNodeUuid = UUID.fromString("168a4d09-a2b0-4206-b4cc-5d13199f9306");
-        UUID newAcceptedTaxonNodeUuid = UUID.fromString("f5d97f8b-c673-4050-af06-bbfab33baaec");
+
+
+        UUID oldTaxonNodeNodeUuid = UUID.fromString("b85b5b78-6760-409f-ac91-bb89e95ff2a1");
+        UUID newAcceptedTaxonNodeUuid = UUID.fromString("6ad8e9e2-f5f6-41ad-aa30-f62a903650db");
 
         TaxonNode oldTaxonNode = taxonNodeService.load(oldTaxonNodeNodeUuid);
+        TaxonNameBase name = oldTaxonNode.getTaxon().getName();
         TaxonNode newAcceptedTaxonNode = taxonNodeService.load(newAcceptedTaxonNodeUuid);
+        sessionOwner.addUpdatedObject(oldTaxonNode.getParent());
 
         Assert.assertEquals(0,newAcceptedTaxonNode.getTaxon().getSynonyms().size());
-        operation =  new ChangeAcceptedTaxonToSynonymOperation("changeAcceptedTaxonToSynonymTest",
-                undoContext,
+        operation =  new RemotingChangeAcceptedTaxonToSynonymOperation(sessionOwner,
+                false,
                 oldTaxonNode,
-                newAcceptedTaxonNode,
-                postOperation,
-                conversationEnabled,
-                sessionOwner);
+                newAcceptedTaxonNode);
         operation.execute(monitor, info);
         newAcceptedTaxonNode = taxonNodeService.load(newAcceptedTaxonNodeUuid);
+        sessionOwner.addUpdatedObject(newAcceptedTaxonNode);
+
+        oldTaxonNode = taxonNodeService.load(oldTaxonNodeNodeUuid);
+        Assert.assertNull(oldTaxonNode);
         Assert.assertEquals(1,newAcceptedTaxonNode.getTaxon().getSynonyms().size());
+        Assert.assertEquals(name, newAcceptedTaxonNode.getTaxon().getSynonyms().iterator().next().getName());
 
 
     }
index f67b05bf8f2b047b2a34094e82f4e48da1c1e6e8..18263dd6870bbe4a5d6c1afd66624398e3f54238 100644 (file)
@@ -38,6 +38,7 @@ import org.unitils.spring.annotation.SpringApplicationContext;
 
 import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
 import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmDataChangeService;
 import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
 import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager;
 import eu.etaxonomy.taxeditor.remoting.cache.CdmTransientEntityCacher;
@@ -188,6 +189,8 @@ public abstract class BaseRemotingTest extends UnitilsJUnit4 {
         }
         cdmEntitySessionManager = getRemoteApplicationController().getCdmEntitySessionManager();
 
+        CdmApplicationState.setCurrentDataChangeService(new CdmDataChangeService());
+
         //FIXME:Remoting the authentication code should be replaced by a method call which actually
         // does the authentication in the editor code so that the 'real' authentication can be tested
         SecurityContextHolder.clearContext();
index e99f4ffdd70a4b4f4d7b977889edf73380d30cf7..2f43e1cf752b01d6470d22fe68b3d22209d51324 100644 (file)
@@ -11,9 +11,9 @@ package eu.etaxonomy.taxeditor.httpinvoker;
 
 import org.junit.Before;
 
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
 import eu.etaxonomy.taxeditor.remoting.cache.CdmTransientEntityCacher;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
 import eu.etaxonomy.taxeditor.session.MockSessionOwner;
 
 /**
@@ -24,12 +24,13 @@ import eu.etaxonomy.taxeditor.session.MockSessionOwner;
 public abstract class RemotingSessionAwareTest extends BaseRemotingTest {
 
     protected CdmTransientEntityCacher cacher;
-    protected ICdmEntitySessionEnabled sessionOwner;
+    protected MockSessionOwner sessionOwner;
     protected ICdmEntitySession cdmEntitySession;
 
     @Before
     public void initializeSession() {
         sessionOwner = new MockSessionOwner();
+        CdmApplicationState.getCurrentDataChangeService().register(sessionOwner);
         cdmEntitySession = cdmEntitySessionManager.newSession(sessionOwner, true);
         cacher = getCacher(sessionOwner);
     }
index fdd429c1867072f47652e8050852ff6dd3d03983..3bbc407d285eb1b4619182114bdfe3556e810f3c 100644 (file)
@@ -10,6 +10,7 @@
 
 package eu.etaxonomy.taxeditor.operations;
 
+import org.eclipse.core.commands.operations.AbstractOperation;
 import org.eclipse.core.commands.operations.IUndoContext;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -17,7 +18,6 @@ import org.eclipse.core.runtime.NullProgressMonitor;
 
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.taxeditor.httpinvoker.RemotingSessionAwareTest;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
 import eu.etaxonomy.taxeditor.test.MockConversationEnabled;
@@ -37,7 +37,7 @@ public abstract class BaseOperationTest extends RemotingSessionAwareTest {
        public static final IConversationEnabled conversationEnabled = new MockConversationEnabled();
        public static final ICdmEntitySessionEnabled cdmEntitySessionEnabled = null;
 
-       protected static AbstractPostOperation operation;
+       protected static AbstractOperation operation;
 
 
 
index 983329fa169f07517a77768a49a859be50aa31f5..db1a0361bf30e66b3ad1eedffb11446ca7e05c37 100644 (file)
@@ -1,29 +1,42 @@
 package eu.etaxonomy.taxeditor.session;
 
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
+import org.junit.Assert;
+
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
 import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.session.mock.MockCdmEntitySession;
 
 public class MockSessionOwner<T extends CdmBase> implements ICdmEntitySessionEnabled {
 
     List<T> rootEntities;
-
+    Set<T> updatedObjects;
 
     public MockSessionOwner() {
-        rootEntities = null;
+        this.rootEntities = null;
+    }
+
+    public MockSessionOwner(Set<T> updatedObjects) {
+        this.rootEntities = null;
+        this.updatedObjects = updatedObjects;
     }
 
     public MockSessionOwner(List<T> rootEntities) {
         this.rootEntities = rootEntities;
     }
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
-     */
-    @Override
-    public void update(CdmDataChangeMap arg0) {
 
+    public void setUpdatedObjects(Set<T> updatedObjects) {
+        this.updatedObjects = updatedObjects;
+    }
+
+    public void addUpdatedObject(T updatedObject) {
+        if(updatedObjects == null) {
+            updatedObjects = new HashSet<T>();
+        }
+        updatedObjects.add(updatedObject);
     }
 
     /* (non-Javadoc)
@@ -42,4 +55,16 @@ public class MockSessionOwner<T extends CdmBase> implements ICdmEntitySessionEna
         return rootEntities;
     }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+     */
+    @Override
+    public void onChange(CdmChangeEvent event) {
+        if(updatedObjects != null && !updatedObjects.isEmpty()) {
+            for(CdmBase cb : updatedObjects) {
+                Assert.assertTrue(event.getChangedObjects().contains(cb));
+            }
+        }
+    }
+
 }
index 693f9e0b9397a02339c53c961d6f1a9a6b441169..df2a916cd730dba1ff1f305070bd2dd01e8754f8 100644 (file)
@@ -1,44 +1,66 @@
 <?xml version="1.0" encoding="UTF-8"?><!--
-  generated by Jailer 4.3, Mon Jun 15 17:20:26 CEST 2015 from cmathew@cmbgbm-t530
+  generated by Jailer 4.3, Fri Jun 19 09:13:03 CEST 2015 from cmathew@cmbgbm-t530
   
-  Extraction Model:  all rows from Classification (extractionmodel/by-example/SbE-Classification-17-20-15-292.csv)
+  Extraction Model:  all rows from Classification (extractionmodel/by-example/SbE-Classification-09-10-20-259.csv)
   Database URL:      jdbc:mysql://127.0.0.1:3306/local-cyprus
   Database User:     root
   
-  Exported Rows:     47
+  Exported Rows:     67
       Classification                 1
       DescriptionBase                22
-      TaxonBase                      7
+      TaxonBase                      14
+      TaxonNameBase                  14
       TaxonNode                      16
-      UserAccount                    1
   
 --><dataset>
-  <TaxonNode id="46" created="2010-12-21 15:09:43.0" uuid="168a4d09-a2b0-4206-b4cc-5d13199f9306" countchildren="0" sortindex="0" treeindex="#t10#4032#49#48#47#46#"   classification_id="10" parent_id="47" taxon_id="48"/>
-  <TaxonNode id="47" created="2010-12-21 15:09:43.0" uuid="2f05d429-632d-4230-b9cb-70299360b470" countchildren="1" sortindex="0" treeindex="#t10#4032#49#48#47#"   classification_id="10" parent_id="48" taxon_id="51"/>
-  <TaxonNode id="48" created="2010-12-21 15:09:43.0" uuid="24773d3b-8f11-4400-99de-71658982b245" countchildren="6" sortindex="0" treeindex="#t10#4032#49#48#"   classification_id="10" parent_id="49" taxon_id="50"/>
-  <TaxonNode id="49" created="2010-12-21 15:09:43.0" uuid="572290a9-7535-48c8-9f68-25ddbc9869ee" countchildren="10" sortindex="1" treeindex="#t10#4032#49#"   classification_id="10" parent_id="4032" taxon_id="49"/>
-  <TaxonNode id="236" created="2010-12-21 15:09:45.0" uuid="f5d97f8b-c673-4050-af06-bbfab33baaec" countchildren="0" sortindex="0" treeindex="#t10#4032#49#48#237#236#"   classification_id="10" parent_id="237" taxon_id="264"/>
-  <TaxonNode id="237" created="2010-12-21 15:09:45.0" uuid="4998de90-d0be-433b-a62f-0d57a1e399b0" countchildren="1" sortindex="1" treeindex="#t10#4032#49#48#237#"   classification_id="10" parent_id="48" taxon_id="265"/>
-  <TaxonNode id="714" created="2010-12-21 15:09:48.0" uuid="b85b5b78-6760-409f-ac91-bb89e95ff2a1" countchildren="0" sortindex="0" treeindex="#t10#4032#49#48#715#714#"   classification_id="10" parent_id="715" taxon_id="812"/>
-  <TaxonNode id="715" created="2010-12-21 15:09:48.0" uuid="91698cec-615f-4472-9002-feda1a6acded" countchildren="2" sortindex="2" treeindex="#t10#4032#49#48#715#"   classification_id="10" parent_id="48" taxon_id="814"/>
-  <TaxonNode id="716" created="2010-12-21 15:09:48.0" uuid="6ad8e9e2-f5f6-41ad-aa30-f62a903650db" countchildren="0" sortindex="1" treeindex="#t10#4032#49#48#715#716#"   classification_id="10" parent_id="715" taxon_id="815"/>
-  <TaxonNode id="828" created="2010-12-21 15:09:49.0" uuid="786622ba-cb2c-47f4-9eeb-65a6ebb7122b" countchildren="0" sortindex="0" treeindex="#t10#4032#49#48#829#828#"   classification_id="10" parent_id="829" taxon_id="946"/>
-  <TaxonNode id="829" created="2010-12-21 15:09:49.0" uuid="4fe03763-b966-4361-8334-352f6f777588" countchildren="1" sortindex="3" treeindex="#t10#4032#49#48#829#"   classification_id="10" parent_id="48" taxon_id="948"/>
-  <TaxonNode id="1915" created="2010-12-21 15:09:57.0" uuid="99f03b56-67cd-4e01-9ceb-2362d48f9d07" countchildren="0" sortindex="0" treeindex="#t10#4032#49#48#1916#1915#"   classification_id="10" parent_id="1916" taxon_id="2203"/>
-  <TaxonNode id="1916" created="2010-12-21 15:09:57.0" uuid="d8998200-500f-4312-90f4-2b60e6fd3a78" countchildren="1" sortindex="4" treeindex="#t10#4032#49#48#1916#"   classification_id="10" parent_id="48" taxon_id="2205"/>
-  <TaxonNode id="2354" created="2010-12-21 15:10:00.0" uuid="b8439f51-6b96-445a-b401-7a836ba1cf58" countchildren="0" sortindex="0" treeindex="#t10#4032#49#48#2355#2354#"   classification_id="10" parent_id="2355" taxon_id="2737"/>
-  <TaxonNode id="2355" created="2010-12-21 15:10:00.0" uuid="6da4e5b6-ebc3-4c46-bdce-24161b7bd0e2" countchildren="1" sortindex="5" treeindex="#t10#4032#49#48#2355#"   classification_id="10" parent_id="48" taxon_id="2738"/>
-  <TaxonNode id="4032" created="2014-01-16 10:24:29.0" uuid="29b3fd3f-29b4-4011-ab12-9c1ad1607dbd" countchildren="2" treeindex="#t10#4032#" classification_id="10"/>
+  <TaxonNode id="46" created="2010-12-21 15:09:43.0" uuid="168a4d09-a2b0-4206-b4cc-5d13199f9306" countchildren="0"   classification_id="10" parent_id="47" taxon_id="48" treeIndex="#t10#4032#49#48#47#46#" sortIndex="0"/>
+  <TaxonNode id="47" created="2010-12-21 15:09:43.0" uuid="2f05d429-632d-4230-b9cb-70299360b470" countchildren="1"   classification_id="10" parent_id="48" taxon_id="51" treeIndex="#t10#4032#49#48#47#" sortIndex="0"/>
+  <TaxonNode id="48" created="2010-12-21 15:09:43.0" uuid="24773d3b-8f11-4400-99de-71658982b245" countchildren="6"   classification_id="10" parent_id="49"  treeIndex="#t10#4032#49#48#" sortIndex="0"/>
+  <TaxonNode id="49" created="2010-12-21 15:09:43.0" uuid="572290a9-7535-48c8-9f68-25ddbc9869ee" countchildren="10"   classification_id="10" parent_id="4032" taxon_id="49" treeIndex="#t10#4032#49#" sortIndex="1"/>
+  <TaxonNode id="236" created="2010-12-21 15:09:45.0" uuid="f5d97f8b-c673-4050-af06-bbfab33baaec" countchildren="0"   classification_id="10" parent_id="237" taxon_id="264" treeIndex="#t10#4032#49#48#237#236#" sortIndex="0"/>
+  <TaxonNode id="237" created="2010-12-21 15:09:45.0" uuid="4998de90-d0be-433b-a62f-0d57a1e399b0" countchildren="1"   classification_id="10" parent_id="48" taxon_id="265" treeIndex="#t10#4032#49#48#237#" sortIndex="1"/>
+  <TaxonNode id="714" created="2010-12-21 15:09:48.0" uuid="b85b5b78-6760-409f-ac91-bb89e95ff2a1" countchildren="0"   classification_id="10" parent_id="715" taxon_id="812" treeIndex="#t10#4032#49#48#715#714#" sortIndex="0"/>
+  <TaxonNode id="715" created="2010-12-21 15:09:48.0" uuid="91698cec-615f-4472-9002-feda1a6acded" countchildren="2"   classification_id="10" parent_id="48" taxon_id="814" treeIndex="#t10#4032#49#48#715#" sortIndex="2"/>
+  <TaxonNode id="716" created="2010-12-21 15:09:48.0" uuid="6ad8e9e2-f5f6-41ad-aa30-f62a903650db" countchildren="0"   classification_id="10" parent_id="715" taxon_id="815" treeIndex="#t10#4032#49#48#715#716#" sortIndex="1"/>
+  <TaxonNode id="828" created="2010-12-21 15:09:49.0" uuid="786622ba-cb2c-47f4-9eeb-65a6ebb7122b" countchildren="0"   classification_id="10" parent_id="829" taxon_id="946" treeIndex="#t10#4032#49#48#829#828#" sortIndex="0"/>
+  <TaxonNode id="829" created="2010-12-21 15:09:49.0" uuid="4fe03763-b966-4361-8334-352f6f777588" countchildren="1"   classification_id="10" parent_id="48" taxon_id="948" treeIndex="#t10#4032#49#48#829#" sortIndex="3"/>
+  <TaxonNode id="1915" created="2010-12-21 15:09:57.0" uuid="99f03b56-67cd-4e01-9ceb-2362d48f9d07" countchildren="0"   classification_id="10" parent_id="1916" taxon_id="2203" treeIndex="#t10#4032#49#48#1916#1915#" sortIndex="0"/>
+  <TaxonNode id="1916" created="2010-12-21 15:09:57.0" uuid="d8998200-500f-4312-90f4-2b60e6fd3a78" countchildren="1"   classification_id="10" parent_id="48" taxon_id="2205" treeIndex="#t10#4032#49#48#1916#" sortIndex="4"/>
+  <TaxonNode id="2354" created="2010-12-21 15:10:00.0" uuid="b8439f51-6b96-445a-b401-7a836ba1cf58" countchildren="0"   classification_id="10" parent_id="2355" taxon_id="2737" treeIndex="#t10#4032#49#48#2355#2354#" sortIndex="0"/>
+  <TaxonNode id="2355" created="2010-12-21 15:10:00.0" uuid="6da4e5b6-ebc3-4c46-bdce-24161b7bd0e2" countchildren="1"   classification_id="10" parent_id="48" taxon_id="2738" treeIndex="#t10#4032#49#48#2355#" sortIndex="5"/>
+  <TaxonNode id="4032" created="2014-01-16 10:24:29.0" uuid="29b3fd3f-29b4-4011-ab12-9c1ad1607dbd" countchildren="2" classification_id="10" treeIndex="#t10#4032#"/>
 
-  <Classification id="10" created="2010-12-21 15:09:43.0" uuid="0c2b5d25-7b15-4401-8b51-dd4be0ee5cab" updated="2015-06-09 07:10:42.0" protectedtitlecache="false" titleCache="Cyprus"   updatedby_id="10" name_id="10" reference_id="1493" rootnode_id="4032"/>
+  <TaxonNameBase DTYPE="BotanicalName" id="48" created="2010-12-21 15:09:43.0" uuid="7aceb517-2b91-46b9-a5a2-88b7e0fb3230" protectedtitlecache="false" titleCache="Adiantum capillus-veneris L." fullTitleCache="Adiantum capillus-veneris L." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="L." binomhybrid="false" genusoruninomial="Adiantum" hybridformula="false" monomhybrid="false" namecache="Adiantum capillus-veneris" protectedauthorshipcache="false" protectednamecache="false" specificepithet="capillus-veneris" trinomhybrid="false" anamorphic="false"    rank_id="778" />
+  <TaxonNameBase DTYPE="BotanicalName" id="49" created="2010-12-21 15:09:43.0" uuid="079fff38-ff2d-426b-a49e-70b0f1db6c31" protectedtitlecache="false" titleCache="Pteridophyta" fullTitleCache="Pteridophyta" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Pteridophyta" hybridformula="false" monomhybrid="false" namecache="Pteridophyta" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false"    rank_id="810"/>
+  <TaxonNameBase DTYPE="BotanicalName" id="51" created="2010-12-21 15:09:43.0" uuid="c8af63e0-7bd4-4fad-aa2d-3777cbe1210a" protectedtitlecache="false" titleCache="Adiantum" fullTitleCache="Adiantum" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Adiantum" hybridformula="false" monomhybrid="false" namecache="Adiantum" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false"    rank_id="788"/>
+  <TaxonNameBase DTYPE="BotanicalName" id="264" created="2010-12-21 15:09:45.0" uuid="b976da6a-dd84-4fcd-9a1b-9847afba1da2" protectedtitlecache="false" titleCache="Anogramma leptophylla (L.) Link" fullTitleCache="Anogramma leptophylla (L.) Link" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(L.) Link" binomhybrid="false" genusoruninomial="Anogramma" hybridformula="false" monomhybrid="false" namecache="Anogramma leptophylla" protectedauthorshipcache="false" protectednamecache="false" specificepithet="leptophylla" trinomhybrid="false" anamorphic="false"    rank_id="778"  />
+  <TaxonNameBase DTYPE="BotanicalName" id="265" created="2010-12-21 15:09:45.0" uuid="c7f1db22-20fb-4eeb-810b-d37c5593b95d" protectedtitlecache="false" titleCache="Anogramma" fullTitleCache="Anogramma" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Anogramma" hybridformula="false" monomhybrid="false" namecache="Anogramma" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false"    rank_id="788"/>
+  <TaxonNameBase DTYPE="BotanicalName" id="812" created="2010-12-21 15:09:48.0" uuid="16450a2d-2085-471f-804a-defcd43c03e4" protectedtitlecache="false" titleCache="Cheilanthes acrostica (Balb.) Tod." fullTitleCache="Cheilanthes acrostica (Balb.) Tod." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(Balb.) Tod." binomhybrid="false" genusoruninomial="Cheilanthes" hybridformula="false" monomhybrid="false" namecache="Cheilanthes acrostica" protectedauthorshipcache="false" protectednamecache="false" specificepithet="acrostica" trinomhybrid="false" anamorphic="false"    rank_id="778"  />
+  <TaxonNameBase DTYPE="BotanicalName" id="814" created="2010-12-21 15:09:48.0" uuid="bbb1c5be-5a0c-45e2-b8af-f37a80ccf858" protectedtitlecache="false" titleCache="Cheilanthes" fullTitleCache="Cheilanthes" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Cheilanthes" hybridformula="false" monomhybrid="false" namecache="Cheilanthes" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false"    rank_id="788"/>
+  <TaxonNameBase DTYPE="BotanicalName" id="815" created="2010-12-21 15:09:48.0" uuid="f04a9283-f856-4d28-b469-4a222472862b" protectedtitlecache="false" titleCache="Cheilanthes maderensis Lowe" fullTitleCache="Cheilanthes maderensis Lowe" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="Lowe" binomhybrid="false" genusoruninomial="Cheilanthes" hybridformula="false" monomhybrid="false" namecache="Cheilanthes maderensis" protectedauthorshipcache="false" protectednamecache="false" specificepithet="maderensis" trinomhybrid="false" anamorphic="false"    rank_id="778" />
+  <TaxonNameBase DTYPE="BotanicalName" id="946" created="2010-12-21 15:09:49.0" uuid="e30ef44b-52e4-41ff-a68d-9912d3c537f1" protectedtitlecache="false" titleCache="Cosentinia vellea (Aiton) Tod." fullTitleCache="Cosentinia vellea (Aiton) Tod." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(Aiton) Tod." binomhybrid="false" genusoruninomial="Cosentinia" hybridformula="false" monomhybrid="false" namecache="Cosentinia vellea" protectedauthorshipcache="false" protectednamecache="false" specificepithet="vellea" trinomhybrid="false" anamorphic="false"    rank_id="778"  />
+  <TaxonNameBase DTYPE="BotanicalName" id="948" created="2010-12-21 15:09:49.0" uuid="21fda99e-0425-4f29-b7b2-196f8a51b054" protectedtitlecache="false" titleCache="Cosentinia" fullTitleCache="Cosentinia" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Cosentinia" hybridformula="false" monomhybrid="false" namecache="Cosentinia" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false"    rank_id="788"/>
+  <TaxonNameBase DTYPE="BotanicalName" id="2203" created="2010-12-21 15:09:57.0" uuid="8fe0bb4b-7687-4d32-8ff2-94e690980f81" protectedtitlecache="false" titleCache="Notholaena marantae (L.) Desv." fullTitleCache="Notholaena marantae (L.) Desv." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(L.) Desv." binomhybrid="false" genusoruninomial="Notholaena" hybridformula="false" monomhybrid="false" namecache="Notholaena marantae" protectedauthorshipcache="false" protectednamecache="false" specificepithet="marantae" trinomhybrid="false" anamorphic="false"    rank_id="778"  />
+  <TaxonNameBase DTYPE="BotanicalName" id="2205" created="2010-12-21 15:09:57.0" uuid="77b7934f-8f62-4798-b96a-f3d12bfd5ebf" protectedtitlecache="false" titleCache="Notholaena" fullTitleCache="Notholaena" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Notholaena" hybridformula="false" monomhybrid="false" namecache="Notholaena" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false"    rank_id="788"/>
+  <TaxonNameBase DTYPE="BotanicalName" id="2737" created="2010-12-21 15:10:00.0" uuid="25560d66-07a3-41ce-8244-36ca98638c71" protectedtitlecache="false" titleCache="Pteris vittata L." fullTitleCache="Pteris vittata L." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="L." binomhybrid="false" genusoruninomial="Pteris" hybridformula="false" monomhybrid="false" namecache="Pteris vittata" protectedauthorshipcache="false" protectednamecache="false" specificepithet="vittata" trinomhybrid="false" anamorphic="false"    rank_id="778" />
+  <TaxonNameBase DTYPE="BotanicalName" id="2738" created="2010-12-21 15:10:00.0" uuid="a40593ce-e8cc-43bb-a391-2de988b09039" protectedtitlecache="false" titleCache="Pteris" fullTitleCache="Pteris" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Pteris" hybridformula="false" monomhybrid="false" namecache="Pteris" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false"    rank_id="788"/>
 
-  <TaxonBase DTYPE="Taxon" id="48" created="2011-03-01 20:11:26.0" uuid="b8402dc4-5050-4882-a147-01b71e0e47d6" protectedtitlecache="false" titleCache="Adiantum capillus-veneris L. sec. Cyprus" doubtful="false" publish="true" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="48" sec_id="10"/>
-  <TaxonBase DTYPE="Taxon" id="264" created="2011-03-01 20:11:27.0" uuid="d679c5d0-53b3-40fc-97e1-0646aad7ed23" protectedtitlecache="false" titleCache="Anogramma leptophylla (L.) Link sec. Cyprus" doubtful="false" publish="true" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="264" sec_id="10"/>
-  <TaxonBase DTYPE="Taxon" id="812" created="2011-03-01 20:11:29.0" uuid="e40854d7-143f-4054-b229-6ed4cedb4bff" protectedtitlecache="false" titleCache="Cheilanthes acrostica (Balb.) Tod. sec. Cyprus" doubtful="false" publish="true" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="812" sec_id="10"/>
-  <TaxonBase DTYPE="Taxon" id="815" created="2010-12-21 15:09:48.0" uuid="7ea2c74a-f2b2-41f6-acdf-1ca35f5d03f8" protectedtitlecache="false" titleCache="Cheilanthes maderensis Lowe sec. Cyprus" doubtful="false" publish="true" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="815" sec_id="10"/>
-  <TaxonBase DTYPE="Taxon" id="946" created="2011-03-01 20:11:30.0" uuid="ba21b018-97d2-42d7-af6c-5e8db8e495ff" protectedtitlecache="false" titleCache="Cosentinia vellea (Aiton) Tod. sec. Cyprus" doubtful="false" publish="true" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="946" sec_id="10"/>
-  <TaxonBase DTYPE="Taxon" id="2203" created="2011-03-01 20:11:36.0" uuid="d9a0c5d5-baee-4b6b-974a-a7de5affe748" protectedtitlecache="false" titleCache="Notholaena marantae (L.) Desv. sec. Cyprus" doubtful="false" publish="true" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="2203" sec_id="10"/>
-  <TaxonBase DTYPE="Taxon" id="2737" created="2011-03-01 20:11:39.0" uuid="6b46ac55-3e39-4c37-a1b6-b680b21599b2" protectedtitlecache="false" titleCache="Pteris vittata L. sec. Cyprus" doubtful="false" publish="true" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="2737" sec_id="10"/>
+  <Classification id="10" created="2010-12-21 15:09:43.0" uuid="0c2b5d25-7b15-4401-8b51-dd4be0ee5cab" updated="2015-06-09 07:10:42.0" protectedtitlecache="false" titleCache="Cyprus"   updatedby_id="10" name_id="10"  rootnode_id="4032"/>
+
+  <TaxonBase DTYPE="Taxon" id="48" created="2011-03-01 20:11:26.0" uuid="b8402dc4-5050-4882-a147-01b71e0e47d6" protectedtitlecache="false" titleCache="Adiantum capillus-veneris L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="48" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="49" created="2010-12-21 15:09:43.0" uuid="1141a510-5ee8-4a59-ae60-7b4fea44872f" protectedtitlecache="false" titleCache="Pteridophyta sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="49" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="51" created="2010-12-21 15:09:43.0" uuid="233cac41-bb05-4925-bb9e-ab0bdf330973" protectedtitlecache="false" titleCache="Adiantum sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="51" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="264" created="2011-03-01 20:11:27.0" uuid="d679c5d0-53b3-40fc-97e1-0646aad7ed23" protectedtitlecache="false" titleCache="Anogramma leptophylla (L.) Link sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="264" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="265" created="2010-12-21 15:09:45.0" uuid="1fc1d927-1155-4282-a9f5-f07202f79ace" protectedtitlecache="false" titleCache="Anogramma sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="265" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="812" created="2011-03-01 20:11:29.0" uuid="e40854d7-143f-4054-b229-6ed4cedb4bff" protectedtitlecache="false" titleCache="Cheilanthes acrostica (Balb.) Tod. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="812" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="814" created="2010-12-21 15:09:48.0" uuid="433ad11a-b931-49a4-8128-d6f4d454914a" protectedtitlecache="false" titleCache="Cheilanthes sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="814" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="815" created="2010-12-21 15:09:48.0" uuid="7ea2c74a-f2b2-41f6-acdf-1ca35f5d03f8" protectedtitlecache="false" titleCache="Cheilanthes maderensis Lowe sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="815" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="946" created="2011-03-01 20:11:30.0" uuid="ba21b018-97d2-42d7-af6c-5e8db8e495ff" protectedtitlecache="false" titleCache="Cosentinia vellea (Aiton) Tod. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="946" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="948" created="2010-12-21 15:09:49.0" uuid="a2768f6d-80f2-4e0c-a6e3-99b7a9f3bc9d" protectedtitlecache="false" titleCache="Cosentinia sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="948" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="2203" created="2011-03-01 20:11:36.0" uuid="d9a0c5d5-baee-4b6b-974a-a7de5affe748" protectedtitlecache="false" titleCache="Notholaena marantae (L.) Desv. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="2203" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="2205" created="2010-12-21 15:09:57.0" uuid="c221d34c-76b0-4fc7-9901-e72efd4c899b" protectedtitlecache="false" titleCache="Notholaena sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="2205" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="2737" created="2011-03-01 20:11:39.0" uuid="6b46ac55-3e39-4c37-a1b6-b680b21599b2" protectedtitlecache="false" titleCache="Pteris vittata L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="2737" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="2738" created="2010-12-21 15:10:00.0" uuid="8ac3dca2-6bbf-4cd4-84b7-53ddc2973ed8" protectedtitlecache="false" titleCache="Pteris sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"   name_id="2738" sec_id="10" publish="true"/>
 
   <DescriptionBase DTYPE="TaxonDescription" id="28" created="2010-12-21 15:09:43.0" uuid="f04f8f66-ad92-42d0-89bc-04ac5b36163c" updated="2011-03-01 19:20:45.0" protectedtitlecache="false" titleCache="Taxon description for Adiantum capillus-veneris L." imagegallery="false"   taxon_id="48"/>
   <DescriptionBase DTYPE="TaxonDescription" id="149" created="2010-12-21 15:09:45.0" uuid="24df0fca-bfc4-4f0f-a269-336985ed6e5e" updated="2011-03-01 19:20:46.0" protectedtitlecache="false" titleCache="Taxon description for Anogramma leptophylla (L.) Link" imagegallery="false"   taxon_id="264"/>
@@ -62,5 +84,6 @@
   <DescriptionBase DTYPE="TaxonDescription" id="14101" created="2014-02-28 19:21:07.0" uuid="815336d3-19d6-493d-9ea4-bcb320d1b922" updated="2014-02-28 19:21:08.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="946"/>
   <DescriptionBase DTYPE="TaxonDescription" id="14658" created="2014-02-28 19:23:51.0" uuid="ce4068f8-17b0-46e2-9fbb-e8c16efb7255" updated="2014-02-28 19:23:51.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2203"/>
   <DescriptionBase DTYPE="TaxonDescription" id="14864" created="2014-02-28 19:25:21.0" uuid="2d55f445-8e72-43d3-976a-133828e89599" updated="2014-02-28 19:25:21.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2737"/>
-  
+
+  <SynonymRelationship/>
 </dataset>