Revision c9285745
Added by Cherian Mathew almost 9 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostOperation.java | ||
---|---|---|
16 | 16 |
|
17 | 17 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
18 | 18 |
import eu.etaxonomy.cdm.model.common.ICdmBase; |
19 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
|
19 | 20 |
|
20 | 21 |
/** |
21 | 22 |
* @author pplitzner |
... | ... | |
35 | 36 |
*/ |
36 | 37 |
protected IPostOperationEnabled postOperationEnabled; |
37 | 38 |
|
39 |
private ICdmEntitySessionEnabled cdmEntitySessionEnabled; |
|
40 |
|
|
38 | 41 |
|
39 | 42 |
/** |
40 | 43 |
* <p>Constructor for AbstractPostOperation.</p> |
... | ... | |
71 | 74 |
this.postOperationEnabled = postOperationEnabled; |
72 | 75 |
} |
73 | 76 |
|
77 |
public AbstractPostOperation(String label, IUndoContext undoContext, |
|
78 |
T element, IPostOperationEnabled postOperationEnabled, |
|
79 |
ICdmEntitySessionEnabled cdmEntitySessionEnabled) { |
|
80 |
this(label, undoContext); |
|
81 |
this.element = element; |
|
82 |
this.postOperationEnabled = postOperationEnabled; |
|
83 |
this.cdmEntitySessionEnabled = cdmEntitySessionEnabled; |
|
84 |
} |
|
85 |
|
|
74 | 86 |
/** |
75 | 87 |
* This method will try to call the post operation on a possibly registered |
76 | 88 |
* IPostOperationEnabled implementor. Objects that were affected by the operation |
... | ... | |
80 | 92 |
* @return a {@link org.eclipse.core.runtime.IStatus} object. |
81 | 93 |
*/ |
82 | 94 |
protected IStatus postExecute(CdmBase objectAffectedByOperation) { |
83 |
if(postOperationEnabled != null){ |
|
84 |
return postOperationEnabled.postOperation(objectAffectedByOperation) ? Status.OK_STATUS : Status.CANCEL_STATUS; |
|
85 |
} |
|
86 |
return Status.OK_STATUS; |
|
95 |
|
|
96 |
if(postOperationEnabled != null){ |
|
97 |
return postOperationEnabled.postOperation(objectAffectedByOperation) ? Status.OK_STATUS : Status.CANCEL_STATUS; |
|
98 |
} |
|
99 |
return Status.OK_STATUS; |
|
87 | 100 |
} |
88 | 101 |
|
89 | 102 |
/** |
... | ... | |
92 | 105 |
* @return a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. |
93 | 106 |
*/ |
94 | 107 |
public IPostOperationEnabled getPostOperationEnabled() { |
95 |
return postOperationEnabled; |
|
108 |
return postOperationEnabled; |
|
109 |
} |
|
110 |
|
|
111 |
// protected IStatus updateSession(CdmBase clientObjectAffectedByOperation, UpdateResult updateResult) { |
|
112 |
// Set<CdmBase> affectedObjects; |
|
113 |
// if(updateResult == null) { |
|
114 |
// affectedObjects = new HashSet<CdmBase>(); |
|
115 |
// } else { |
|
116 |
// affectedObjects = updateResult.getUpdatedObjects(); |
|
117 |
// } |
|
118 |
// |
|
119 |
// if(cdmEntitySessionEnabled != null) { |
|
120 |
// cdmEntitySessionEnabled.getCdmEntitySession().update(clientObjectAffectedByOperation, affectedObjects); |
|
121 |
// } |
|
122 |
// return Status.OK_STATUS; |
|
123 |
// } |
|
124 |
// |
|
125 |
// protected IStatus updateSession(UUID uuid) { |
|
126 |
// |
|
127 |
// if(cdmEntitySessionEnabled != null) { |
|
128 |
// CdmBase cdmBase = cdmEntitySessionEnabled.getCdmEntitySession().remoteLoad(CdmStore.getService(IService.class),uuid); |
|
129 |
// cdmEntitySessionEnabled.getCdmEntitySession().update(null, cdmBase); |
|
130 |
// } |
|
131 |
// return Status.OK_STATUS; |
|
132 |
// } |
|
133 |
|
|
134 |
public ICdmEntitySessionEnabled getCdmEntitySessionEnabled() { |
|
135 |
return cdmEntitySessionEnabled; |
|
96 | 136 |
} |
97 | 137 |
|
98 | 138 |
} |
Also available in: Unified diff
InspectSessionsDialog : added filtering
CdmStore : clearing caches and session before connecting
ParseHandler : using NonViralName instead of TaxonNameBase
AbstractPostTaxonOperation, AbstractPostOperation, AbstractPersistentPostOperation : added CdmEntitySessionEnabled object to constructor
NewTaxonNodeWizard : explicitly fire changes