public class StartListener implements ExecutionListener {
private RepositoryService repositoryService;
public void notify(DelegateExecution execution) {
List<SysUserEntity> userList = Lists.newArrayList();
String crruentActivityId = execution.getCurrentActivityId();
BpmnModel bpmnModel = repositoryService.getBpmnModel(execution.getProcessDefinitionId());
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.processDefinitionId(execution.getProcessDefinitionId()).singleResult();
FlowNode flowNode = (FlowNode) bpmnModel.getFlowElement(crruentActivityId);
List<SequenceFlow> outFlows = flowNode.getOutgoingFlows();
for (SequenceFlow sequenceFlow : outFlows)
FlowElement targetFlow = sequenceFlow.getTargetFlowElement();
if (targetFlow instanceof UserTask)
UserTask userTask = (UserTask) targetFlow;
List<String> users = userTask.getCandidateUsers();
List<String> group = userTask.getCandidateGroups();
for (String str : users) {
userList.add(UserUtils.getByLoginName(str));
for (String str : group) {
userList.addAll(UserUtils.getUserListByRoleName(str));
《心脏病学》