Package com.yworkflow.definition.model
Interface Function
- All Superinterfaces:
CanCopy<Function>,HasId<String>,HasParent<Function,,Model<?, ?>> Model<Function,,String> OriginAware<Function>,TransitionAware<Function>,Validatable
public interface Function
extends Model<Function,String>, HasParent<Function,Model<?,?>>, OriginAware<Function>, TransitionAware<Function>
Represents a function that can be executed during workflow transitions. Functions are the primary
mechanism for implementing custom business logic in workflows, such as sending notifications,
updating databases, or performing calculations.
- Since:
- 1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(WorkflowExecutionContext context) Executes this function with the provided attributes.getArgs()Returns the arguments for this function.Returns the function context that defines the execution environment and capabilities of this function.getName()Returns the human-readable name of this function.getType()Returns the type of this function.getValue()Returns the value of this function.withFunctionContext(FunctionContext functionContext) Creates a new Function instance with the specified function context.Creates a new Function instance with the specified ID.Methods inherited from interface com.yworkflow.definition.model.base.HasParent
withParentMethods inherited from interface com.yworkflow.definition.model.base.Model
getExtensions, getParent, getProperties, getPropertyDifferenceMethods inherited from interface com.yworkflow.definition.model.update.OriginAware
withOriginIdMethods inherited from interface com.yworkflow.definition.model.update.TransitionAware
withTransitionIdMethods inherited from interface com.yworkflow.definition.model.validation.Validatable
validate
-
Method Details
-
execute
Executes this function with the provided attributes. The function has access to all workflow attributes and can modify the workflow state as needed.- Parameters:
context- the execution context- Throws:
WorkflowException- if the function execution fails
-
withId
Creates a new Function instance with the specified ID.- Parameters:
id- the new ID for the function- Returns:
- a new Function instance with the specified ID
-
withFunctionContext
Creates a new Function instance with the specified function context.- Parameters:
functionContext- the new function context- Returns:
- a new Function instance with the specified context
-
getType
String getType()Returns the type of this function. The type identifies the category or class of the function (e.g., "email", "database", "custom").- Returns:
- the function type
-
getValue
String getValue()Returns the value of this function. The value identifies the specific function within the type (e.g., "send", "query", "functionId").- Returns:
- the function value
-
getArgs
Attributes getArgs()Returns the arguments for this function. Arguments configure the behavior of the function and are passed to the function during execution.- Returns:
- the function arguments
-
getName
String getName()Returns the human-readable name of this function.- Returns:
- the function name
-
getFunctionType
FunctionContext getFunctionType()Returns the function context that defines the execution environment and capabilities of this function.- Returns:
- the function context
-