Exemplo n.º 1
0
class OrderFlow(Flow):
    """
    Acceess List 

    Configure Access List in Multi Vendor.
    """
    process_cls = models.OrderProcess
    lock_impl = lock.select_for_update_lock


    start = flow.Start(views.StartView).Next(this.config)


    config = flow.View(views.AclConfigView,
            task_description="ACl 설정 입력",
            ).Next(this.verify_config)

    verify_config = flow.View(
        views.CustomerVerificationView,
        task_description="설정 정보 확인",
    ).Next(this.check_verify)

    check_verify = flow.If(cond=lambda p: p.is_true()) \
          .OnTrue(this.end) \
          .OnFalse(this.rollback)


    rollback = flow.View(
        views.RollbackView,
        task_description=" 원상복구 "
    ).Next(this.end)

    end = flow.End()
Exemplo n.º 2
0
class ShipmentFlow(Flow):
    """
    Parcel Shipment

    This process demonstrates hello world approval request flow.
    """
    process_cls = models.ShipmentProcess
    task_cls = models.ShipmentTask
    lock_impl = lock.select_for_update_lock

    start = flow.Start(views.register_shipment) \
        .Permission('parcel.add_parcel') \
        .Next(this.approve)

    approve = flow.View(views.approve_shipment) \
        .Assign(lambda p: get_user_model().objects.get(email='*****@*****.**')) \
        .Next(this.check_approve)

    check_approve = flow.If(cond=lambda p: p.approved) \
        .OnTrue(this.deliver) \
        .OnFalse(this.end)

    deliver = flow.View(views.deliver, assign_view=views.deliver_assign) \
        .Permission('parcel.land_on_planet', obj=lambda p: p.parcel.planet) \
        .Next(this.report)

    report = flow.View(views.deliver_report) \
        .Assign(this.deliver.owner) \
        .Next(this.end)

    end = flow.End()
Exemplo n.º 3
0
class ApplicationFlow(Flow):
    process_class = ApplicationProcess
    process_title = 'ApplicationFlow'
    process_description = 'Process used to apply for a grant.'

    start = flow.Start(ApplicationView).Next(this.legal_approval)

    legal_approval = flow.View(UpdateProcessView,
                               fields=['legal_approved'
                                       ]).Next(this.finance_approval)

    finance_approval = flow.View(UpdateProcessView,
                                 fields=['finance_approved'
                                         ]).Next(this.notify_applicant)

    notify_applicant = flow.Handler(this.send_applicant_notification).Next(
        this.end)

    end = flow.End()

    def send_applicant_notification(self, activation):
        subject = 'Application rejected.'
        message = 'Sorry but your application has been rejected.'

        approved = all([
            activation.process.legal_approved,
            activation.process.finance_approved
        ])

        if approved:
            subject = 'Application approved.'
            message = 'Congratulations, your application has been approved.'

        logger.info(subject, message)
Exemplo n.º 4
0
class CreateWorksFlow(Flow):
    """ Create works for the items listed in the linked spreadsheet
    """
    process_class = ImplicitPlaceProcess
    summary_template = "Create works for {{ process.place_name }}"
    start_from_ui = True

    start = (flow.Start(views.StartPlaceWorkflowView).Permission(
        'indigo_api.review_work').Next(this.instructions))

    # wait for human to do the work and then move the task into the next state
    instructions = (flow.View(
        views.HumanInteractionView,
        task_title="Create works for items in a spreadsheet",
        task_description=format_html(
            '<a href="/works/new">Create a work</a> for each item listed in the linked spreadsheet.'
        ),
        task_result_summary="{{ flow_task.task_description }}",
    ).Permission('indigo_api.add_work').Next(this.review))

    review = (flow.View(
        views.ReviewTaskView,
        fields=['approved'],
        task_title="Review and approve listed works",
        task_description=
        "Review the created works in the spreadsheet. The task is done if all the works have been created.",
        task_result_summary="{{ flow_task.task_description }}",
    ).Permission('indigo_api.review_work').Next(this.check_approved))

    check_approved = (flow.If(lambda a: a.process.approved).Then(
        this.end).Else(this.instructions))

    end = flow.End()
Exemplo n.º 5
0
class ManageOrderFlow(Flow):
    process_class = ManageOrderProcess
    lock_impl = select_for_update_lock

    chef_recieve_order = (rf.Start(
        v.CreateProcessView,
        fields=["menuitem"]).Permission(auto_create=True).Next(this.chef_cook))

    chef_cook = (f.View(UpdateProcessView,
                        fields=["cook"]).Permission(auto_create=True).Next(
                            this.chef_serve))

    chef_serve = (f.View(UpdateProcessView,
                         fields=["serve"]).Permission(auto_create=True).Next(
                             this.Is_return_item))

    Is_return_item = (f.View(UpdateProcessView, fields=[
        "returnitem"
    ]).Permission(auto_create=True).Next(this.check_return))

    check_return = (
        f.If(lambda activation: activation.process.returnitem).Then(
            this.chef_serve).Else(this.chef_pay))

    chef_pay = (f.View(UpdateProcessView,
                       fields=["pay"]).Permission(auto_create=True).Next(
                           this.end_flow))

    end_flow = f.End()
Exemplo n.º 6
0
class BloodTestFlow(Flow):
    process_class = models.BloodTestProcess

    first_sample = flow.Start(views.FirstBloodSampleView).Next(
        this.biochemical_analysis)

    second_sample = flow.Start(views.second_blood_sample).Next(
        this.biochemical_analysis)

    biochemical_analysis = flow.View(views.biochemical_data).Next(
        this.split_analysis)

    split_analysis = (flow.Split().Next(
        this.hormone_tests,
        cond=lambda act: act.process.hormone_test_required).Next(
            this.tumor_markers_test,
            cond=lambda act: act.process.tumor_test_required).Next(
                this.join_analysis))

    hormone_tests = flow.View(views.HormoneTestFormView).Next(
        this.join_analysis)

    tumor_markers_test = flow.View(
        views.GenericTestFormView,
        model=models.TumorMarkers,
        fields=[
            'alpha_fetoprotein', 'beta_gonadotropin', 'ca19', 'cea', 'pap',
            'pas'
        ],
        task_description='Tumor Markers Test').Next(this.join_analysis)

    join_analysis = flow.Join().Next(this.end)

    end = flow.End()
Exemplo n.º 7
0
class CreatePointInTimeFlow(Flow):
    """ Create a new point in time for a work
    """
    process_class = CreatePointInTimeProcess
    summary_template = "Create a new point in time for {{ process.work.frbr_uri }} at {{ process.date|date:'Y-m-d' }} in {{ process.language.language.name_en }}"
    start_from_ui = False

    start = (flow.Start(views.StartCreatePointInTimeView).Permission(
        'indigo_api.add_amendment').Next(this.instructions))

    # wait for human to do the work and then move the task into the next state
    instructions = (flow.View(
        views.HumanInteractionView,
        task_title="Consolidate or import a point in time version of the work",
        task_description=format_html(
            'Visit the work\'s point in time page. Consolidate or import a version at the specified date, in the specified language.'
        ),
        task_result_summary="{{ flow_task.task_description }}",
    ).Permission('indigo_api.add_document').Next(this.review))

    review = (flow.View(
        views.ReviewTaskView,
        fields=['approved'],
        task_title="Review and approve the created point in time",
        task_description=
        "Review the document for the specific point in time and language. The task is done if the work has been correctly consolidated.",
        task_result_summary="{{ flow_task.task_description }}",
    ).Permission('indigo_api.review_document').Next(this.check_approved))

    check_approved = (flow.If(lambda a: a.process.approved).Then(
        this.end).Else(this.instructions))

    end = flow.End()
Exemplo n.º 8
0
class ListWorksFlow(Flow):
    """ Research works for a place and list them in the linked spreadsheet
    """
    process_class = ImplicitPlaceProcess
    summary_template = "List works for {{ process.place_name }}"
    start_from_ui = True

    start = (flow.Start(views.StartPlaceWorkflowView).Permission(
        'indigo_api.review_work').Next(this.instructions))

    # wait for human to do the work and then move the task into the next state
    instructions = (flow.View(
        views.HumanInteractionView,
        task_title="List work details in a spreadsheet",
        task_description=
        "List the short title, publication date, gazette name and number in the linked spreadsheet.",
        task_result_summary="{{ flow_task.task_description }}",
    ).Permission('indigo_api.add_work').Next(this.review))

    review = (flow.View(
        views.ReviewTaskView,
        fields=['approved'],
        task_title="Review and approve listed works",
        task_description=
        "Review the listed works in the spreadsheet. The task is done if the list is complete and has all required details for all works.",
        task_result_summary="{{ flow_task.task_description }}",
    ).Permission('indigo_api.review_work').Next(this.check_approved))

    check_approved = (flow.If(lambda a: a.process.approved).Then(
        this.end).Else(this.instructions))

    end = flow.End()
Exemplo n.º 9
0
class QingJiaFlow(Flow):
    process_class = QingJiaProcess

    start = (flow.Start(
        CreateProcessView,
        fields=["text", "days", "demo"],
    ).Permission(auto_create=True).Next(this.submit))

    submit = (flow.View(UpdateProcessView, fields=[
        "submit", "submit_note"
    ]).Permission(auto_create=True).Next(this.approve))

    approve = (flow.View(UpdateProcessView, fields=[
        "approved"
    ]).Permission(auto_create=True).Next(this.check_approve))

    check_approve = (
        flow.If(lambda activation: activation.process.approved).Then(
            this.send).Else(this.end))

    send = (flow.Handler(this.send_qing_jia_request).Next(this.end))

    end = flow.End()

    def send_qing_jia_request(self, activation):
        print(activation.process.text)
Exemplo n.º 10
0
class OrderItemFlow(Flow):
    process_class = models.OrderItemProcess
    lock_impl = lock.select_for_update_lock

    start = flow.StartSubprocess(this.start_func).Next(this.reserve_item)

    reserve_item = flow.View(
        views.OrderReservationView,
        task_description="Is item reservation succeed?",
        task_result_summary="Customer is {{ process.trusted|yesno:'Trusted,Unreliable' }}"
    ).Assign(
        lambda act: act.process.parent_task.process.created_by
    ).Next(this.check_reservation)

    check_reservation = flow.If(
        cond=lambda act: act.process.item.reserved
    ).Then(this.pack_item).Else(this.end)

    pack_item = flow.View(
        UpdateProcessView,
        task_description="Pack the item",
        task_result_summary="Item packed"
    ).Assign(
        lambda act: act.process.parent_task.process.created_by
    ).Next(this.end)

    end = flow.End()

    @method_decorator(flow.flow_start_func)
    def start_func(self, activation, parent_task, item):
        activation.prepare(parent_task)
        activation.process.item = item
        activation.done()
        return activation
Exemplo n.º 11
0
class SampleFlow(Flow):

    start = flow.Start(SampleCreateView).Next(this.update_one)

    update_one = flow.View(SampleUpdateViewOne).Next(this.update_two)

    update_two = flow.View(SampleUpdateViewTwo).Next(this.end)

    end = flow.End()
Exemplo n.º 12
0
class CreatevmFlow(Flow):
    process_class = models.CreatevmProcess
    task_class = models.CreatvmTask

    start = (flow.Start(flow_views.CreateProcessView,
                        fields=[
                            'username', 'cpu_cores', 'disk_size',
                            'memory_size', 'os_type'
                        ]).Permission('createvmflow.can_start_request').Next(
                            this.assign_approve))

    assign_approve = (flow.View(views.AssignApproverView).Permission(
        'createvmflow.can_assign_approver').Next(this.make_approver_task))

    make_approver_task = (nodes.ApproverSplit(this.approvers_handler).Next(
        this.make_approve))

    make_approve = (flow.View(
        views.ApproveView).Permission('createvmflow.can_approve_request').Next(
            this.check_approve))
    check_approve = (flow.If(this.caculate_approve).Then(
        this.provision_instance).Else(this.reject))

    provision_instance = (flow.Handler(this.provision_fun).Next(this.end))

    reject = (flow.Handler(this.reject_fun).Next(this.end))

    end = flow.End()

    def provision_fun(self, activation, *args, **kwargs):

        print("Provision request sended")

    def caculate_approve(self, activation):
        answers = activation.process.processapproverandans_set.all()
        for ans in answers:
            if not ans.approve:
                return False
        return True

    def reject_fun(self, activation, **kwargs):

        print("Provision request reject")

    def approvers_handler(self, activation):
        approvers = activation.process.processapproverandans_set.all()
        users = []
        for user in approvers:
            users.append(user.user)
        return users
Exemplo n.º 13
0
class MyPizzaFlow(Flow):
    process_class = MyPizzaProcess

    start = (
        flow.Start(CreateProcessView, fields=['content'])
        .Available(available_in_group('customers'))
        .Next(this.order_pizza)
    )

    order_pizza = (
        flow.Handler(this.save_content_to_order)
        .Next(this.external_join)
    )

    # To run this, we need to know which task we are specifically referring to
    # This can be done by querying the database

    my_trigger = (
        flow.Function(trigger_triggered,
                      task_loader=lambda flow_task, task: task)
        .Next(this.external_join)
    )

    external_join = (
        flow.Join()
        .Next(this.take_the_order)
    )

    take_the_order = (
        flow.View(TakeTheOrderView, fields=['table_location'])
        .Permission('users.can_take_the_order')
        .Next(this.prepare_pizza)
    )

    prepare_pizza = (
        flow.View(
            UpdateProcessView
        ).Next(this.bring_pizza)
    )

    bring_pizza = (
        flow.End()          # TODO continue
    )

    def save_content_to_order(self, activation):
        order = Order()
        order.content = activation.process.content
        order.save()
        activation.process.order = order
        activation.process.save()
Exemplo n.º 14
0
class ManageClaimFlow(Flow):
    process_class = models.ClaimProcess

    user_claim = flow.Start(views.RegisterCustomerClaim).Next(this.type_claim)

    type_claim = flow.View(UpdateProcessView,
                           form_class=forms.TypeClaimForm).Next(
                               this.split_type_claim)

    split_type_claim = (flow.Split().Next(
        this.sample_continue, cond=lambda act: act.process.pqr_required).Next(
            this.end, cond=lambda act: act.process.s_required))
    sample_continue = flow.View(views.testView).Next(this.end)

    end = flow.End()
Exemplo n.º 15
0
class ModerateAccidentFlow(Flow):
    process_class = models.AccidentPendingModeration

    start = flow.StartFunction(this.start_flow).Next(this.approve)

    approve = flow.View(UpdateProcessView, fields=[
        'approved'
    ]).Permission('icw.moderate_accident').Next(this.check_approve)

    check_approve = flow.If(
        lambda activation: activation.process.approved).Then(
            this.approved).Else(this.end)

    end = flow.End()

    def start_flow(self, activation: Activation):
        activation.prepare()
        activation.done()
        return activation

    @flow.Handler
    def approved(self, activation):
        pass

    class Meta:
        view_permission_name = 'icw.moderate_accident'
Exemplo n.º 16
0
class HelloWorldFlow(Flow):
    """
    Hello world

    This process demonstrates hello world approval request flow.
    """
    process_cls = HelloWorldProcess
    lock_impl = lock.select_for_update_lock

    start = flow.Start(flow_views.StartProcessView, fields=['text']) \
        .Permission(auto_create=True) \
        .Next(this.approve)

    approve = flow.View(flow_views.ProcessView, fields=['approved']) \
        .Permission(auto_create=True) \
        .Next(this.check_approve)

    check_approve = flow.If(cond=lambda p: p.approved) \
        .OnTrue(this.send) \
        .OnFalse(this.end)

    send = celery.Job(send_hello_world_request) \
        .Next(this.end)

    end = flow.End()
Exemplo n.º 17
0
class HelloWorldFlow(Flow):
    """
    Hello world process

    This process demonstrates hello world approval request flow.

    1. User with *helloworld.can_start_process* permission creates hello world request
    2. Manager, who have *helloworld.can_approve_request* approves it
    3. And if request was approved, background celery job sends it to the world
    4. Elsewhere, request became cancelled
    """
    process_cls = HelloWorldProcess
    lock_impl = select_for_update_lock

    start = flow.Start(StartView, fields=['text']) \
        .Permission(auto_create=True) \
        .Next(this.approve)

    approve = flow.View(ProcessView, fields=['approved']) \
        .Permission(auto_create=True) \
        .Next(this.send)

    check_approve = flow.If(cond=lambda p: p.approved) \
        .OnTrue(this.send) \
        .OnFalse(this.end)

    send = flow.Job(send_hello_world_request) \
        .Next(this.end)

    end = flow.End()
Exemplo n.º 18
0
class HelloWorldFlow(Flow):
    """
    Hello world

    This process demonstrates hello world approval request flow.
    """
    process_cls = HelloWorldProcess
    lock_impl = lock.select_for_update_lock

    summary_template = "'{{ process.text }}' message to the world"

    start = flow.Start(StartProcessView,
                       fields=['text']).Permission(auto_create=True).Next(
                           this.approve)

    approve = flow.View(
        ProcessView,
        fields=['approved'],
        task_description="Message approvement required",
        task_result_summary=
        "Messsage was {{ process.approved|yesno:'Approved,Rejected' }}"
    ).Permission(auto_create=True).Next(this.check_approve)

    check_approve = flow.If(cond=lambda p: p.approved).OnTrue(
        this.send).OnFalse(this.end)

    send = celery.Job(send_hello_world_request).Next(this.end)

    end = flow.End()
Exemplo n.º 19
0
class HelloWorldFlow(Flow):
    process_class = HelloWorldProcess

    start = (
        flow.Start(
            CreateProcessView,
            fields=["text"]
        ).Permission(
            auto_create=True
        ).Next(this.approve)
    )

    approve = (
        flow.View(
            UpdateProcessView,
            fields=["approved"]
        ).Permission(
            auto_create=True
        ).Next(this.check_approve)
    )

    check_approve = (
        flow.If(lambda activation: activation.process.approved)
        .Then(this.send)
        .Else(this.end)
    )

    send = (
        celery.Job(
            send_hello_world_request
        ).Next(this.end)
    )

    end = flow.End()
Exemplo n.º 20
0
class SavableFlow(Flow):
    process_class = SavableProcess
    start = flow.Start(CreateProcessView, fields=[]).Next(this.savable_task)
    savable_task = flow.View(SavableProcessView) \
        .Assign(username='******') \
        .Next(this.end)
    end = flow.End()
Exemplo n.º 21
0
class HelloWorldFlow(Flow):
    """
    Hello world

    This process demonstrates hello world approval request flow.
    """
    process_class = HelloWorldProcess
    lock_impl = lock.CacheLock()

    summary_template = "'{{ process.text }}' message to the world"

    start = (flow.Start(flow_views.CreateProcessView,
                        fields=['text']).Permission(auto_create=True).Next(
                            this.approve))

    approve = (flow.View(
        flow_views.UpdateProcessView,
        fields=['approved'],
        task_description="Message approvement required",
        task_result_summary=
        "Messsage was {{ process.approved|yesno:'Approved,Rejected' }}").
               Permission(auto_create=True).Next(this.check_approve))

    check_approve = (flow.If(cond=lambda act: act.process.approved).Then(
        this.send).Else(this.end))

    send = celery.Job(send_hello_world_request).Next(this.end)

    end = flow.End()
Exemplo n.º 22
0
    def test_viewactivation_lifecycle(self):
        flow_task = self.init_node(flow.View(lambda _: None))

        act = activation.ViewActivation()
        act.initialize(flow_task, Test.TaskStub())

        # check assign/reassin flow
        act.assign(Test.UserStub())
        self.assertEqual(act.task.status, STATUS.ASSIGNED)

        act.reassign(Test.UserStub())
        self.assertEqual(act.task.status, STATUS.ASSIGNED)

        act.unassign()
        self.assertEqual(act.task.status, STATUS.NEW)

        # execute
        act.assign(Test.UserStub())
        act.prepare()
        act.done()

        # undo
        act.undo()
        self.assertEqual(act.task.status, STATUS.NEW)
        act.cancel()
        self.assertEqual(act.task.status, STATUS.CANCELED)
Exemplo n.º 23
0
class DocumentUploadFlow(Flow):
    process_class = DocumentUploadProcess

    start = (
        flow.Start(
            views.start_upload_workflow
            #CreateProcessView,
            #fields=["text"]
        ).Permission(
            #auto_create=True
            'munshai.add_helloworldprocess'
            #'munshai.can_start_helloworldprocess',
            #'munshai.can_view_helloworldprocess'
        ).Next(this.approve))

    approve = (
        flow.View(UpdateProcessView, fields=["approved", "upload"]).Permission(
            #auto_create=True
            'munshai.can_approve_helloworldprocess',
            #'munshai.can_approve_helloworldprocess'
            #'munshai.view_helloworldrocess'
        ).Next(this.check_approve))

    check_approve = (
        flow.If(lambda activation: activation.process.approved).Then(
            this.send).Else(this.end))

    send = (flow.Handler(this.send_hello_world_request).Next(this.end))

    end = flow.End()

    def send_hello_world_request(self, activation):
        print(activation.process.text)
        print(activation.process.upload)
Exemplo n.º 24
0
class DynamicSplitFlow(Flow):
    """
    Dynamic split

    Depends on initial decision, several instances on make_decision task would be instantiated
    """
    process_class = models.DynamicSplitProcess

    summary_template = """
    Decision on: {{ process.question }}<br/>
    {{ process.decision_set.count }}  of {{ process.split_count }} completed
    """

    start = (flow.Start(
        CreateProcessView,
        fields=['question', 'split_count'],
        task_result_summary="Asks for {{ process.split_count }} decisions").
             Permission(auto_create=True).Next(this.spit_on_decision))

    spit_on_decision = (DynamicSplit(lambda p: p.split_count).Next(
        this.make_decision))

    make_decision = (flow.View(views.DecisionView,
                               task_description="Decision required").Next(
                                   this.join_on_decision))

    join_on_decision = flow.Join().Next(this.end)

    end = flow.End()
Exemplo n.º 25
0
class ListViewTestFlow(Flow):
    start1 = flow.StartFunction().Next(this.test_task)
    start2 = flow.Start(lambda request: None).Permission(
        'auth.start_flow_perm').Next(this.test_task)
    start3 = flow.Start(lambda request: None).Next(this.test_task)
    test_task = flow.View(lambda request: None).Next(this.end)
    end = flow.End()
Exemplo n.º 26
0
class HelloWorldFlow(Flow):
    process_class = HelloWorldProcess
    """
    Implementação do evento de inicialização do processo
    """
    start = (flow.Start(CreateProcessView,
                        fields=["text"]).Permission(auto_create=True).Next(
                            this.approve))
    """
    Implementação da atividade de aprovação da instância de processo
    """
    approve = (flow.View(UpdateProcessView, fields=[
        "approved"
    ]).Permission(auto_create=True).Next(this.check_approve))
    """
    implementação de elemento de decisão exclusiva
    """
    check_approve = (
        flow.If(lambda activation: activation.process.approved).Then(
            this.send).Else(this.end))

    send = (flow.Handler(this.send_hello_world_request).Next(this.end))

    end = flow.End()

    def send_hello_world_request(self, activation):
        print(activation.process.text)
Exemplo n.º 27
0
class DailyTimesheetApprovalFlow(Flow):
    process_class = DailyTimesheetApproval
    lock_impl = lock.no_lock

    process_description = 'Daily Timesheet Approval'

    label = 'daily'
    flow_label = 'daily'

    start = (
        flow.Start(
            CreateProcessView,
            task_title='Create a new daily timesheet')
        .Permission('auth.no_permission')
        .Next(this.fill)
    )

    fill = (
        flow.View(
            FillDailyTimesheetView,
            task_title='Fill your daily timesheet')
        .Permission('auth.no_permission')
        .Assign(lambda a: a.process.created_by)
        .Next(this.calculate_payroll)
    )

    calculate_payroll = (
        activities.Job(calculate_sheet_payroll)
        .Next(this.approve)
    )

    approve = (
        flow.View(
            ApproveDailyTimesheetView,
            task_title='Approve this daily timesheet',
        )
        .Permission('auth.can_approve')
        .Next(this.check_approval)
    )

    check_approval = (
        flow.If(lambda a: a.task.process.sheet.is_approved())
        .Then(this.end)
        .Else(this.fill)
    )

    end = flow.End()
Exemplo n.º 28
0
class AddText(Flow):
    process_class = models.SubP
    task_class = models.SubT

    start = StartSubProcess().Next(this.inserttext)
    inserttext = flow.View(flow_views.UpdateProcessView,
                           fields=['text']).Next(this.end)
    end = flow.End()
Exemplo n.º 29
0
class SingleTaskFlow(Flow):
    lock_impl = lock.cache_lock

    start = flow.Start() \
        .Next('task')
    task = flow.View(perform_task)\
        .Next('end')
    end = flow.End()
Exemplo n.º 30
0
class TestFlow(Flow):
    process_class = SavableProcess
    start = flow.Start(CreateProcessView, fields=[]).Next(this.savable_task)
    savable_task = flow.View(SavableProcessView) \
        .Assign(username='******') \
        .Next(this.if_task)
    if_task = flow.If(1 == 1).Then(this.switch_task).Else(this.end)
    switch_task = flow.Switch().Case(this.end, cond=(1 == 1))
    end = flow.End()