03 flowchart drawing and deployment

First, the flow diagrams the eclipse

1. Right-pack, New, select activiti:

 

 

2, after select Next, enter the file name of the process ( Note: This name is not the name of the deployment, the deployment name specified during deployment):

 

 

Then you can start to draw a flow chart.

2.1.1 Set Node Properties

Click eclipse toolbar window, show view, select Other ... you can find the properties:

 

 

 

 

Click blank flowchart, id displayed in the properties compared with the deployment ID ( ID is the process defined herein, in the process table key), name was deployment name:

 

 

Select the node, you can set node properties (here for the task node), in the main config can handle the task set of people, for the people can be specified directly, you can also specify the use of the expression, the second approach requires a process variable table this variable has:

 

 

Click Save to pack more than two files that represent a good flow chart has been drawn:

 

 

 

Second, the deployment of the flowchart (there is a path unsolved problem)

1, a deployment: classpath way to deploy

1.1 Process Engine first need to get the object, and then acquired by the process engine RepositoryService objects, this object deployment process

public class DeployProcess {

    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    @Test
    public void deploy1() {
        RepositoryService repositoryService processEngine.getRepositoryService = ();
        Deployment deploy = repositoryService.createDeployment (). Name ( "leave Process")
                .addClasspathResource("/LeaveBill.bpmn")
                .addClasspathResource("/LeaveBill.png").deploy();
        System.out.println("部署成功,部署ID为"+deploy.getId());
    }
}

2、部署方式二:zip包方式进行部(常用)

将流程图画好之后打包,复制到项目中:

 

 

创建部署方法:
部署时指定的name是部署表当中的name:
    @Test
    public void deploy2() {
        InputStream inputStream = this.getClass().getResourceAsStream("LeaveBill.zip");
        ZipInputStream zipInputStream = new ZipInputStream(inputStream);
        RepositoryService repositoryService = processEngine.getRepositoryService();
        Deployment deploy = repositoryService.createDeployment().name("请假流程")
                .addZipInputStream(zipInputStream).deploy();
        System.out.println("部署成功,部署ID为"+deploy.getId());
        
    }
流程部署结束之后,就可以启动流程了。



Guess you like

Origin www.cnblogs.com/Guorisy/p/12099230.html