Process标签配置
通过源码查看该类有哪些属性:
public class Process extends BaseElement implements FlowElementsContainer, HasExecutionListeners {
protected String name;
//可执行
protected boolean executable = true;
protected String documentation;
protected IOSpecification ioSpecification;
//执行监听器
protected List<ActivitiListener> executionListeners = new ArrayList<ActivitiListener>();
protected List<Lane> lanes = new ArrayList<Lane>();
protected List<FlowElement> flowElementList = new ArrayList<FlowElement>();
//数据实体
protected List<ValuedDataObject> dataObjects = new ArrayList<ValuedDataObject>();
protected List<Artifact> artifactList = new ArrayList<Artifact>();
//候选启动人
protected List<String> candidateStarterUsers = new ArrayList<String>();
//候选启动组
protected List<String> candidateStarterGroups = new ArrayList<String>();
protected List<EventListener> eventListeners = new ArrayList<EventListener>();
protected Map<String, FlowElement> flowElementMap = new LinkedHashMap<String, FlowElement>();
// Added during process definition parsing
protected FlowElement initialFlowElement;
...
namespace主要用于做分类
id主要用于发布流程的key
candidate Strarter Users 候选人 。多个用逗号分隔 。 该流程所属于的人
candidate Strarter Groups 候选组 。多个用逗号分隔 。该流程所属于的组
<process id="potentialStarter" activiti:candidateStarterUsers="user1, user2"
activiti:candidateStarterGroups="group1">
代码:
identityService.setAuthenticatedUserId(authenticatedUserId);
<startEvent id="startEvent1" activiti:initiator="shareniuInitiator"></startEvent>
initiator跟启动人配合使用才有意义,否则没有意义。
定义流程初始化授权后,开发者可以使用如下方法获得授权定义。 这些代码可以获得给定的用户可以启动哪些流程定义:
processDefinitions = repositoryService.createProcessDefinitionQuery().startableByUser("userxxx").list();
Data Objects
一条可以公用的数据
BPMN 提供了一种功能,可以在流程定义或子流程中定义数据对象。根据BPMN 规范,流程定义可以包含复杂 XML 结构, 可以导入 XSD 定义。
监听器Listeners
Java class ,Expression,Delegate expression都有域,其中的值可以传给监听器
(1) Java class
注意:class需要实现接口
org.activiti.engine.delegate.ExecutionListener
(2) Expression
定义一个表达式类似EL语法。这里的pojo是一个Bean的名称(可以用spring代理),还可以子expression中通过计算一个表达式配置监听器的名称。
Activiti中国社区交流群:839915498