zoukankan      html  css  js  c++  java
  • activiti 插件安装,以及初始化配置

    1.安装插件

    2.添加pom

    3.配置activiti.cfg.xml

    4.绘制业务流程图 MyProcess.bpmn

    5.加载activiti数据表

    6.创建流程

    1.安装eclipse activiti 插件

    Activiti BPMN 2.0 designer
    http://activiti.org/designer/update/

    help-->install new softWare

    2.添加pom

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    	<groupId>com.qi</groupId>
    	<artifactId>activitiDemo</artifactId>
    	<version>0.0.1-SNAPSHOT</version>
    
    	<dependencies>
    		<dependency>
    			<groupId>org.activiti</groupId>
    			<artifactId>activiti-engine</artifactId>
    			<version>5.21.0</version>
    		</dependency>
    		<dependency>
    			<groupId>org.activiti</groupId>
    			<artifactId>activiti-spring</artifactId>
    			<version>5.21.0</version>
    		</dependency>
    		<dependency>
    			<groupId>org.slf4j</groupId>
    			<artifactId>slf4j-api</artifactId>
    			<version>1.7.10</version>
    		</dependency>
    		<dependency>
    			<groupId>ch.qos.logback</groupId>
    			<artifactId>logback-classic</artifactId>
    			<version>1.1.2</version>
    		</dependency>
    		<dependency>
    			<groupId>ch.qos.logback</groupId>
    			<artifactId>logback-core</artifactId>
    			<version>1.1.2</version>
    		</dependency>
    		<dependency>
    			<groupId>junit</groupId>
    			<artifactId>junit</artifactId>
    			<version>4.12</version>
    		</dependency>
    		<dependency>
    			<groupId>mysql</groupId>
    			<artifactId>mysql-connector-java</artifactId>
    			<version>5.1.38</version>
    		</dependency>
    
    	</dependencies>
    
    </project>
    

      

    3.配置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 name="jdbcUrl"
    			value="jdbc:mysql://localhost:3306/test?characterEncoding=utf8" />
    		<property name="jdbcUsername" value="root" />
    		<property name="jdbcPassword" value="centos" />
    		<property name="databaseSchemaUpdate" value="true" />
    	</bean>
    </beans>
    

    4.绘制业务流程图 MyProcess.bpmn

    5.加载activiti数据表

    6.创建流程

    package activitiDemo;
    
    import org.activiti.engine.ProcessEngine;
    import org.activiti.engine.ProcessEngineConfiguration;
    import org.activiti.engine.repository.Deployment;
    import org.junit.Test;
    
    public class JunitTest {
    
    	/**
    	 * 加载activiti 表
    	 */
    	@Test
    	public void installActiviti() {
    		//表不存在的话创建表
    		ProcessEngine processEngine = ProcessEngineConfiguration
    				.createProcessEngineConfigurationFromResource("activiti.cfg.xml")
    		.buildProcessEngine();
    
    		System.out.println("------processEngine:" + processEngine);
    
    	}
    	
    	/**
    	 * 创建activiti流程
    	 */
    	@Test
    	public void createProcess() {
    		//创建流程
    		ProcessEngine processEngine = ProcessEngineConfiguration
    				.createProcessEngineConfigurationFromResource("activiti.cfg.xml").buildProcessEngine();
    		Deployment deployment = processEngine.getRepositoryService().createDeployment().name("请假程序")
    		.addClasspathResource("diagrams/MyProcess.bpmn").addClasspathResource("diagrams/MyProcess.png").deploy();
    
    		System.out.println(deployment.getId());
    		System.out.println(deployment.getName());
    	}
    }
    

      

  • 相关阅读:
    信息安全[0836]
    05 二极管的微变等效和稳压二极管
    04 二极管的直流等效通路
    STM32 ADS112C04
    03 PN与二极管的特性
    STM32中的程序在RAM还是FLASH里运行?
    基于STM32的MLX90614人体红外测温枪
    KEIL5如何打开KEIL4工程 [复制链接]
    02 PN结的形成
    PreparedStatement和Statament的性能
  • 原文地址:https://www.cnblogs.com/yun965861480/p/6906348.html
Copyright © 2011-2022 走看看