- extracted super class from AbstractPostOperation (same name)
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / operation / AbstractPostOperation.java
1 // $Id$
2 /**
3 * Copyright (C) 2013 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10 package eu.etaxonomy.taxeditor.operation;
11
12 import org.eclipse.core.commands.operations.AbstractOperation;
13 import org.eclipse.core.runtime.IStatus;
14 import org.eclipse.core.runtime.Status;
15
16 import eu.etaxonomy.cdm.model.common.CdmBase;
17
18 /**
19 * @author pplitzner
20 * @date 03.12.2013
21 *
22 */
23 public abstract class AbstractPostOperation extends AbstractOperation {
24
25 /**
26 *
27 */
28 protected IPostOperationEnabled postOperationEnabled;
29
30 /**
31 * @param label
32 */
33 public AbstractPostOperation(String label) {
34 super(label);
35 }
36
37 /**
38 * This method will try to call the post operation on a possibly registered
39 * IPostOperationEnabled implementor. Objects that were affected by the operation
40 * may be passed to the registered IPostOperationEnabled implementor.
41 *
42 * @param objectAffectedByOperation the affected object. Should be <code>null</code> if not needed
43 * @return a {@link org.eclipse.core.runtime.IStatus} object.
44 */
45 protected IStatus postExecute(CdmBase objectAffectedByOperation) {
46 if(postOperationEnabled != null){
47 return postOperationEnabled.postOperation(objectAffectedByOperation) ? Status.OK_STATUS : Status.CANCEL_STATUS;
48 }
49 return Status.OK_STATUS;
50 }
51
52 /**
53 * <p>Getter for the field <code>postOperationEnabled</code>.</p>
54 *
55 * @return a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
56 */
57 public IPostOperationEnabled getPostOperationEnabled() {
58 return postOperationEnabled;
59 }
60
61 }