timmy00274672 / StartWithActiviti2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

StartWithActiviti2

Activiti In Action

Chapter4

Outline

part1

Developing and testing with the Activiti Engine

  • Running the Activiti Engine in the JVM with an in-memory database (H2)
  • Running the Activiti Engine in the JVM with a standalone database (H2)
  • Running the Activiti Engine on an application server (Apache Tomcat) with a standalone database (H2)

part2

Activiti Engine API

  • RuntimeService: The runtime service provides an interface to start and query process instances. In addition, process variables can be retrieved and set, and processes can be signaled to leave a wait state.
  • TaskService: Exposes operations to manage human (standalone) Tasks, such as claiming, completing and assigning tasks.
  • RepositoryService: The repository service provides functionality to deploy, query, delete, and retrieve process definitions.
  • IdentityService: Used for managing Users, Groups and the relations between them
  • ManagementService: The management service can be used to query the Activiti tables and execute jobs.
  • HistoryService: To retrieve information about completed process instances.
  • FormService: To work with the user task forms generated by the Activiti form engine, the form service provides several methods.

RuntimeService

The primary usage of the RuntimeService is to start new process instances based on a specific process definition.

額外提到Junit運作基本機制 JUnitLifecycle_simple.png

TaskService

  • add task
  • The user or group assigned as a candidate
  • Only one user can be assigned through task
  • Claim and complete a task

@Deployment With the @Deployment, the book order process definition is deployed to the Activiti engine.

@Rule public ActivitiRule activitiRule = new ActivitiRule("activiti.cfg-mem.xml");

If no "activiti.cfg-mem.xml", then use the default "activiti.cfg.xml"

RepositoryService

It can also be used to query the Activiti engine for deployment artifacts and process definitions. In this section(4.2.3), you’ll also use the delete functionality, which the RepositoryService interface provides.

The RepositoryService interface provides two types of delete methods:

  • The deleteDeployment method with a deployment identifier and a false input parameter, which only deletes the deployment and not the corresponding process instance data. When there are still running process instances, you’ll get an exception when running this method.
  • The deleteDeployment method with a deployment identifier and a true input parameter, which deletes all information regarding the process definition, running instances, and history. If you want all process data, including running process instances, to be deleted, you should use a Boolean value of true for the second input parameter.

IdentityService

新增成員或是一個 group 的方法,新增後必須存檔。

User newUser = identityService
.newUser("John Doe");
identityService.saveUser(newUser);

HistoryService

在 Actitivi 上,ACT_HI 是歷史資料, ACT_RU 是執行中的資料。RU中的資料在結束完成後會被刪除。

若要儲存想顯示的變數資料(history): default is activiti.cfg.xml. And add the following property to the process engine configuration:

<property name="history" value="full" />
  • None—No history information is archived.
  • Activity—All process and activity instance information is archived.
  • Audit (default)—All process, activity instance, and form properties information is archived.
  • Full—The highest level of archiving; all audit information is archived and, additionally, the updates to process variables and user task form properties are stored.

part3

The Java service task can be used in four ways:

  • Java service task class *分同步和非同步
  • Java service task class with field extensions
  • Java service task with method or value expressions
  • A delegate expression that defines a variable that is resolved to a Java bean at runtime(在4-4中介紹)

About


Languages

Language:Java 100.0%