示例#1
0
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,
    )
示例#2
0
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(),
    )
示例#3
0
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"), )
示例#4
0
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,
    )
示例#5
0
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",
    ), )
示例#6
0
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,
    )
示例#7
0
class FlexibleTaskEventType(EventType):
    # Used to test is_initial
    CREATED = event_info(follows=any_of(
        "CREATED",
        nothing(),
    ), )
示例#8
0
class ActivityEventType(EventType):
    CREATED = event_info(follows=nothing(), )
    CANCELED = event_info(follows=event("CREATED"), )