Package com.yworkflow.definition.model
Record Class FunctionContext
java.lang.Object
java.lang.Record
com.yworkflow.definition.model.FunctionContext
- Record Components:
functionType- the type of function being executedoriginId- the ID of the origin element (state, destination, etc.)transitionId- the ID of the transition being executed
public record FunctionContext(FunctionType functionType, DestinationId originId, TransitionId transitionId)
extends Record
Represents the context in which a workflow function is executed. FunctionContext provides
information about the execution environment, including the function type, origin ID, and
transition ID, which helps functions understand their execution context.
FunctionContext is used by the workflow engine to provide functions with contextual information about when and where they are being executed. This allows functions to adapt their behavior based on the execution context and make informed decisions about their operations.
FunctionContext supports various execution contexts:
- State Functions - Pre- or Post-state execution
- Transition Functions - Pre/post transition execution
- Result Functions - Pre/post result execution
- Trigger Functions - Event-driven execution
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFunctionContext(FunctionType functionType, DestinationId originId, TransitionId transitionId) Creates an instance of aFunctionContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of thefunctionTyperecord component.final inthashCode()Returns a hash code value for this object.originId()Returns the value of theoriginIdrecord component.static FunctionContextpostCommonTransition(StateId stateId, TransitionId transitionId) Creates a function context for post-common transition execution.static FunctionContextpostConditionalResult(DestinationId originId, TransitionId transitionId) Creates a function context for post-conditional result execution.static FunctionContextpostDefaultResult(DestinationId destinationId, TransitionId transitionId) Creates a function context for post-default result execution.static FunctionContextpostGlobalTransition(TransitionId transitionId) Creates a function context for post-global transition execution.static FunctionContextpostInitialTransition(TransitionId transitionId) Creates a function context for post-initial transition execution.static FunctionContextCreates a function context for post-state execution.static FunctionContextpostStateTransition(StateId stateId, TransitionId transitionId) Creates a function context for post-state transition execution.static FunctionContextpreCommonTransition(StateId stateId, TransitionId transitionId) Creates a function context for pre-common transition execution.static FunctionContextpreConditionalResult(DestinationId originId, TransitionId transitionId) Creates a function context for pre-conditional result execution.static FunctionContextpreDefaultResult(DestinationId destinationId, TransitionId transitionId) Creates a function context for pre-default result execution.static FunctionContextpreGlobalTransition(TransitionId transitionId) Creates a function context for pre-global transition execution.static FunctionContextpreInitialTransition(TransitionId transitionId) Creates a function context for pre-initial transition execution.static FunctionContextCreates a function context for pre-state execution.static FunctionContextpreStateTransition(StateId stateId, TransitionId transitionId) Creates a function context for pre-state transition execution.final StringtoString()Returns a string representation of this record class.Returns the value of thetransitionIdrecord component.static FunctionContexttrigger()Creates a function context for trigger execution.withOriginId(DestinationId originId) Creates a new FunctionContext with the specified origin ID.withTransitionId(TransitionId transitionId) Creates a new FunctionContext with the specified transition ID.
-
Constructor Details
-
FunctionContext
public FunctionContext(FunctionType functionType, DestinationId originId, TransitionId transitionId) Creates an instance of aFunctionContextrecord class.- Parameters:
functionType- the value for thefunctionTyperecord componentoriginId- the value for theoriginIdrecord componenttransitionId- the value for thetransitionIdrecord component
-
-
Method Details
-
preState
Creates a function context for pre-state execution.- Parameters:
stateId- the state ID- Returns:
- a new FunctionContext for pre-state execution
-
postState
Creates a function context for post-state execution.- Parameters:
stateId- the state ID- Returns:
- a new FunctionContext for post-state execution
-
trigger
Creates a function context for trigger execution.- Returns:
- a new FunctionContext for trigger execution
-
preStateTransition
Creates a function context for pre-state transition execution.- Parameters:
stateId- the state IDtransitionId- the transition ID- Returns:
- a new FunctionContext for pre-state transition execution
-
postStateTransition
Creates a function context for post-state transition execution.- Parameters:
stateId- the state IDtransitionId- the transition ID- Returns:
- a new FunctionContext for post-state transition execution
-
preInitialTransition
Creates a function context for pre-initial transition execution.- Parameters:
transitionId- the transition ID- Returns:
- a new FunctionContext for pre-initial transition execution
-
postInitialTransition
Creates a function context for post-initial transition execution.- Parameters:
transitionId- the transition ID- Returns:
- a new FunctionContext for post-initial transition execution
-
preGlobalTransition
Creates a function context for pre-global transition execution.- Parameters:
transitionId- the transition ID- Returns:
- a new FunctionContext for pre-global transition execution
-
postGlobalTransition
Creates a function context for post-global transition execution.- Parameters:
transitionId- the transition ID- Returns:
- a new FunctionContext for post-global transition execution
-
preCommonTransition
Creates a function context for pre-common transition execution.- Parameters:
stateId- the state IDtransitionId- the transition ID- Returns:
- a new FunctionContext for pre-common transition execution
-
postCommonTransition
Creates a function context for post-common transition execution.- Parameters:
stateId- the state IDtransitionId- the transition ID- Returns:
- a new FunctionContext for post-common transition execution
-
preDefaultResult
public static FunctionContext preDefaultResult(DestinationId destinationId, TransitionId transitionId) Creates a function context for pre-default result execution.- Parameters:
destinationId- the destination IDtransitionId- the transition ID- Returns:
- a new FunctionContext for pre-default result execution
-
postDefaultResult
public static FunctionContext postDefaultResult(DestinationId destinationId, TransitionId transitionId) Creates a function context for post-default result execution.- Parameters:
destinationId- the destination IDtransitionId- the transition ID- Returns:
- a new FunctionContext for post-default result execution
-
preConditionalResult
public static FunctionContext preConditionalResult(DestinationId originId, TransitionId transitionId) Creates a function context for pre-conditional result execution.- Parameters:
originId- the origin IDtransitionId- the transition ID- Returns:
- a new FunctionContext for pre-conditional result execution
-
postConditionalResult
public static FunctionContext postConditionalResult(DestinationId originId, TransitionId transitionId) Creates a function context for post-conditional result execution.- Parameters:
originId- the origin IDtransitionId- the transition ID- Returns:
- a new FunctionContext for post-conditional result execution
-
withOriginId
Creates a new FunctionContext with the specified origin ID.- Parameters:
originId- the new origin ID- Returns:
- a new FunctionContext with the specified origin ID
-
withTransitionId
Creates a new FunctionContext with the specified transition ID.- Parameters:
transitionId- the new transition ID- Returns:
- a new FunctionContext with the specified transition ID
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
functionType
Returns the value of thefunctionTyperecord component.- Returns:
- the value of the
functionTyperecord component
-
originId
Returns the value of theoriginIdrecord component.- Returns:
- the value of the
originIdrecord component
-
transitionId
Returns the value of thetransitionIdrecord component.- Returns:
- the value of the
transitionIdrecord component
-