Activiti5只学习之路,读取bpmn文件的三种方式

// 部署流程定义(classpath)
	@Test
	public void deploymentProcessDefinition_classpath() {
		Deployment deployment = processEngines.getRepositoryService()// 与流程定义和部署对象相关的sevices
				.createDeployment()// 创建一个部署对象
				.name("流程定义")// 添加部署名称
				.addClasspathResource("diagrams/helloworld.bpmn")// 从classpath的资源中加载,一次只能加载一个文件
				.addClasspathResource("diagrams/helloworld.png").deploy();// 完成部署
		System.out.println("部署ID:" + deployment.getId());
		System.out.println("部署名称" + deployment.getName());

	}
// 部署流程定义(zip)
	@Test
	public void deploymentProcessDefinition_zip() {
		InputStream inputStream=this.getClass().getClassLoader().getResourceAsStream("diagrams/helloworld.zip");
		ZipInputStream inputStream2=new ZipInputStream(inputStream);
		Deployment deployment = processEngine.getRepositoryService()// 与流程定义和部署对象相关的sevices
				.createDeployment()// 创建一个部署对象
				.name("流程定义")// 添加部署名称
				.addZipInputStream(inputStream2)
				.deploy();
		System.out.println("部署ID:" + deployment.getId());
		System.out.println("部署名称" + deployment.getName());
	}	
// 部署流程定义(InputStream)
	@Test
	public void deploymentProcessDefinition_inputStream() {
		InputStream inputStreambpmn=this.getClass().getResourceAsStream("/diagrams/ProcessVariobles.bpmn");
		InputStream inputStreampng=this.getClass().getResourceAsStream("/diagrams/ProcessVariobles.png");
		Deployment deployment = processEngine.getRepositoryService()// 与流程定义和部署对象相关的sevices
				.createDeployment()// 创建一个部署对象
				.name("流程定义")// 添加部署名称
				.addInputStream("ProcessVariobles.bpmn", inputStreambpmn)
				.addInputStream("ProcessVariobles.png", inputStreampng)
				.deploy();// 完成部署
		System.out.println("部署ID:" + deployment.getId());
		System.out.println("部署名称" + deployment.getName());
	}

Activiti5只学习之路,读取bpmn文件的三种方式_第1张图片

你可能感兴趣的:(activiti)