Acitivi API

Acitivi API:

    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();

RuntimeService runtimeService = processEngine.getRuntimeService();

RepositoryService repositoryService = processEngine.getRepositoryService();

TaskService taskService = processEngine.getTaskService();

ManagementService managementService = processEngine.getManagementService();

IdentityService identityService = processEngine.getIdentityService();

HistoryService historyService = processEngine.getHistoryService();

FormService formService = processEngine.getFormService();

 

所有的service是stateless,因此acitivi是支持集群的(使用同一数据库)。

 

RepositoryService :This service offers operations for managing and manipulating deployments and process definitions,

  Wile the RepositoryService is rather about static information。

  

RuntimeService :It deals with starting new process instances of process definitions. As said above, a process definition defines the structure and behaviour of the different steps in a process. A process instance is one execution of such a process definition. For each process definition there typically are many instances running at the same time. The RuntimeService also is the service which is used to retrieve and store process variables.

 

TaskService:Tasks that need to be performed by actual human users of the system are core to a BPM engine such as Activiti.

  Everything around tasks is grouped in the TaskService, such as :

       1、Querying tasks assigned to users or groups

 

            2、Creating new standalone tasks. These are tasks that are not related to a process instances.

 

            3、Manipulating to which user a task is assigned or which users are in some way involved with the task.

 

            4、Claiming and completing a task. Claiming means that someone decided to be the assigee for the task, meaning that this user will complete the task. Completing means 'doing the work of the tasks'. Typically this is filling in a form of sorts. 

 

IdentityService:It allows the management (creation, update, deletion, querying, ...) of groups and users

 

    FormService :This service introduces the concept of a start form and a task form. A start form is a form that is shown to the user before the process instance is started, while a task form is the form that is displayed when a user wants to complete a form.

 

HistoryService :When executing processes, a lot of data can be kept by the engine (this is configurable) such as process instance start times, who did which tasks, how long it took to complete the tasks, which path was followed in each process instance, etc. This service exposes mainly query capabilities to access this data.

 

ManagementService : It allows to retrieve information about the database tables and table metadata. Furthermore, it exposes query capabilities and management operations for jobs. Jobs are used in Activiti for various things such as timers, asynchronous continuations, delayed suspension/activation, etc. Later on, these topics will be discussed in more detail.

 

 

 

repositoryService.createDeployment()

          .addClasspathResource("diagrams/VacationRequest.bpmn20.xml")

          .deploy();

    每次执行以上语句都会新增一条记录到表ACT_RE_PROCDEF 

SELECT * FROM ACT_RE_PROCDEF 

 

ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("vacationRequest", variables);

每次执行以上语句都会新增一条记录到表ACT_RU_EXECUTION  

SELECT * FROM ACT_RU_EXECUTION 

 

为了保证高效,运行库(包含RU的表),都是用完即删的。

所以你可以通过判断ACT_RU_EXECUTION里是否还能查到这条数据,来判断流程是否已经结束了。

如果想知道某个流程什么时候结束的,可以查询act_hi_procinst

select * from act_hi_procinst t where t.proc_inst_id_='39027' 

你可能感兴趣的:(api)