工作流引擎Activiti学习第五天(十)--- 并行网关

package com.activiti.study.parallelGateWay;

import java.io.InputStream;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.runtime.ProcessInstance;
import org.junit.Test;

public class parallelGateWay {
	
	/**
	 *加载默认的流程引擎: 加载 activiti.cfg.xml 文件 
	 */
	ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();

	/**
	 * 部署流程定义
	 */
	@Test
	public void testDeployProcessDefination_inputStream(){
		
		/**
		 * 从当前包下进行加载
		 */
		InputStream inputStreamBpmn = this.getClass().getResourceAsStream("parallelGateWay1.bpmn");
		InputStream inputStreamPng = this.getClass().getResourceAsStream("parallelGateWay1.png");
		
		Deployment deployment = processEngine.getRepositoryService()
					.createDeployment()
					.name("New_ParallelGateWay")     //设定流程名称
					.addInputStream("parallelGateWay.bpmn", inputStreamBpmn)
					.addInputStream("parallelGateWay.png", inputStreamPng)
					.deploy();
		System.out.println("Id: " + deployment.getId());
		System.out.println("Name: " + deployment.getName());
		System.out.println("Category: " + deployment.getCategory());
	}
	
	/**
	 * 启动流程
	 */
	@Test
	public void testStartProcessDefination(){
		String processDefinationKey = "ParallelGateWay001";
		ProcessInstance pi = processEngine.getRuntimeService().startProcessInstanceByKey(processDefinationKey);
		System.out.println("Id: " + pi.getId());
		System.out.println("Key: " + pi.getBusinessKey());
		System.out.println("ActivityId: " + pi.getActivityId());
		System.out.println("DefinitionId: " + pi.getProcessDefinitionId());
		System.out.println("ProcessInstanceId: " + pi.getProcessInstanceId());
	}
	
	/**
	 * 完成任务
	 */
	@Test
	public void testCompleteTask(){
		String taskId = "302";
		processEngine.getTaskService().complete(taskId);
		System.out.println(taskId + " has Done.");
	}
	
	
}



  
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  
  
    
      
        
      
      
        
      
      
        
      
      
        
      
      
        
      
      
        
      
      
        
      
      
        
      
      
        
        
      
      
        
        
      
      
        
        
      
      
        
        
      
      
        
        
      
      
        
        
      
      
        
        
      
      
        
        
      
    
  


 
  


工作流引擎Activiti学习第五天(十)--- 并行网关_第1张图片 工作流引擎Activiti学习第五天(十)--- 并行网关_第2张图片 工作流引擎Activiti学习第五天(十)--- 并行网关_第3张图片 工作流引擎Activiti学习第五天(十)--- 并行网关_第4张图片







你可能感兴趣的:(工作流引擎)