added support to unregister from PostDataChangeListener and some new plugin versions
authorn.hoffmann <n.hoffmann@localhost>
Fri, 8 May 2009 16:17:51 +0000 (16:17 +0000)
committern.hoffmann <n.hoffmann@localhost>
Fri, 8 May 2009 16:17:51 +0000 (16:17 +0000)
app-import/src/main/java/eu/etaxonomy/cdm/app/wp6/diptera/DipteraActivator.java
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/hibernate/CdmPostDataChangeObservableListener.java
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/TermBaseBeanProcessor.java
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/conversation/ConversationHolder.java
cdmlib-services/src/test/java/eu/etaxonomy/cdm/test/function/TestConcurrentSession.java
eclipse-feature/feature.xml
eclipse-plugin/META-INF/MANIFEST.MF
eclipse-updateSite/site.xml

index 9177c77a1a543bb3c61d48823baacff4da38852d..97a677ea86418e401a62873899648563bde4f142 100644 (file)
@@ -28,7 +28,6 @@ import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.FeatureNode;\r
 import eu.etaxonomy.cdm.model.description.FeatureTree;\r
 import eu.etaxonomy.cdm.model.name.NomenclaturalCode;\r
-import eu.etaxonomy.cdm.model.name.Rank;\r
 \r
 \r
 /**\r
@@ -47,7 +46,7 @@ public class DipteraActivator {
        //database validation status (create, update, validate ...)\r
        static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;\r
        static final Source berlinModelSource = BerlinModelSources.EDIT_Diptera();\r
-       static final ICdmDataSource cdmDestination = CdmDestinations.localH2Diptera();\r
+       static final ICdmDataSource cdmDestination = CdmDestinations.localH2();\r
        static final UUID secUuid = UUID.fromString("06fd671f-1226-4e3b-beca-1959b3b32e20");\r
        static final int sourceSecId = 1000000;\r
        static final UUID featureTreeUuid = UUID.fromString("ae9615b8-bc60-4ed0-ad96-897f9226d568");\r
@@ -148,6 +147,10 @@ public class DipteraActivator {
                        //make feature tree\r
                        app = bmImport.getCdmApp();\r
                        FeatureTree tree = TreeCreator.flatTree(featureTreeUuid, bmImportConfigurator.getFeatureMap(), featureKeyList);\r
+                       // add image\r
+                       FeatureNode imageNode = FeatureNode.NewInstance(Feature.IMAGE());\r
+                       tree.getRoot().addChild(imageNode);\r
+                       // add distribution\r
                        FeatureNode distributionNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());\r
                        tree.getRoot().addChild(distributionNode);\r
                        app.getDescriptionService().saveFeatureTree(tree);\r
index 3d674f8406843233fa0d6ea8d9a7d015179a1f47..a75c0142858afbb64f9979de55dfb80ae542e88a 100644 (file)
@@ -102,6 +102,14 @@ public class CdmPostDataChangeObservableListener
                getDefault().observers.add(observer);
        }
        
+       /**
+        * Remove observer from notify queue
+        * @param observer
+        */
+       public void unregister(ICdmPostDataChangeObserver observer){
+               getDefault().observers.remove(observer);
+       }
+       
        public void delayedNotify(){
                if(delayed && changeEvents.size() > 0){
                        for( ICdmPostDataChangeObserver observer : observers){
index 6ccf8c6574fd52547510cc05e12efeeea8bbd856..df433a44b5f4c772d3e0028f9b10e974ef05acd9 100644 (file)
@@ -65,9 +65,9 @@ public class TermBaseBeanProcessor extends AbstractCdmBeanProcessor<TermBase> {
                        \r
                        representation = term.getPreferredRepresentation(languages);\r
                        if(representation != null){\r
-                               if(representation.getText() != null && !representation.getText().isEmpty()){\r
+                               if(representation.getText() != null && representation.getText().length() != 0){\r
                                        json.element("representation_L10n", representation.getText());\r
-                               } else if (representation.getLabel() != null && !representation.getLabel().isEmpty()) {\r
+                               } else if (representation.getLabel() != null && representation.getLabel().length() !=0) {\r
                                        json.element("representation_L10n", representation.getLabel());\r
                                } else {\r
                                        json.element("representation_L10n", representation.getAbbreviatedLabel());\r
index df8a14f94ad556a7e0ccede005bb55dd29b55de7..a4a01fa45de63ed41a9d1108613cc6114216e81e 100644 (file)
@@ -3,8 +3,6 @@
  */
 package eu.etaxonomy.cdm.api.conversation;
 
-import java.util.Map;
-
 import javax.sql.DataSource;
 
 import org.apache.log4j.Logger;
@@ -19,7 +17,6 @@ import org.springframework.orm.hibernate3.SessionHolder;
 import org.springframework.transaction.PlatformTransactionManager;
 import org.springframework.transaction.TransactionDefinition;
 import org.springframework.transaction.TransactionStatus;
-import org.springframework.transaction.support.ResourceHolder;
 import org.springframework.transaction.support.TransactionSynchronizationManager;
 
 import eu.etaxonomy.cdm.persistence.hibernate.CdmPostDataChangeObservableListener;
@@ -81,6 +78,15 @@ public class ConversationHolder{
                this.dataSource = dataSource;
                this.sessionFactory = sessionFactory;
                this.transactionManager = transactionManager;
+               
+               bind();
+               
+
+               // moved this from editor to here
+               // 
+               if(TransactionSynchronizationManager.hasResource(getDataSource())){
+                       TransactionSynchronizationManager.unbindResource(getDataSource());
+               }
        }
        
        /**
@@ -96,9 +102,6 @@ public class ConversationHolder{
                }
                
                try{
-                       // FIXME for debugging -> remove
-                       Map resourceMap = TransactionSynchronizationManager.getResourceMap();
-                       
                        
                        logger.info("Starting new Synchronization in TransactionSynchronizationManager.");
                        TransactionSynchronizationManager.initSynchronization();
@@ -171,7 +174,7 @@ public class ConversationHolder{
         * Commit the running transaction.
         */
        public void commit(){
-               commit(false);
+               commit(true);
        }
        
        /**
@@ -203,16 +206,6 @@ public class ConversationHolder{
                }
                return null;
        }
-       
-
-       /**
-        * close the session if it is still open
-        */
-       public void dispose() {
-               if (longSession != null && longSession.isOpen()){
-                       longSession.close();
-               }
-       }
 
        /**
         * @return the session associated with this conversation manager 
@@ -271,4 +264,11 @@ public class ConversationHolder{
        public void registerForDataStoreChanges(IConversationEnabled observer) {
                CdmPostDataChangeObservableListener.getDefault().register(observer);
        }
+       
+       /**
+        * Register to get updated after any interaction with the datastore
+        */
+       public void unregisterForDataStoreChanges(IConversationEnabled observer) {
+               CdmPostDataChangeObservableListener.getDefault().unregister(observer);
+       }
 }
index 613c347226d2602253dcdf824a7ab1b87e391b8a..24633106543d236284678e4dd2d826c376f216b9 100644 (file)
@@ -101,9 +101,6 @@ public class TestConcurrentSession extends CdmIntegrationTest{
        
        @After
        public void tearDown(){
-               conversationHolder1.dispose();
-               conversationHolder2.dispose();
-               conversationHolder3.dispose();
        }
        
        /**
index 05ca84690f8ce6cd2cddd414d052c0306f07fc77..58d6c7fa215e9eb1b30db9f353dfa17763831f8a 100644 (file)
@@ -2,7 +2,7 @@
 <feature
       id="eu.etaxonomy.cdmLibrary"
       label="CDM Library"
-      version="2.1.0.42"
+      version="2.1.0.50"
       provider-name="EDIT">
 
    <description url="http://www.example.com/description">
index 4cde8888c863574cf5df4a8c277c661bbcbffde9..ee64cd9adc7626ca3e8d61a62bf3cbdc0f828e4e 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: CDM Library Plug-in
 Bundle-SymbolicName: eu.etaxonomy.cdmLibrary;singleton:=true
-Bundle-Version: 2.1.0.42
+Bundle-Version: 2.1.0.50
 Bundle-ClassPath: aspectjrt-1.5.4.jar,
  antlr-2.7.6.jar,
  asm-attrs.jar,
index 56f486653093aeae41fc1129a91cf66eb2469140..dda4eb19580125ad362aa6d2df2bd623c9b541a7 100644 (file)
@@ -3,7 +3,7 @@
    <description url="file:///P:\eclipse\cdmlib\eclipse-updateSite">
       Eine schöne Update Site
    </description>
-   <feature url="features/eu.etaxonomy.cdmLibrary_2.1.0.42.jar" id="eu.etaxonomy.cdmLibrary" version="2.1.0.42">
+   <feature url="features/eu.etaxonomy.cdmLibrary_2.1.0.50.jar" id="eu.etaxonomy.cdmLibrary" version="2.1.0.50">
       <category name="CDM Library"/>
    </feature>
    <category-def name="CDM Library" label="CDM Library">