Class WorkflowExecutionContext

    • Method Detail

      • beforeTaskStart

        public void beforeTaskStart​(Object triggerData,
                                    IWorkflowEventData eventData,
                                    WorkflowTask task,
                                    WorkflowTrigger trigger)
        Invoked internally before a task is about to be executed.
        Parameters:
        triggerData - Data made available by the trigger.
        eventData - Event data that was triggered.
        task - Task about to be executed.
        trigger - Trigger that was triggered.
      • createExecutionException

        public WorkflowTaskExecutionException createExecutionException​(String message,
                                                                       com.google.common.collect.ImmutableList<Long> tasks,
                                                                       Exception cause,
                                                                       boolean handled)
        Should be called after the task was executed completely and threw an exception. Returns the exception that should be rethrown.
        Parameters:
        message - Message for the exception.
        tasks - List of tasks that were executed when the exception was obtained.
        cause - Exception that caused the task to fail.
        handled - Whether the error is or was handled in some way.
        Returns:
        The exception for the task's execution.
      • createExecutionSuccessResult

        public ITaskExecutionSuccessResult createExecutionSuccessResult​(com.google.common.collect.ImmutableList<Long> tasks)
                                                                 throws WorkflowTaskExecutionException
        Should be called after the task was executed completely. Returns the result of the task's execution.
        Parameters:
        tasks - A list of tasks that were executed for this result.
        Returns:
        The result of the task's execution.
        Throws:
        WorkflowTaskExecutionException - When the result could not be created.
      • createFinalResult

        public ITaskExecutionResult createFinalResult​(List<ITaskExecutionResult> individualResults)
        Internal method called after the list of tasks were executed. Creates the main result of the execution (i.e. combines all individual results).
        Parameters:
        individualResults - Individual results of each task.
        Returns:
        The main combined result for the task list execution.
      • file

        public IWorkflowFileHandler file()
        Specified by:
        file in interface IWorkflowExecutionContext
        Returns:
        The file handler for interacting with files and the file system. Use this to create temporary files, to read files created by other workflow elements, or to attach files to the form record.
      • getDefaultSystemState

        public EWorkflowStateType getDefaultSystemState()
        Returns:
        The default system state to set, for internal use.
      • getEnvironmentData

        public de.xima.fc.workflow.processor.logic.execution.WorkflowExecutionEnvironmentData getEnvironmentData()
        Returns:
        The environment data implementation for internal use.
      • getFileHandler

        public de.xima.fc.workflow.processor.logic.execution.WorkflowFileHandler getFileHandler()
        Returns:
        The file handler implementation for internal use.
      • getFormHandler

        public de.xima.fc.workflow.processor.logic.execution.WorkflowFormHandler getFormHandler()
        Returns:
        The form handler implementation for internal use.
      • getHttpHandler

        public de.xima.fc.workflow.processor.logic.execution.WorkflowHttpHandler getHttpHandler()
        Returns:
        The HTTP handler implementation for internal use.
      • getLimitsHandler

        public de.xima.fc.workflow.processor.logic.execution.WorkflowLimitsHandler getLimitsHandler()
        Returns:
        The limits handler implementation for internal use.
      • getLoggingHandler

        public de.xima.fc.workflow.processor.logic.execution.WorkflowLoggingHandler getLoggingHandler()
        Returns:
        The logging handler implementation for internal use.
      • getNodeLocator

        public de.xima.fc.workflow.processor.logic.execution.WorkflowNodeLocator getNodeLocator()
        Returns:
        The node locator implementation for internal use.
      • getPlaceholderHandler

        public de.xima.fc.workflow.processor.logic.execution.WorkflowPlaceholderHandler getPlaceholderHandler()
        Returns:
        The placeholder handler implementation for internal use.
      • getTaskQueue

        public TaskQueue getTaskQueue()
        Returns:
        All tasks that are scheduled to be executed. The last task in this queue Deque.pollLast() is the task that should be run next.
      • getVariableHandler

        public de.xima.fc.workflow.processor.logic.execution.WorkflowVariableHandler getVariableHandler()
        Returns:
        The variable handler implementation for internal use.
      • http

        public IWorkflowHttpHandler http()
        Specified by:
        http in interface IWorkflowExecutionContext
        Returns:
        The handler for interacting with the current HTTP request. It can be used, for example, to initiate redirects or read/write session parameters. If no HTTP request is currently active, this returns a dummy instance that takes no action.
      • isWasFormRecordDeleted

        public boolean isWasFormRecordDeleted()
        Returns:
        Whether the form record was deleted or not
      • markErrorEventTriggered

        public boolean markErrorEventTriggered()
        Sets the errorEventTriggered flag to true and returns the previous value of the flag.

        Internal method that keeps track of whether an error event was already triggered. When a task throws an unhandled exception, an error event is triggered that lets the user handle that exception globally by adding an error trigger to the workflow. When the task for that error trigger throws an unhandled exception, we end the workflow execution to prevent infinite loops.

        Returns:
        The previous value of the errorEventTriggered flag.
      • setCurrentEvent

        public void setCurrentEvent​(IWorkflowEventData eventData)
        Parameters:
        eventData - The event data of the task that is currently being executed. Internal-use only.
      • setCurrentTask

        public void setCurrentTask​(WorkflowTask task)
        Parameters:
        task - The task that is currently being executed. Internal-use only.