New interface will be added for the custom actions
Code Block language java /** * Defines a custom action in the Workflow. */ public interface CustomAction extends ProgramLifecycle<CustomActionContext> { /** * Configure a custom Workflow action. */ void configure(CustomActionConfigurer configurer); /** * @throws Exception */ void run() throws Exception; }
Custom actions will now receive the CustomActionContext.
Code Block language java /** * Context used by action running in the Workflow. */ public interface CustomActionContext extends RuntimeContext, Transactional, PluginContext, WorkflowInfoProvider { /** * Return the specification of the Workflow that started this action */ WorkflowSpecification getWorkflowSpecification(); /** * Return the specification of the custom Action. */ CustomActionSpecification getSpecification(); /** * Return the logical start time of the Workflow */ long getLogicalStartTime(); /** * @return a {@link WorkflowToken} */ WorkflowToken getToken(); /** * Return true if the executionstate of the custom action is successful, false otherwise. This method can be * used from {@link AbstractCustomAction#destroy} to determine the status of the * {@link CustomAction}. */ @Beta boolean isSuccessfulProgramState getState(); }
AbstractCustomAction can implement the CustomAction interface.
Code Block language java public abstract class AbstractCustomAction implements CustomAction { private CustomActionContext context; @Override public void initialize(CustomActionContext context) throws Exception { this.context = context; } protected final CustomActionContext getContext() { return context; } }
WorkflowConfigurer will allow adding the CustomAction as
Code Block language java // Adds a CustomAction to the Workflow. void addAction(CustomAction customAction);
We will deprecate following classes:
Deprecated Class New Class Description WorkflowAction CustomAction Represents the action that is running as a part of the Workflow. AbstractWorkflowAction AbstractCustomAction Default implementation for the custom actions in the Workflow. WorkflowActionConfigurer CustomActionConfigurer Configurer for the actions in the Workflow. WorkflowActionSpecification CustomActionSpecification Specifications for the custom action