码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 【viewbpmn】Quick Start


    文章目录

    • Ref
    • viewflow 运行流程
      • 1. git clone和建立虚拟环境,安装包
      • 2. Initial steps
      • 3. Configuration
      • 4. Define models
      • 5. Define flow
      • 6. Enable frontend
      • 7. Run and explore
    • SpiffWorkflow 运行流程
      • 1. Git clone 和虚拟环境配置
      • 2. Test
    • TimeAwareBPMN-js 运行流程
      • 1. git clone 和虚拟环境配置
      • 2. npm
      • 3. Install and Run

    Ref

    【viewflow 官网说明 Quick Start】:http://docs.viewflow.io/viewflow_quickstart.html

    【viewflow Github】:https://github.com/viewflow/viewflow

    【SpiffWorkflow 官网说明 Quick start】:https://github.com/sartography/SpiffWorkflow
    【SpiffWorkflow Github】:https://github.com/sartography/SpiffWorkflow

    【TimeAwareBPMN-js Github】:https://github.com/ElsevierSoftwareX/SOFTX-D-21-00180

    【TimeAwareBPMN-js 论文原文:TimeAwareBPMN-js: An editor and temporal verification tool for Time-Aware BPMN processes】https://www.sciencedirect.com/science/article/pii/S2352711021001734

    viewflow 运行流程

    【官网说明:Quick Start】http://docs.viewflow.io/viewflow_quickstart.html

    1. git clone和建立虚拟环境,安装包

    【viewflow github】:https://github.com/viewflow/viewflow

    virtualenv -p python3.7 ~/venv/viewflow
    source ~/venv/viewflow/bin/activate
    
    • 1
    • 2
    python3.7 -m pip install django django-material django-viewflow
    
    • 1

    在这里插入图片描述

    2. Initial steps

    1. 创建子文件夹,例如demo_20220821:

    在这里插入图片描述

    1. In the current directory, scaffold a new django project:
    django-admin startproject demo .
    
    • 1
    1. Create an app:
    ./manage.py startapp helloworld
    
    • 1

    在这里插入图片描述

    符合官网所说结构:
    Now you should have following file structure:

    demo/
    ├── asgi.py
    ├── init.py
    ├── settings.py
    ├── urls.py
    └── wsgi.py
    helloworld
    ├── admin.py
    ├── apps.py
    ├── init.py
    ├── migrations
    │ └── init.py
    ├── models.py
    ├── tests.py
    └── views.py
    manage.py

    3. Configuration

    Open the demo_20220821/settings.py and add viewflow and demo_20220821.helloworld into INSTALLED_APPS setting

    INSTALLED_APPS = [
        ...
        'viewflow',
        'helloworld',
    ]
    
    • 1
    • 2
    • 3
    • 4
    • 5

    最终结果如下(包括后面的configure):

    在这里插入图片描述

    4. Define models

    Open helloworld/models.py file and define a process model with text and approved fields, to capture the process state during execution.

    from django.db import models
    from viewflow.models import Process
    
    
    class HelloWorldProcess(Process):
        text = models.CharField(max_length=150)
        approved = models.BooleanField(default=False)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    在这里插入图片描述

    5. Define flow

    Open(其实为create) the demo_20220821/helloworld/flows.py file and define:

    from viewflow import flow
    from viewflow.base import this, Flow
    from viewflow.flow.views import CreateProcessView, UpdateProcessView
    
    from .models import HelloWorldProcess
    
    
    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 = (
            flow.Handler(
                this.send_hello_world_request
            ).Next(this.end)
        )
    
        end = flow.End()
    
        def send_hello_world_request(self, activation):
            print(activation.process.text)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44

    在这里插入图片描述

    6. Enable frontend

    Add frontend URLs into global URL conf module at demo/urls.py

    from django.urls import include, path
    from django.views import generic
    from material.frontend import urls as frontend_urls
    
    urlpatterns = [
        path(r'', generic.RedirectView.as_view(url='/workflow/', permanent=False)),
        path(r'', include(frontend_urls)),
    ]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    At the last step, register our flow in the viewflow.frontend.

    from viewflow import frontend
    
    @frontend.register
    class HelloWorldFlow(Flow):
        ...
    
    • 1
    • 2
    • 3
    • 4
    • 5

    在这里插入图片描述

    7. Run and explore

    Create migrations for the helloworld app.
    ./manage.py makemigrations helloworld
    
    Apply it
    ./manage.py migrate
    
    Create an admin user to initial login
    ./manage.py createsuperuser
    
    Run the server
    ./manage.py runserver
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    在这里插入图片描述
    在这里插入图片描述

    在这里插入图片描述

    在这里插入图片描述

    Go to http://127.0.0.1:8000 and see the viewflow in action!

    (由于我是虚拟机内的ubuntu系统,所以需要在Ubuntu系统里的浏览器打开http://127.0.0.1:8000)

    在这里插入图片描述
    用刚刚的账户和密码登录:

    在这里插入图片描述

    SpiffWorkflow 运行流程

    【官网Quick start】https://github.com/sartography/SpiffWorkflow

    1. Git clone 和虚拟环境配置

    1. git clone
    git clone https://github.com/sartography/SpiffWorkflow.git
    
    • 1
    1. 创建虚拟环境
    virtualenv -p python3.7 ~/venv/spiffwk
    source ~/venv/spiffwk/bin/activate
    
    
    • 1
    • 2
    • 3
    1. 安装包spiffworkflow
    python3.7 -m pip install spiffworkflow
    
    • 1

    在这里插入图片描述
    在这里插入图片描述

    在这里插入图片描述

    2. Test

    cd tests/SpiffWorkflow
    coverage run --source=SpiffWorkflow -m unittest discover -v . "*Test.py"
    
    • 1
    • 2

    注意这里coverage包需要安装:

    python3.7 -m pip install -U coverage
    
    • 1

    在这里插入图片描述
    实际运行截图:
    在这里插入图片描述
    在这里插入图片描述

    TimeAwareBPMN-js 运行流程

    【github官网】https://github.com/ElsevierSoftwareX/SOFTX-D-21-00180

    【论文原文:TimeAwareBPMN-js: An editor and temporal verification tool for Time-Aware BPMN processes】https://www.sciencedirect.com/science/article/pii/S2352711021001734

    1. git clone 和虚拟环境配置

    git clone https://github.com/ElsevierSoftwareX/SOFTX-D-21-00180.git
    
    virtualenv -p python3.7 ~/venv/timeawareBPMN
    source ~/venv/timeawareBPMN/bin/activate
    
    • 1
    • 2
    • 3
    • 4

    在这里插入图片描述

    2. npm

    需安装npm和node.js,并且和两者版本应当匹配:

    【Node.js 与 npm版本匹配】:https://nodejs.org/zh-cn/download/releases/

    例如,我这里安装的是:
    在这里插入图片描述

    可以从上述网址上看到两者匹配:

    在这里插入图片描述

    3. Install and Run

    1. install all other dependencies
    npm install
    
    • 1
    1. run project
    npm start
    
    • 1

    在这里插入图片描述

    然后,就会自动打开http://127.0.0.1:3000/

    在这里插入图片描述

    此时可以载入xxx.bpmn,例如点击【Browse】,选择【./SOFTX-D-21-00180/examples/models】,选择【diagramExample_01.bpmn】:

    在这里插入图片描述

    此时即显示主界面

    在这里插入图片描述

  • 相关阅读:
    【C++】《C++ Primer》第三章 知识点总结
    【Java】不一样的图书管理系统
    Android-Firebase快速解决合规问题,延迟Firebase初始化
    提取歌曲伴奏?用对软件一键帮你搞定~
    C++ 11/14/17/20 核心特性列表
    5. 线性回归的从零开始实现
    Win11显示麦克风未插上怎么办?
    set(CMAKE_BUILD_TYPE debug 和 set(CMAKE_CXX_FLAGS -g的用途是一样的吗
    手机端侧文字识别:挑战与解决方案
    AtCoder Beginner Contest 231(D-F,H)
  • 原文地址:https://blog.csdn.net/u010637291/article/details/126451821
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号