Java Code Examples for org.activiti.engine.impl.task.TaskDefinition#addTaskListener()
The following examples show how to use
org.activiti.engine.impl.task.TaskDefinition#addTaskListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProxyUserTaskBpmnParseHandler.java From lemon with Apache License 2.0 | 5 votes |
public void configEvent(TaskDefinition taskDefinition, BpmnParse bpmnParse, String eventName) { ActivitiListener activitiListener = new ActivitiListener(); activitiListener.setEvent(eventName); activitiListener .setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION); activitiListener.setImplementation("#{" + taskListenerId + "}"); taskDefinition .addTaskListener(eventName, bpmnParse.getListenerFactory() .createDelegateExpressionTaskListener(activitiListener)); }
Example 2
Source File: UserTaskParseHandler.java From flowable-engine with Apache License 2.0 | 4 votes |
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 (FlowableListener 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())); } // Business calendar name if (StringUtils.isNotEmpty(userTask.getBusinessCalendarName())) { taskDefinition.setBusinessCalendarNameExpression(expressionManager.createExpression(userTask.getBusinessCalendarName())); } else { taskDefinition.setBusinessCalendarNameExpression(expressionManager.createExpression(DueDateBusinessCalendar.NAME)); } // Category if (StringUtils.isNotEmpty(userTask.getCategory())) { taskDefinition.setCategoryExpression(expressionManager.createExpression(userTask.getCategory())); } // Priority if (StringUtils.isNotEmpty(userTask.getPriority())) { taskDefinition.setPriorityExpression(expressionManager.createExpression(userTask.getPriority())); } if (StringUtils.isNotEmpty(userTask.getFormKey())) { taskDefinition.setFormKeyExpression(expressionManager.createExpression(userTask.getFormKey())); } // CustomUserIdentityLinks for (String customUserIdentityLinkType : userTask.getCustomUserIdentityLinks().keySet()) { Set<Expression> userIdentityLinkExpression = new HashSet<>(); for (String userIdentityLink : userTask.getCustomUserIdentityLinks().get(customUserIdentityLinkType)) { userIdentityLinkExpression.add(expressionManager.createExpression(userIdentityLink)); } taskDefinition.addCustomUserIdentityLinkExpression(customUserIdentityLinkType, userIdentityLinkExpression); } // CustomGroupIdentityLinks for (String customGroupIdentityLinkType : userTask.getCustomGroupIdentityLinks().keySet()) { Set<Expression> groupIdentityLinkExpression = new HashSet<>(); for (String groupIdentityLink : userTask.getCustomGroupIdentityLinks().get(customGroupIdentityLinkType)) { groupIdentityLinkExpression.add(expressionManager.createExpression(groupIdentityLink)); } taskDefinition.addCustomGroupIdentityLinkExpression(customGroupIdentityLinkType, groupIdentityLinkExpression); } if (StringUtils.isNotEmpty(userTask.getSkipExpression())) { taskDefinition.setSkipExpression(expressionManager.createExpression(userTask.getSkipExpression())); } return taskDefinition; }
Example 3
Source File: UserTaskHistoryParseHandler.java From flowable-engine with Apache License 2.0 | 4 votes |
@Override protected void executeParse(BpmnParse bpmnParse, UserTask element) { TaskDefinition taskDefinition = (TaskDefinition) bpmnParse.getCurrentActivity().getProperty(UserTaskParseHandler.PROPERTY_TASK_DEFINITION); taskDefinition.addTaskListener(TaskListener.EVENTNAME_ASSIGNMENT, USER_TASK_ASSIGNMENT_HANDLER); taskDefinition.addTaskListener(TaskListener.EVENTNAME_CREATE, USER_TASK_ID_HANDLER); }