Project

General

Profile

« Previous | Next » 

Revision 2b111f60

Added by Niels Hoffmann over 15 years ago

added support to unregister from PostDataChangeListener and some new plugin versions

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/wp6/diptera/DipteraActivator.java
28 28
import eu.etaxonomy.cdm.model.description.FeatureNode;
29 29
import eu.etaxonomy.cdm.model.description.FeatureTree;
30 30
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
31
import eu.etaxonomy.cdm.model.name.Rank;
32 31

  
33 32

  
34 33
/**
......
47 46
	//database validation status (create, update, validate ...)
48 47
	static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
49 48
	static final Source berlinModelSource = BerlinModelSources.EDIT_Diptera();
50
	static final ICdmDataSource cdmDestination = CdmDestinations.localH2Diptera();
49
	static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
51 50
	static final UUID secUuid = UUID.fromString("06fd671f-1226-4e3b-beca-1959b3b32e20");
52 51
	static final int sourceSecId = 1000000;
53 52
	static final UUID featureTreeUuid = UUID.fromString("ae9615b8-bc60-4ed0-ad96-897f9226d568");
......
148 147
			//make feature tree
149 148
			app = bmImport.getCdmApp();
150 149
			FeatureTree tree = TreeCreator.flatTree(featureTreeUuid, bmImportConfigurator.getFeatureMap(), featureKeyList);
150
			// add image
151
			FeatureNode imageNode = FeatureNode.NewInstance(Feature.IMAGE());
152
			tree.getRoot().addChild(imageNode);
153
			// add distribution
151 154
			FeatureNode distributionNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
152 155
			tree.getRoot().addChild(distributionNode);
153 156
			app.getDescriptionService().saveFeatureTree(tree);
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/hibernate/CdmPostDataChangeObservableListener.java
102 102
		getDefault().observers.add(observer);
103 103
	}
104 104
	
105
	/**
106
	 * Remove observer from notify queue
107
	 * @param observer
108
	 */
109
	public void unregister(ICdmPostDataChangeObserver observer){
110
		getDefault().observers.remove(observer);
111
	}
112
	
105 113
	public void delayedNotify(){
106 114
		if(delayed && changeEvents.size() > 0){
107 115
			for( ICdmPostDataChangeObserver observer : observers){
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/TermBaseBeanProcessor.java
65 65
			
66 66
			representation = term.getPreferredRepresentation(languages);
67 67
			if(representation != null){
68
				if(representation.getText() != null && !representation.getText().isEmpty()){
68
				if(representation.getText() != null && representation.getText().length() != 0){
69 69
					json.element("representation_L10n", representation.getText());
70
				} else if (representation.getLabel() != null && !representation.getLabel().isEmpty()) {
70
				} else if (representation.getLabel() != null && representation.getLabel().length() !=0) {
71 71
					json.element("representation_L10n", representation.getLabel());
72 72
				} else {
73 73
					json.element("representation_L10n", representation.getAbbreviatedLabel());
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/conversation/ConversationHolder.java
3 3
 */
4 4
package eu.etaxonomy.cdm.api.conversation;
5 5

  
6
import java.util.Map;
7

  
8 6
import javax.sql.DataSource;
9 7

  
10 8
import org.apache.log4j.Logger;
......
19 17
import org.springframework.transaction.PlatformTransactionManager;
20 18
import org.springframework.transaction.TransactionDefinition;
21 19
import org.springframework.transaction.TransactionStatus;
22
import org.springframework.transaction.support.ResourceHolder;
23 20
import org.springframework.transaction.support.TransactionSynchronizationManager;
24 21

  
25 22
import eu.etaxonomy.cdm.persistence.hibernate.CdmPostDataChangeObservableListener;
......
81 78
		this.dataSource = dataSource;
82 79
		this.sessionFactory = sessionFactory;
83 80
		this.transactionManager = transactionManager;
81
		
82
		bind();
83
		
84

  
85
		// moved this from editor to here
86
		// 
87
		if(TransactionSynchronizationManager.hasResource(getDataSource())){
88
			TransactionSynchronizationManager.unbindResource(getDataSource());
89
		}
84 90
	}
85 91
	
86 92
	/**
......
96 102
		}
97 103
		
98 104
		try{
99
			// FIXME for debugging -> remove
100
			Map resourceMap = TransactionSynchronizationManager.getResourceMap();
101
			
102 105
			
103 106
			logger.info("Starting new Synchronization in TransactionSynchronizationManager.");
104 107
			TransactionSynchronizationManager.initSynchronization();
......
171 174
	 * Commit the running transaction.
172 175
	 */
173 176
	public void commit(){
174
		commit(false);
177
		commit(true);
175 178
	}
176 179
	
177 180
	/**
......
203 206
		}
204 207
		return null;
205 208
	}
206
	
207

  
208
	/**
209
	 * close the session if it is still open
210
	 */
211
	public void dispose() {
212
		if (longSession != null && longSession.isOpen()){
213
			longSession.close();
214
		}
215
	}
216 209

  
217 210
	/**
218 211
	 * @return the session associated with this conversation manager 
......
271 264
	public void registerForDataStoreChanges(IConversationEnabled observer) {
272 265
		CdmPostDataChangeObservableListener.getDefault().register(observer);
273 266
	}
267
	
268
	/**
269
	 * Register to get updated after any interaction with the datastore
270
	 */
271
	public void unregisterForDataStoreChanges(IConversationEnabled observer) {
272
		CdmPostDataChangeObservableListener.getDefault().unregister(observer);
273
	}
274 274
}
cdmlib-services/src/test/java/eu/etaxonomy/cdm/test/function/TestConcurrentSession.java
101 101
	
102 102
	@After
103 103
	public void tearDown(){
104
		conversationHolder1.dispose();
105
		conversationHolder2.dispose();
106
		conversationHolder3.dispose();
107 104
	}
108 105
	
109 106
	/**
eclipse-feature/feature.xml
2 2
<feature
3 3
      id="eu.etaxonomy.cdmLibrary"
4 4
      label="CDM Library"
5
      version="2.1.0.42"
5
      version="2.1.0.50"
6 6
      provider-name="EDIT">
7 7

  
8 8
   <description url="http://www.example.com/description">
eclipse-plugin/META-INF/MANIFEST.MF
2 2
Bundle-ManifestVersion: 2
3 3
Bundle-Name: CDM Library Plug-in
4 4
Bundle-SymbolicName: eu.etaxonomy.cdmLibrary;singleton:=true
5
Bundle-Version: 2.1.0.42
5
Bundle-Version: 2.1.0.50
6 6
Bundle-ClassPath: aspectjrt-1.5.4.jar,
7 7
 antlr-2.7.6.jar,
8 8
 asm-attrs.jar,
eclipse-updateSite/site.xml
3 3
   <description url="file:///P:\eclipse\cdmlib\eclipse-updateSite">
4 4
      Eine schöne Update Site
5 5
   </description>
6
   <feature url="features/eu.etaxonomy.cdmLibrary_2.1.0.42.jar" id="eu.etaxonomy.cdmLibrary" version="2.1.0.42">
6
   <feature url="features/eu.etaxonomy.cdmLibrary_2.1.0.50.jar" id="eu.etaxonomy.cdmLibrary" version="2.1.0.50">
7 7
      <category name="CDM Library"/>
8 8
   </feature>
9 9
   <category-def name="CDM Library" label="CDM Library">

Also available in: Unified diff