class IllegalEventType(EventType): # Event type with non valid auto transition event CREATED = event_info() ASSIGNED = event_info( follows=event("CREATED"), auto_transition=True, ) SCHEDULED = event_info( follows=event("CREATED"), auto_transition=True, )
class SimpleTestObjectEventType(EventType): CREATED = event_info( follows=nothing(), accumulate=keep(), ) READY = event_info( follows=event("CREATED"), accumulate=keep(), ) DONE = event_info( follows=event("READY"), accumulate=keep(), )
class OrderEventType(EventType): """ Order event type. Models the user journey through specifying an order for a pizza as described here: https://globality.atlassian.net/wiki/spaces/GLOB/pages/917733426/Product+Spec+Ordering+a+Pizza """ # NB: Our state machines always start with an initial event OrderInitialized = event_info(follows=nothing(), ) PizzaCreated = event_info(follows=any_of( "OrderInitialized", "PizzaCustomizationFinished", ), ) PizzaToppingAdded = event_info(follows=any_of( "PizzaCreated", "PizzaToppingAdded", ), ) PizzaCustomizationFinished = event_info(follows=any_of( "PizzaToppingAdded", ), ) OrderDeliveryDetailsAdded = event_info( follows=event("PizzaCustomizationFinished"), ) OrderSubmitted = event_info(follows=event("OrderDeliveryDetailsAdded"), ) OrderSatisfied = event_info(follows=event("OrderSubmitted"), ) OrderFulfilled = event_info(follows=event("OrderSubmitted"), )
class AdvancedTaskEventType(Enum): REASSIGNED = event_info( follows=event("STARTED"), accumulate=keep(), requires=["assignee"], ) RESCHEDULED = event_info( follows=event("STARTED"), accumulate=keep(), requires=["deadline"], ) REVISED = event_info( follows=any_of("CREATED", "STARTED"), accumulate=alias("CREATED"), restarting=True, )
class CustomerEventType(EventType): CustomerStartedOrder = event_info(follows=nothing(), requires=["order_id"]) CustomerStartedPizza = event_info(follows=any_of("CustomerStartedOrder", "CustomerFinalizedPizza"), requires=[ "pizza_id", ]) CustomerChosePizzaType = event_info(follows=any_of("CustomerStartedPizza"), requires=[ "pizza_type", "pizza_size", ]) CustomerAddedTopping = event_info(follows=any_of("CustomerChosePizzaType"), requires=[ "topping_type", ]) CustomerFinalizedPizza = event_info(follows=any_of( "CustomerChosePizzaType", "CustomerAddedTopping", ), )
class BasicTaskEventType(EventType): CREATED = event_info(follows=nothing(), ) ASSIGNED = event_info( follows=all_of("CREATED", but_not("ASSIGNED")), accumulate=union(), requires=["assignee"], ) SCHEDULED = event_info( follows=all_of("CREATED", but_not("SCHEDULED")), accumulate=union(), requires=["deadline"], ) STARTED = event_info(follows=all_of("ASSIGNED", "SCHEDULED"), ) CANCELED = event_info(follows=event("STARTED"), ) COMPLETED = event_info(follows=event("STARTED"), ) ENDED = event_info( follows=event("COMPLETED"), auto_transition=True, )
class FlexibleTaskEventType(EventType): # Used to test is_initial CREATED = event_info(follows=any_of( "CREATED", nothing(), ), )
class ActivityEventType(EventType): CREATED = event_info(follows=nothing(), ) CANCELED = event_info(follows=event("CREATED"), )