Package org.opencastproject.workflow.api
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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Booleanprotected Booleanprotected Dateprotected Dateprotected Stringprotected Stringprotected Stringprotected Stringprotected intprotected booleanprotected Longprotected intprotected RetryStrategyprotected WorkflowOperationInstance.OperationStateprotected Stringprotected Long -
Constructor Summary
ConstructorsConstructorDescriptionNo-arg constructor needed for JAXB serializationWorkflowOperationInstance(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) Constructs a new operation instance with the given id and initial state.Builds a new workflow operation instance based on another workflow operation. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetConfiguration(String key) Returns the value of propertynameornullif no such property has been set.Gets the configuration keys that are currently set for this configurable entity.Return configuration of this workflow operation as Map.The timestamp this operation completedThe timestamp this operation started.Gets the operation descriptionThe workflow to run if an exception is thrown while this operation is running.Returns eithernullortrueto have the operation executed.Returns the current execution hostintReturns the number of failed executions that have previously been attempted.getId()Gets the unique identifier for this operation, or null.intReturns the number of attempts the workflow service will make to execute this operation.Return the strategy to use in case of operation failuregetState()The state of this operation.Gets the operation type.The number of milliseconds this operation waited in a service queueinthashCode()Returnstrueif this operation can be aborted by the user from an optional hold state.Returnstrueif this operation can be continued by the user from an optional hold state.booleanIf true, this workflow will be put into a failed (or failing, if getExceptionHandlingWorkflow() is not null) state when exceptions are thrown during an operation.voidRemoves thekeyconfiguration.voidsetAbortable(Boolean abortable) Defines whether this operation instance should be abortable from a hold state.voidsetConfiguration(String key, String value) Sets the configuration with namekeyto valuevalue, or adds it if it doesn't already exist.voidsetContinuable(Boolean continuable) Defines whether this operation instance should be continuable from a hold state or whether it is resumed automatically.voidsetDescription(String description) Set the operation description.voidsetExceptionHandlingWorkflow(String exceptionHandlingWorkflow) voidsetExecutionCondition(String condition) voidsetExecutionHost(String executionHost) Sets the current execution hostvoidsetFailedAttempts(int failedAttempts) voidsetFailOnError(boolean failOnError) voidSets the unique identifier for this operation.voidSets the state of this operationvoidsetTemplate(String template) Sets the templatevoidsetTimeInQueue(long timeInQueue) voidsetWorkflowInstance(WorkflowInstance instance) toString()
-
Field Details
-
template
-
jobId
-
state
-
description
-
configurations
-
failOnError
protected boolean failOnError -
executeCondition
-
exceptionHandlingWorkflow
-
abortable
-
continuable
-
dateStarted
-
dateCompleted
-
timeInQueue
-
maxAttempts
protected int maxAttempts -
failedAttempts
protected int failedAttempts -
executionHost
-
retryStrategy
-
-
Constructor Details
-
WorkflowOperationInstance
public WorkflowOperationInstance()No-arg constructor needed for JAXB serialization -
WorkflowOperationInstance
Builds a new workflow operation instance based on another workflow operation.- Parameters:
def- the workflow definition
-
WorkflowOperationInstance
Constructs a new operation instance with the given id and initial state.- Parameters:
id- the operation idstate- 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
Sets the template- Parameters:
template- the template
-
getTemplate
Gets the operation type.- Returns:
- the operation type
-
getId
Gets the unique identifier for this operation, or null.- Returns:
- the identifier, or null if this operation has not yet run
-
setId
Sets the unique identifier for this operation.- Parameters:
jobId- the identifier
-
getDescription
Gets the operation description- Returns:
- the description
-
setDescription
Set the operation description.- Parameters:
description- The new description
-
getState
The state of this operation. -
setState
Sets the state of this operation- Parameters:
state- the state to set
-
getConfigurations
Return configuration of this workflow operation as Map. Guaranteed to be not null- Returns:
- Configuration map
-
getConfiguration
Returns the value of propertynameornullif no such property has been set.- Specified by:
getConfigurationin interfaceConfigurable- Parameters:
key- the configuration key- Returns:
- the configuration value
- See Also:
-
removeConfiguration
Removes thekeyconfiguration.- Specified by:
removeConfigurationin interfaceConfigurable- Parameters:
key- the configuration key- See Also:
-
setConfiguration
Sets the configuration with namekeyto valuevalue, or adds it if it doesn't already exist.- Specified by:
setConfigurationin interfaceConfigurable- Parameters:
key- the configuration keyvalue- the configuration value- See Also:
-
getConfigurationKeys
Gets the configuration keys that are currently set for this configurable entity.- Specified by:
getConfigurationKeysin interfaceConfigurable- Returns:
- the configuration keys
- See Also:
-
getExceptionHandlingWorkflow
The workflow to run if an exception is thrown while this operation is running. -
setExceptionHandlingWorkflow
-
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
The timestamp this operation started. If the job was queued, this can be significantly later than the date created. -
getTimeInQueue
The number of milliseconds this operation waited in a service queue -
setTimeInQueue
public void setTimeInQueue(long timeInQueue) -
getDateCompleted
The timestamp this operation completed -
getExecutionCondition
Returns eithernullortrueto have the operation executed. Any other value is interpreted asfalseand 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()andgetSkipConditionreturn a non-null value, the execute condition takes precedence.- Returns:
- the execution condition.
-
setExecutionCondition
-
isContinuable
Returnstrueif this operation can be continued by the user from an optional hold state. A return value ofnullindicates that this operation instance does not have a hold state.- Returns:
trueif this operation instance is continuable
-
setContinuable
Defines whether this operation instance should be continuable from a hold state or whether it is resumed automatically.- Parameters:
continuable-trueto allow the user to resume the operation
-
isAbortable
Returnstrueif 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 intoWorkflowInstance.WorkflowState.STOPPED. A return value ofnullindicates that this operation instance does not have a hold state.- Returns:
trueif this operation instance is abortable
-
setAbortable
Defines whether this operation instance should be abortable from a hold state.- Parameters:
abortable-trueto allow the user to cancel the operation
-
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
Returns the current execution host- Returns:
- the execution host
-
setExecutionHost
Sets the current execution host- Parameters:
executionHost- the execution host
-
getWorkflowInstance
-
setWorkflowInstance
-
hashCode
public int hashCode() -
equals
-
toString
-