Added correct number of substeps for ApplicationController subprogress monitor.
authorn.hoffmann <n.hoffmann@localhost>
Mon, 10 Oct 2011 12:09:21 +0000 (12:09 +0000)
committern.hoffmann <n.hoffmann@localhost>
Mon, 10 Oct 2011 12:09:21 +0000 (12:09 +0000)
TypeDesignation are now deleted via service layer.
Removed bogus check for collection equality in entity collection sections that lead to massive problems with detached entities

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStoreConnector.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/TypeDesignationSection.java

index 0892ec48e47addd511a335fe558ac5b4833d4e09..f4822c2618bb902b10618c36f3e1edfe16f4aafc 100644 (file)
@@ -86,7 +86,7 @@ class CdmStoreConnector extends Job {
 
                if (!monitor.isCanceled()) {
                        CdmProgressMonitorAdapter subprogressMonitor = CdmProgressMonitorAdapter
-                                       .CreateSubMonitor(monitor, IProgressMonitor.UNKNOWN);
+                                       .CreateSubMonitor(monitor, 7);
                        // This is where we instantiate the application controller
                        try {
                                applicationController = CdmApplicationController.NewInstance(
@@ -97,7 +97,7 @@ class CdmStoreConnector extends Job {
                                return new Status(IStatus.ERROR, "Could not connect to CDM Store", "An error occurred while trying to connect to datasource: " + dataSource.getName(), e);
                        }
                }
-
+               
                monitor.done();
 
                if (!monitor.isCanceled()) {
index 69f4921f012d60c72ce13aafa44746ff9098e2db..d17339460d4a49fac0610868f10066161465c93f 100644 (file)
@@ -114,7 +114,7 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
         */
        @Override
        public void setEntity(ENTITY entity) {
-               if(entity != null && hasCollectionChanged(entity)){
+               if(entity != null){
                        super.setEntity(entity);
                        internalUpdateSection(false);
                }
@@ -163,31 +163,35 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
        /**
         * Whether the entities specific collection changed
         * 
+        * KLUDGE this seemingly leads to errors
+        * 
         * @param newEntity
         * @return
         */
        private boolean hasCollectionChanged(ENTITY newEntity){
 
-               // return true on null
-               if(getEntity() == null || newEntity == null)    return true;    
-               
-               // if the entities differ the collection has changed
-               if(! getEntity().equals(newEntity)) return true;
-               
-               Collection<ELEMENT> oldCollection = getCollection(getEntity());
-               Collection<ELEMENT> newCollection = getCollection(newEntity);
-               
-               // return true on null
-               if(oldCollection == null || newCollection == null) return true;
-               
-               // if the collections are object equal, check if the content is equal, too
-               if(oldCollection.equals(newCollection)){
-               
-                       boolean equal = CollectionUtils.isEqualCollection(oldCollection, newCollection);
-                       // return true when collections are not equal
-                       return equal ? false : true;
-               }
                return true;
+               
+//             // return true on null
+//             if(getEntity() == null || newEntity == null)    return true;    
+//             
+//             // if the entities differ the collection has changed
+//             if(! getEntity().equals(newEntity)) return true;
+//             
+//             Collection<ELEMENT> oldCollection = getCollection(getEntity());
+//             Collection<ELEMENT> newCollection = getCollection(newEntity);
+//             
+//             // return true on null
+//             if(oldCollection == null || newCollection == null) return true;
+//             
+//             // if the collections are object equal, check if the content is equal, too
+//             if(oldCollection.equals(newCollection)){
+//             
+//                     boolean equal = CollectionUtils.isEqualCollection(oldCollection, newCollection);
+//                     // return true when collections are not equal
+//                     return equal ? false : true;
+//             }
+//             return true;
        }
 
        /**
index 8b40d8a0b2dbe6c7e03c83f1cef8762d31b3c2e7..d0fb756d557f4e50de9e87903d6f155f90dc8ea4 100644 (file)
@@ -13,6 +13,7 @@ package eu.etaxonomy.taxeditor.ui.section.name;
 import java.util.Collection;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.INameService;
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.name.NameTypeDesignation;
 import eu.etaxonomy.cdm.model.name.NonViralName;
@@ -21,6 +22,7 @@ import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
@@ -87,7 +89,9 @@ public class TypeDesignationSection extends AbstractEntityCollectionSection<Taxo
        /** {@inheritDoc} */
        @Override
        public void removeElement(TypeDesignationBase element) {
-               getEntity().removeTypeDesignation(element);
+               CdmStore.getService(INameService.class).deleteTypeDesignation(getEntity(), element);
+               
+//             getEntity().removeTypeDesignation(element);
        }
 
        /*