Project

General

Profile

« Previous | Next » 

Revision 49d3c2dd

Added by Katja Luther over 1 year ago

ref #10186: remove conversation holder

View differences:

eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/PolytomousKeyViewPartE4.java
49 49
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
50 50
import eu.etaxonomy.cdm.api.application.ICdmChangeListener;
51 51
import eu.etaxonomy.cdm.api.application.ICdmDataChangeService;
52
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
53
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
54 52
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
55 53
import eu.etaxonomy.cdm.model.description.PolytomousKey;
56
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
57 54
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
58
import eu.etaxonomy.taxeditor.model.DataChangeBridge;
59 55
import eu.etaxonomy.taxeditor.model.IContextListener;
60 56
import eu.etaxonomy.taxeditor.model.MessagingUtils;
61 57
import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyContentProvider;
......
71 67
 * @since Sep 28, 2017
72 68
 */
73 69
public class PolytomousKeyViewPartE4 implements
74
		IConversationEnabled, ICdmEntitySessionEnabled<PolytomousKey>, IPostOperationEnabled,
70
		ICdmEntitySessionEnabled<PolytomousKey>, IPostOperationEnabled,
75 71
		ICdmChangeListener {
76 72

  
77 73
    private class FilterModifyListener implements ModifyListener{
......
120 116
    }
121 117

  
122 118
    private ListViewer viewer;
123
    private ConversationHolder conversation;
124 119
    private IContextListener contextListener;
125 120
    private final CdmFormFactory formFactory;
126 121
    private Text text_filter;
127 122
    private ICdmEntitySession cdmEntitySession;
128 123

  
129
    private PolytomousKeyViewPartDataChangeBehaviorE4 dataChangeBehavior;
124
    //private PolytomousKeyViewPartDataChangeBehaviorE4 dataChangeBehavior;
130 125

  
131 126

  
132 127
    @Inject
......
207 202
    }
208 203

  
209 204
    private void setInput() {
210
        conversation = CdmStore.createConversation();
211
        conversation.registerForDataStoreChanges(this);
212 205
        cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
213 206
        CdmApplicationState.getCurrentDataChangeService().register(this);
214 207

  
......
228 221
        }
229 222
    }
230 223

  
231
    @Override
232
    public void update(CdmDataChangeMap changeEvents) {
233
        if (dataChangeBehavior == null) {
234
            dataChangeBehavior = new PolytomousKeyViewPartDataChangeBehaviorE4(this);
235
        }
236

  
237
        DataChangeBridge.handleDataChange(changeEvents, dataChangeBehavior);
238
    }
239

  
240
    @Override
241
    public ConversationHolder getConversationHolder() {
242
        return conversation;
243
    }
244

  
245 224
    @PreDestroy
246 225
    public void dispose() {
247
        if(conversation!=null){
248
            conversation.unregisterForDataStoreChanges(this);
249
            conversation.close();
250
            CdmStore.getContextManager().removeContextListener(contextListener);
251
            conversation = null;
252
        }
226
        
253 227
        if(cdmEntitySession != null) {
228
        	CdmStore.getContextManager().removeContextListener(contextListener);
254 229
            cdmEntitySession.dispose();
255 230
            cdmEntitySession = null;
256 231
        }
......
262 237

  
263 238
    @Override
264 239
    public boolean postOperation(Object objectAffectedByOperation) {
265
        getConversationHolder().bind();
266
        getConversationHolder().commit(true);
267 240
        viewer.refresh();
268 241
        return true;
269 242
    }
......
274 247
    }
275 248

  
276 249
    public void refresh() {
277
        getConversationHolder().bind();
278
        //FIXME : Need to make sure this is a stable fix (ticket 3822)
279
        getConversationHolder().commit();
280 250
        List<PolytomousKey> input = CdmStore.getService(IPolytomousKeyService.class).list(PolytomousKey.class, null, null, null, null);
281 251
        if(!viewer.getControl().isDisposed()){
282 252
            viewer.setInput(input);

Also available in: Unified diff