-// $Id$
/**
* Copyright (C) 2013 EDIT
* European Distributed Institute of Taxonomy
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
/**
* @author pplitzner
*/
protected IPostOperationEnabled postOperationEnabled;
+ private ICdmEntitySessionEnabled cdmEntitySessionEnabled;
+
/**
* <p>Constructor for AbstractPostOperation.</p>
this.postOperationEnabled = postOperationEnabled;
}
+ public AbstractPostOperation(String label, IUndoContext undoContext,
+ T element, IPostOperationEnabled postOperationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ this(label, undoContext);
+ this.element = element;
+ this.postOperationEnabled = postOperationEnabled;
+ this.cdmEntitySessionEnabled = cdmEntitySessionEnabled;
+ }
+
/**
* This method will try to call the post operation on a possibly registered
* IPostOperationEnabled implementor. Objects that were affected by the operation
* @return a {@link org.eclipse.core.runtime.IStatus} object.
*/
protected IStatus postExecute(CdmBase objectAffectedByOperation) {
- if(postOperationEnabled != null){
- return postOperationEnabled.postOperation(objectAffectedByOperation) ? Status.OK_STATUS : Status.CANCEL_STATUS;
- }
- return Status.OK_STATUS;
+
+ if(postOperationEnabled != null){
+ return postOperationEnabled.postOperation(objectAffectedByOperation) ? Status.OK_STATUS : Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
}
/**
* @return a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
*/
public IPostOperationEnabled getPostOperationEnabled() {
- return postOperationEnabled;
+ return postOperationEnabled;
+ }
+
+// protected IStatus updateSession(CdmBase clientObjectAffectedByOperation, UpdateResult updateResult) {
+// Set<CdmBase> affectedObjects;
+// if(updateResult == null) {
+// affectedObjects = new HashSet<CdmBase>();
+// } else {
+// affectedObjects = updateResult.getUpdatedObjects();
+// }
+//
+// if(cdmEntitySessionEnabled != null) {
+// cdmEntitySessionEnabled.getCdmEntitySession().update(clientObjectAffectedByOperation, affectedObjects);
+// }
+// return Status.OK_STATUS;
+// }
+//
+// protected IStatus updateSession(UUID uuid) {
+//
+// if(cdmEntitySessionEnabled != null) {
+// CdmBase cdmBase = cdmEntitySessionEnabled.getCdmEntitySession().remoteLoad(CdmStore.getService(IService.class),uuid);
+// cdmEntitySessionEnabled.getCdmEntitySession().update(null, cdmBase);
+// }
+// return Status.OK_STATUS;
+// }
+
+ public ICdmEntitySessionEnabled getCdmEntitySessionEnabled() {
+ return cdmEntitySessionEnabled;
}
-}
\ No newline at end of file
+}