Class WorkflowOperationInstance

java.lang.Object
org.opencastproject.workflow.api.WorkflowOperationInstance
All Implemented Interfaces:
Configurable

@Entity(name="WorkflowOperationInstance") public class WorkflowOperationInstance extends Object implements Configurable
A workflow operation belonging to a workflow instance.
  • Field Details

    • template

      protected String template
    • jobId

      protected Long jobId
    • state

    • description

      protected String description
    • configurations

      protected Map<String,String> configurations
    • failOnError

      protected boolean failOnError
    • executeCondition

      protected String executeCondition
    • exceptionHandlingWorkflow

      protected String exceptionHandlingWorkflow
    • abortable

      protected Boolean abortable
    • continuable

      protected Boolean continuable
    • dateStarted

      protected Date dateStarted
    • dateCompleted

      protected Date dateCompleted
    • timeInQueue

      protected Long timeInQueue
    • maxAttempts

      protected int maxAttempts
    • failedAttempts

      protected int failedAttempts
    • executionHost

      protected String executionHost
    • retryStrategy

      protected RetryStrategy retryStrategy
  • Constructor Details

    • WorkflowOperationInstance

      public WorkflowOperationInstance()
      No-arg constructor needed for JAXB serialization
    • WorkflowOperationInstance

      public WorkflowOperationInstance(WorkflowOperationDefinition def)
      Builds a new workflow operation instance based on another workflow operation.
      Parameters:
      def - the workflow definition
    • WorkflowOperationInstance

      public WorkflowOperationInstance(String id, WorkflowOperationInstance.OperationState state)
      Constructs a new operation instance with the given id and initial state.
      Parameters:
      id - the operation id
      state - the state
    • WorkflowOperationInstance

      public WorkflowOperationInstance(String template, Long jobId, WorkflowOperationInstance.OperationState state, String description, Map<String,String> configurations, boolean failOnError, String executeCondition, String exceptionHandlingWorkflow, Boolean abortable, Boolean continuable, Date dateStarted, Date dateCompleted, Long timeInQueue, int maxAttempts, int failedAttempts, String executionHost, RetryStrategy retryStrategy)
  • Method Details

    • setTemplate

      public void setTemplate(String template)
      Sets the template
      Parameters:
      template - the template
    • getTemplate

      public String getTemplate()
      Gets the operation type.
      Returns:
      the operation type
    • getId

      public Long getId()
      Gets the unique identifier for this operation, or null.
      Returns:
      the identifier, or null if this operation has not yet run
    • setId

      public void setId(Long jobId)
      Sets the unique identifier for this operation.
      Parameters:
      jobId - the identifier
    • getDescription

      public String getDescription()
      Gets the operation description
      Returns:
      the description
    • setDescription

      public void setDescription(String description)
      Set the operation description.
      Parameters:
      description - The new description
    • getState

      The state of this operation.
    • setState

      public void setState(WorkflowOperationInstance.OperationState state)
      Sets the state of this operation
      Parameters:
      state - the state to set
    • getConfigurations

      public Map<String,String> getConfigurations()
      Return configuration of this workflow operation as Map. Guaranteed to be not null
      Returns:
      Configuration map
    • getConfiguration

      public String getConfiguration(String key)
      Returns the value of property name or null if no such property has been set.
      Specified by:
      getConfiguration in interface Configurable
      Parameters:
      key - the configuration key
      Returns:
      the configuration value
      See Also:
    • removeConfiguration

      public void removeConfiguration(String key)
      Removes the key configuration.
      Specified by:
      removeConfiguration in interface Configurable
      Parameters:
      key - the configuration key
      See Also:
    • setConfiguration

      public void setConfiguration(String key, String value)
      Sets the configuration with name key to value value, or adds it if it doesn't already exist.
      Specified by:
      setConfiguration in interface Configurable
      Parameters:
      key - the configuration key
      value - the configuration value
      See Also:
    • getConfigurationKeys

      public Set<String> getConfigurationKeys()
      Gets the configuration keys that are currently set for this configurable entity.
      Specified by:
      getConfigurationKeys in interface Configurable
      Returns:
      the configuration keys
      See Also:
    • getExceptionHandlingWorkflow

      public String getExceptionHandlingWorkflow()
      The workflow to run if an exception is thrown while this operation is running.
    • setExceptionHandlingWorkflow

      public void setExceptionHandlingWorkflow(String exceptionHandlingWorkflow)
    • isFailOnError

      public boolean isFailOnError()
      If true, this workflow will be put into a failed (or failing, if getExceptionHandlingWorkflow() is not null) state when exceptions are thrown during an operation.
    • setFailOnError

      public void setFailOnError(boolean failOnError)
    • getDateStarted

      public Date getDateStarted()
      The timestamp this operation started. If the job was queued, this can be significantly later than the date created.
    • getTimeInQueue

      public Long getTimeInQueue()
      The number of milliseconds this operation waited in a service queue
    • setTimeInQueue

      public void setTimeInQueue(long timeInQueue)
    • getDateCompleted

      public Date getDateCompleted()
      The timestamp this operation completed
    • getExecutionCondition

      public String getExecutionCondition()
      Returns either null or true to have the operation executed. Any other value is interpreted as false and will skip the operation.

      Usually, this will be a variable name such as ${foo}, which will be replaced with its acutal value once the workflow is executed.

      If both getExecuteCondition() and getSkipCondition return a non-null value, the execute condition takes precedence.

      Returns:
      the execution condition.
    • setExecutionCondition

      public void setExecutionCondition(String condition)
    • isContinuable

      public Boolean isContinuable()
      Returns true if this operation can be continued by the user from an optional hold state. A return value of null indicates that this operation instance does not have a hold state.
      Returns:
      true if this operation instance is continuable
    • setContinuable

      public void setContinuable(Boolean continuable)
      Defines whether this operation instance should be continuable from a hold state or whether it is resumed automatically.
      Parameters:
      continuable - true to allow the user to resume the operation
    • isAbortable

      public Boolean isAbortable()
      Returns true if this operation can be aborted by the user from an optional hold state. If a resumable operation is aborted from its hold state, the workflow is put into WorkflowInstance.WorkflowState.STOPPED. A return value of null indicates that this operation instance does not have a hold state.
      Returns:
      true if this operation instance is abortable
    • setAbortable

      public void setAbortable(Boolean abortable)
      Defines whether this operation instance should be abortable from a hold state.
      Parameters:
      abortable - true to allow the user to cancel the operation
    • getRetryStrategy

      public RetryStrategy getRetryStrategy()
      Return the strategy to use in case of operation failure
      Returns:
      a strategy from RetryStrategy.
    • getMaxAttempts

      public int getMaxAttempts()
      Returns the number of attempts the workflow service will make to execute this operation.
      Returns:
      the maximum number of retries before failing
    • getFailedAttempts

      public int getFailedAttempts()
      Returns the number of failed executions that have previously been attempted.
      Returns:
      the number of previous attempts
    • setFailedAttempts

      public void setFailedAttempts(int failedAttempts)
    • getExecutionHost

      public String getExecutionHost()
      Returns the current execution host
      Returns:
      the execution host
    • setExecutionHost

      public void setExecutionHost(String executionHost)
      Sets the current execution host
      Parameters:
      executionHost - the execution host
    • getWorkflowInstance

      public WorkflowInstance getWorkflowInstance()
    • setWorkflowInstance

      public void setWorkflowInstance(WorkflowInstance instance)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also: