DESCRIPTION

This class represents transitions in the system.

It is problematic because transitions will usually have a body of code that is part of the application.

In this example apply_body is called by Class::Workflow::Transition::Deterministic, and the implementation of apply_body is an abstract method. Every row in the table has a class column, and this class is expected to override apply_body. An example class, Foo::DB::Workflow::Transition::Null is provided and used in the test.

Other solutions towards implementing apply are of course also possible.

COLUMNS

state

The state that this transition belongs to. Class::Workflow::State.

This is actually used to implement the has_many in Class::Workflow::State. There is no restriction on the number of states a transition belongs to, so plausibly one transition could belong to many states.

to_state

Since this example is using Class::Workflow::Transition::Deterministic we also know the state this transition will lead to in advance.

This is just an example and of course you could just search the states resultset for the state the transition will lead to if the target state is dynamically deduced.

class

The class to rebless the row object to.

METHODS

apply_body

Used by Class::Workflow::Transition::Deterministic.

new

has a hook to rebless into the class column's value.