1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.operation;
|
11
|
|
12
|
import org.eclipse.core.commands.operations.IUndoContext;
|
13
|
import org.eclipse.core.runtime.IStatus;
|
14
|
|
15
|
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
|
16
|
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
|
17
|
|
18
|
/**
|
19
|
* Superclass for all operation that have to be committed imediately after execution.
|
20
|
*
|
21
|
* Note: You have to call the {@link #bind()} method in the {@link #execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)},
|
22
|
* {@link #undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)} and {@link #redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}
|
23
|
* methods so the correct persistence context gets bound.
|
24
|
*
|
25
|
* @author n.hoffmann
|
26
|
* @created 08.05.2009
|
27
|
* @version 1.0
|
28
|
*/
|
29
|
public abstract class AbstractPersistentPostOperation extends AbstractPostTaxonOperation {
|
30
|
protected TaxonNodeDto parentNode;
|
31
|
|
32
|
/**
|
33
|
* <p>Constructor for AbstractPersistentPostOperation.</p>
|
34
|
*
|
35
|
* @param label a {@link java.lang.String} object.
|
36
|
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
|
37
|
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
|
38
|
*/
|
39
|
protected AbstractPersistentPostOperation(String label, IUndoContext undoContext,
|
40
|
IPostOperationEnabled postOperationEnabled) {
|
41
|
this(label, undoContext, postOperationEnabled, null);
|
42
|
}
|
43
|
|
44
|
/**
|
45
|
* <p>Constructor for AbstractPersistentPostOperation.</p>
|
46
|
*
|
47
|
* @param label a {@link java.lang.String} object.
|
48
|
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
|
49
|
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
|
50
|
*/
|
51
|
protected AbstractPersistentPostOperation(String label, IUndoContext undoContext,
|
52
|
IPostOperationEnabled postOperationEnabled,
|
53
|
ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
|
54
|
super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
|
55
|
}
|
56
|
|
57
|
/**
|
58
|
* <p>Constructor for AbstractPersistentPostOperation.</p>
|
59
|
*
|
60
|
* @param label a {@link java.lang.String} object.
|
61
|
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
|
62
|
* @param taxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
|
63
|
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
|
64
|
*/
|
65
|
public AbstractPersistentPostOperation(String label,
|
66
|
IUndoContext undoContext, TaxonNodeDto taxonNode,
|
67
|
IPostOperationEnabled postOperationEnabled,
|
68
|
ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
|
69
|
super(label, undoContext, taxonNode, postOperationEnabled, cdmEntitySessionEnabled);
|
70
|
}
|
71
|
|
72
|
/**
|
73
|
* <p>Constructor for AbstractPersistentPostOperation.</p>
|
74
|
*
|
75
|
* @param label a {@link java.lang.String} object.
|
76
|
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
|
77
|
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
|
78
|
* @param parentNode a {@link eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode} object.
|
79
|
*/
|
80
|
public AbstractPersistentPostOperation(String label,
|
81
|
IUndoContext undoContext,
|
82
|
IPostOperationEnabled postOperationEnabled,
|
83
|
ICdmEntitySessionEnabled cdmEntitySessionEnabled, TaxonNodeDto parentNode) {
|
84
|
super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
|
85
|
this.parentNode = parentNode;
|
86
|
}
|
87
|
|
88
|
/* (non-Javadoc)
|
89
|
* @see eu.etaxonomy.taxeditor.operations.AbstractPostOperation#postExecute(eu.etaxonomy.cdm.model.common.CdmBase)
|
90
|
*/
|
91
|
/** {@inheritDoc} */
|
92
|
@Override
|
93
|
protected IStatus postExecute(Object objectAffectedByOperation) {
|
94
|
IStatus status = super.postExecute(objectAffectedByOperation);
|
95
|
return status;
|
96
|
}
|
97
|
|
98
|
/**
|
99
|
* Binds the conversation that was attached to this operation.
|
100
|
*/
|
101
|
public void bind(){
|
102
|
if(getCdmEntitySessionEnabled() != null && getCdmEntitySessionEnabled().getCdmEntitySession()!=null) {
|
103
|
getCdmEntitySessionEnabled().getCdmEntitySession().bind();
|
104
|
}
|
105
|
}
|
106
|
|
107
|
}
|