zoukankan      html  css  js  c++  java
  • activiti基础--0------------------------------生成23张表

    1.工作流activiti.cfg.xml配置文件

    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
    
        <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
            <!-- 连接数据库的配置 -->
            <property name="jdbcDriver" value="com.mysql.jdbc.Driver"></property>
            <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/test?useUnicode=true&amp;characterEncoding=utf8"></property>
            <property name="jdbcUsername" value="root"></property>
            <property name="jdbcPassword" value="123456"></property>
            <!-- 没有表创建表 -->
            <property name="databaseSchemaUpdate" value="true"></property>
        </bean>
    
    </beans>

    2.生成工作流23张表(两种方式)

    package Junit;
    
    import org.activiti.engine.ProcessEngine;
    import org.activiti.engine.ProcessEngineConfiguration;
    import org.junit.Test;
    
    public class TestActiviti {
    
        /**
         * 1.使用代码创建工作流需要的23张表
         * 2.流程引擎ProcessEngine对象(所有操作都离不开引擎对象)
         */
        
        @Test
        public void createTable () {
            ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
            //连接数据库的配置
            processEngineConfiguration.setJdbcDriver("com.mysql.jdbc.Driver");
            processEngineConfiguration.setJdbcUrl("jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8");
            processEngineConfiguration.setJdbcUsername("root");
            processEngineConfiguration.setJdbcPassword("123456");
            //public static final java.lang.String DB_SCHEMA_UPDATE_FALSE = "false";不能自动创建表,需要表存在
            //public static final java.lang.String DB_SCHEMA_UPDATE_CREATE_DROP = "create-drop";先删除表在创建表
            //public static final java.lang.String DB_SCHEMA_UPDATE_TRUE = "true";如果表不存在,自动创建表
            processEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
            //工作流的核心对象,processEngine对象
            ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
            
            System.out.println("processEngine: " + processEngine );
        }
        
        /**
         * 使用配置文件创建工作流需要的23张表
         */
        
        @Test
        public void createTable2 () {
            ProcessEngineConfiguration processEngineConfiguration = 
                    ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml");
            
            //工作流的核心对象,processEngine对象
            ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
            
            ProcessEngine processEngine2 = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml").buildProcessEngine();
            
            System.out.println("processEngine2: " + processEngine2 );
            
        }
    }
  • 相关阅读:
    现有某电商网站用户对商品的收藏数据,记录了用户收藏的商品id以及收藏日期,名为buyer_favorite1。 buyer_favorite1包含:买家id,商品id,收藏日期这三个字段,数据以“ ”分割
    面向对象程序设计中类与类的关系都有哪几种?分别用类图实例说明。
    Java为什么没有指针
    touchz,mkdir,vi的区别
    session使用方法
    迪杰斯特拉算法-文档读取数据
    数据结构---公交线路提示系统(Java后台+excel表格+web前端)
    caffe中train过程的train数据集、val数据集、test时候的test数据集区别
    caffe程序中出现的db.cpp:#line(行号) unknown database backend问题
    caffe的cancat层
  • 原文地址:https://www.cnblogs.com/sutao/p/8023018.html
Copyright © 2011-2022 走看看