本文整理汇总了Java中org.activiti.bpmn.model.UserTask.getCandidateUsers方法的典型用法代码示例。如果您正苦于以下问题:Java UserTask.getCandidateUsers方法的具体用法?Java UserTask.getCandidateUsers怎么用?Java UserTask.getCandidateUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.bpmn.model.UserTask
的用法示例。
在下文中一共展示了UserTask.getCandidateUsers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processUserTask
import org.activiti.bpmn.model.UserTask; //导入方法依赖的package包/类
/**
* 配置用户任务.
*/
public void processUserTask(Node node, BpmnModel bpmnModel, int priority,
BpmConfBase bpmConfBase) {
BpmConfNodeManager bpmConfNodeManager = getBpmConfNodeManager();
BpmConfNode bpmConfNode = bpmConfNodeManager.findUnique(
"from BpmConfNode where code=? and bpmConfBase=?",
node.getId(), bpmConfBase);
if (bpmConfNode == null) {
bpmConfNode = new BpmConfNode();
bpmConfNode.setCode(node.getId());
bpmConfNode.setName(node.getName());
bpmConfNode.setType(node.getType());
bpmConfNode.setConfUser(0);
bpmConfNode.setConfListener(0);
bpmConfNode.setConfRule(0);
bpmConfNode.setConfForm(0);
bpmConfNode.setConfOperation(0);
bpmConfNode.setConfNotice(0);
bpmConfNode.setPriority(priority);
bpmConfNode.setBpmConfBase(bpmConfBase);
bpmConfNodeManager.save(bpmConfNode);
}
// 配置参与者
UserTask userTask = (UserTask) bpmnModel.getFlowElement(node.getId());
int index = 1;
index = this.processUserTaskConf(bpmConfNode, userTask.getAssignee(),
0, index);
for (String candidateUser : userTask.getCandidateUsers()) {
index = this.processUserTaskConf(bpmConfNode, candidateUser, 1,
index);
}
for (String candidateGroup : userTask.getCandidateGroups()) {
this.processUserTaskConf(bpmConfNode, candidateGroup, 2, index);
}
// 配置监听器
this.processListener(userTask.getExecutionListeners(), bpmConfNode);
this.processListener(userTask.getTaskListeners(), bpmConfNode);
// 配置表单
this.processForm(userTask, bpmConfNode);
// 会签
if (userTask.getLoopCharacteristics() != null) {
BpmConfCountersign bpmConfCountersign = new BpmConfCountersign();
bpmConfCountersign.setType(0);
bpmConfCountersign.setRate(100);
bpmConfCountersign.setBpmConfNode(bpmConfNode);
bpmConfCountersign.setSequential(userTask.getLoopCharacteristics()
.isSequential() ? 1 : 0);
getBpmConfCountersignManager().save(bpmConfCountersign);
}
// 更新TaskDefinition
TaskDefinitionConnector taskDefinitionConnector = this
.getTaskDefinitionConnector();
TaskDefinitionDTO taskDefinitionDto = new TaskDefinitionBuilder()
.setUserTask(userTask)
.setProcessDefinitionId(bpmConfBase.getProcessDefinitionId())
.build();
taskDefinitionConnector.create(taskDefinitionDto);
}
示例2: parseTaskDefinition
import org.activiti.bpmn.model.UserTask; //导入方法依赖的package包/类
public TaskDefinition parseTaskDefinition(BpmnParse bpmnParse, UserTask userTask, String taskDefinitionKey, ProcessDefinitionEntity processDefinition) {
TaskFormHandler taskFormHandler = new DefaultTaskFormHandler();
taskFormHandler.parseConfiguration(userTask.getFormProperties(), userTask.getFormKey(), bpmnParse.getDeployment(), processDefinition);
TaskDefinition taskDefinition = new TaskDefinition(taskFormHandler);
taskDefinition.setKey(taskDefinitionKey);
processDefinition.getTaskDefinitions().put(taskDefinitionKey, taskDefinition);
ExpressionManager expressionManager = bpmnParse.getExpressionManager();
if (StringUtils.isNotEmpty(userTask.getName())) {
taskDefinition.setNameExpression(expressionManager.createExpression(userTask.getName()));
}
if (StringUtils.isNotEmpty(userTask.getDocumentation())) {
taskDefinition.setDescriptionExpression(expressionManager.createExpression(userTask.getDocumentation()));
}
if (StringUtils.isNotEmpty(userTask.getAssignee())) {
taskDefinition.setAssigneeExpression(expressionManager.createExpression(userTask.getAssignee()));
}
if (StringUtils.isNotEmpty(userTask.getOwner())) {
taskDefinition.setOwnerExpression(expressionManager.createExpression(userTask.getOwner()));
}
for (String candidateUser : userTask.getCandidateUsers()) {
taskDefinition.addCandidateUserIdExpression(expressionManager.createExpression(candidateUser));
}
for (String candidateGroup : userTask.getCandidateGroups()) {
taskDefinition.addCandidateGroupIdExpression(expressionManager.createExpression(candidateGroup));
}
// Activiti custom extension
// Task listeners
for (ActivitiListener taskListener : userTask.getTaskListeners()) {
taskDefinition.addTaskListener(taskListener.getEvent(), createTaskListener(bpmnParse, taskListener, userTask.getId()));
}
// Due date
if (StringUtils.isNotEmpty(userTask.getDueDate())) {
taskDefinition.setDueDateExpression(expressionManager.createExpression(userTask.getDueDate()));
}
// Priority
if (StringUtils.isNotEmpty(userTask.getPriority())) {
taskDefinition.setPriorityExpression(expressionManager.createExpression(userTask.getPriority()));
}
return taskDefinition;
}