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.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/character/CharacterEditor.java
56 56
import org.eclipse.swt.widgets.Text;
57 57
import org.eclipse.ui.forms.widgets.FormToolkit;
58 58

  
59
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
60
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
61 59
import eu.etaxonomy.cdm.api.service.ITermNodeService;
62 60
import eu.etaxonomy.cdm.api.service.ITermTreeService;
63 61
import eu.etaxonomy.cdm.api.service.IVocabularyService;
......
114 112
 * @author pplitzner
115 113
 * @date 24.05.2017
116 114
 */
117
public class CharacterEditor implements ICharacterEditor, IConversationEnabled, ISelectionChangedListener,
115
public class CharacterEditor implements ICharacterEditor, ISelectionChangedListener,
118 116
        ModifyListener, IE4ViewerPart, IPartContentHasDetails, IPartContentHasSupplementalData,
119 117
        IDirtyMarkable, IE4SavablePart {
120 118

  
......
130 128
    @Inject
131 129
    private MDirtyable dirty;
132 130

  
133
    private ConversationHolder conversation;
134

  
135 131
    private ICdmEntitySession cdmEntitySession;
136 132

  
137 133
    private TermVocabulary vocabulary;
......
155 151
    @PostConstruct
156 152
    public void createControls(Composite parent, EMenuService menuService ) {
157 153
        if (CdmStore.isActive()){
158
            if(conversation == null){
159
                conversation = CdmStore.createConversation();
160
            }
154
//            if(conversation == null){
155
//                conversation = CdmStore.createConversation();
156
//            }
161 157
            if(cdmEntitySession==null){
162 158
                cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
163 159
            }
......
422 418
        if(characterTreeEditorComposite!=null){
423 419
            characterTreeEditorComposite.getViewer().getControl().setFocus();
424 420
        }
425
        if(conversation!=null && !conversation.isBound()){
426
            conversation.bind();
427
        }
428 421
        if(cdmEntitySession != null) {
429 422
            cdmEntitySession.bind();
430 423
        }
......
486 479
    @Override
487 480
    @Persist
488 481
    public void save(IProgressMonitor monitor){
489
        if (!conversation.isBound()) {
490
            conversation.bind();
491
        }
482
        
492 483
        UpdateResult result = new UpdateResult();
493 484
        if (nodesToSave != null && this.getVocabulary() != null) {
494 485
            result.includeResult(CdmStore.getService(ITermNodeService.class).saveNewCharacterNodeDtoMap(this.nodesToSave, this.getVocabulary().getUuid()));
......
507 498
        result.includeResult(CdmStore.getService(ITermNodeService.class).saveCharacterNodeDtoList(this.nodesToUpdate));
508 499
        nodesToUpdate.clear();
509 500
        // commit the conversation and start a new transaction immediately
510
        conversation.commit(true);
501
        //conversation.commit(true);
511 502
        if (result.getUpdatedObjects() != null && !result.getUpdatedObjects().isEmpty()){
512 503
            Object o = result.getUpdatedObjects().iterator().next();
513 504
            if (o instanceof TermNode){
......
538 529

  
539 530
    @PreDestroy
540 531
    public void dispose(){
541
        if(conversation!=null){
542
            conversation.close();
543
            conversation = null;
544
        }
532
       
545 533
        if(cdmEntitySession != null) {
546 534
            cdmEntitySession.dispose();
547 535
            cdmEntitySession = null;
......
592 580

  
593 581
    @Focus
594 582
    public void setFocus() {
595
        if(conversation!=null && !conversation.isBound()){
596
            conversation.bind();
597
        }
583
       
598 584
    }
599 585

  
600 586
    @Override
......
675 661
        }
676 662
    }
677 663

  
678
    @Override
679
    public void update(CdmDataChangeMap arg0) {
680
    }
681

  
682
    @Override
683
    public ConversationHolder getConversationHolder() {
684
        return conversation;
685
    }
664
    
686 665

  
687 666
    @Override
688 667
    public void changed(Object element) {

Also available in: Unified diff