Java Code Examples for org.activiti.bpmn.model.UserTask#setAssignee()
The following examples show how to use
org.activiti.bpmn.model.UserTask#setAssignee() .
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: DeploymentServiceImpl.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
protected void processUserTasks(Collection<FlowElement> flowElements, Process process, Map<String, StartEvent> startEventMap) { for (FlowElement flowElement : flowElements) { if (flowElement instanceof UserTask) { UserTask userTask = (UserTask) flowElement; if ("$INITIATOR".equals(userTask.getAssignee())) { if (startEventMap.get(process.getId()) != null) { userTask.setAssignee("${" + startEventMap.get(process.getId()).getInitiator() + "}"); } } } else if (flowElement instanceof SubProcess) { processUserTasks(((SubProcess) flowElement).getFlowElements(), process, startEventMap); } } }
Example 2
Source File: TestProcessUtil.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public static org.activiti.bpmn.model.Process createOneTaskProcess() { org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process(); process.setId("oneTaskProcess"); process.setName("The one task process"); StartEvent startEvent = new StartEvent(); startEvent.setId("start"); process.addFlowElement(startEvent); UserTask userTask = new UserTask(); userTask.setName("The Task"); userTask.setId("theTask"); userTask.setAssignee("kermit"); process.addFlowElement(userTask); EndEvent endEvent = new EndEvent(); endEvent.setId("theEnd"); process.addFlowElement(endEvent); process.addFlowElement(new SequenceFlow("start", "theTask")); process.addFlowElement(new SequenceFlow("theTask", "theEnd")); return process; }
Example 3
Source File: TestProcessUtil.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public static org.activiti.bpmn.model.Process createOneTaskProcess() { org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process(); process.setId("oneTaskProcess"); process.setName("The one task process"); StartEvent startEvent = new StartEvent(); startEvent.setId("start"); process.addFlowElement(startEvent); UserTask userTask = new UserTask(); userTask.setName("The Task"); userTask.setId("theTask"); userTask.setAssignee("kermit"); process.addFlowElement(userTask); EndEvent endEvent = new EndEvent(); endEvent.setId("theEnd"); process.addFlowElement(endEvent); process.addFlowElement(new SequenceFlow("start", "theTask")); process.addFlowElement(new SequenceFlow("theTask", "theEnd")); return process; }
Example 4
Source File: AbstractActivitiTestCase.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
/** * Since the 'one task process' is used everywhere the actual process content doesn't matter, instead of copying around the BPMN 2.0 xml one could use this method which gives a {@link BpmnModel} * version of the same process back. */ public BpmnModel createOneTaskTestProcess() { BpmnModel model = new BpmnModel(); org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process(); model.addProcess(process); process.setId("oneTaskProcess"); process.setName("The one task process"); StartEvent startEvent = new StartEvent(); startEvent.setId("start"); process.addFlowElement(startEvent); UserTask userTask = new UserTask(); userTask.setName("The Task"); userTask.setId("theTask"); userTask.setAssignee("kermit"); process.addFlowElement(userTask); EndEvent endEvent = new EndEvent(); endEvent.setId("theEnd"); process.addFlowElement(endEvent); process.addFlowElement(new SequenceFlow("start", "theTask")); process.addFlowElement(new SequenceFlow("theTask", "theEnd")); return model; }
Example 5
Source File: AbstractActivitiTestCase.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public BpmnModel createTwoTasksTestProcess() { BpmnModel model = new BpmnModel(); org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process(); model.addProcess(process); process.setId("twoTasksProcess"); process.setName("The two tasks process"); StartEvent startEvent = new StartEvent(); startEvent.setId("start"); process.addFlowElement(startEvent); UserTask userTask = new UserTask(); userTask.setName("The First Task"); userTask.setId("task1"); userTask.setAssignee("kermit"); process.addFlowElement(userTask); UserTask userTask2 = new UserTask(); userTask2.setName("The Second Task"); userTask2.setId("task2"); userTask2.setAssignee("kermit"); process.addFlowElement(userTask2); EndEvent endEvent = new EndEvent(); endEvent.setId("theEnd"); process.addFlowElement(endEvent); process.addFlowElement(new SequenceFlow("start", "task1")); process.addFlowElement(new SequenceFlow("start", "task2")); process.addFlowElement(new SequenceFlow("task1", "theEnd")); process.addFlowElement(new SequenceFlow("task2", "theEnd")); return model; }
Example 6
Source File: TestProcessUtil.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public static BpmnModel createTwoTasksBpmnModel() { BpmnModel model = new BpmnModel(); org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process(); model.addProcess(process); process.setId("twoTasksProcess"); process.setName("The two tasks process"); StartEvent startEvent = new StartEvent(); startEvent.setId("start"); process.addFlowElement(startEvent); UserTask userTask = new UserTask(); userTask.setName("The First Task"); userTask.setId("task1"); userTask.setAssignee("kermit"); process.addFlowElement(userTask); UserTask userTask2 = new UserTask(); userTask2.setName("The Second Task"); userTask2.setId("task2"); userTask2.setAssignee("kermit"); process.addFlowElement(userTask2); EndEvent endEvent = new EndEvent(); endEvent.setId("theEnd"); process.addFlowElement(endEvent); process.addFlowElement(new SequenceFlow("start", "task1")); process.addFlowElement(new SequenceFlow("start", "task2")); process.addFlowElement(new SequenceFlow("task1", "theEnd")); process.addFlowElement(new SequenceFlow("task2", "theEnd")); return model; }
Example 7
Source File: EventJavaTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testStartEventWithExecutionListener() throws Exception { BpmnModel bpmnModel = new BpmnModel(); Process process = new Process(); process.setId("simpleProcess"); process.setName("Very simple process"); bpmnModel.getProcesses().add(process); StartEvent startEvent = new StartEvent(); startEvent.setId("startEvent1"); TimerEventDefinition timerDef = new TimerEventDefinition(); timerDef.setTimeDuration("PT5M"); startEvent.getEventDefinitions().add(timerDef); ActivitiListener listener = new ActivitiListener(); listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION); listener.setImplementation("${test}"); listener.setEvent("end"); startEvent.getExecutionListeners().add(listener); process.addFlowElement(startEvent); UserTask task = new UserTask(); task.setId("reviewTask"); task.setAssignee("kermit"); process.addFlowElement(task); SequenceFlow flow1 = new SequenceFlow(); flow1.setId("flow1"); flow1.setSourceRef("startEvent1"); flow1.setTargetRef("reviewTask"); process.addFlowElement(flow1); EndEvent endEvent = new EndEvent(); endEvent.setId("endEvent1"); process.addFlowElement(endEvent); byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel); new BpmnXMLConverter().validateModel(new InputStreamSource(new ByteArrayInputStream(xml))); Deployment deployment = repositoryService.createDeployment().name("test").addString("test.bpmn20.xml", new String(xml)).deploy(); repositoryService.deleteDeployment(deployment.getId()); }
Example 8
Source File: AbstractActivitiTestCase.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
/** * Since the 'one task process' is used everywhere the actual process content * doesn't matter, instead of copying around the BPMN 2.0 xml one could use * this method which gives a {@link BpmnModel} version of the same process back. */ public BpmnModel createOneTaskTestProcess() { BpmnModel model = new BpmnModel(); org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process(); model.addProcess(process); process.setId("oneTaskProcess"); process.setName("The one task process"); StartEvent startEvent = new StartEvent(); startEvent.setId("start"); process.addFlowElement(startEvent); UserTask userTask = new UserTask(); userTask.setName("The Task"); userTask.setId("theTask"); userTask.setAssignee("kermit"); process.addFlowElement(userTask); EndEvent endEvent = new EndEvent(); endEvent.setId("theEnd"); process.addFlowElement(endEvent); process.addFlowElement(new SequenceFlow("start", "theTask")); process.addFlowElement(new SequenceFlow("theTask", "theEnd")); return model; }
Example 9
Source File: AbstractActivitiTestCase.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public BpmnModel createTwoTasksTestProcess() { BpmnModel model = new BpmnModel(); org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process(); model.addProcess(process); process.setId("twoTasksProcess"); process.setName("The two tasks process"); StartEvent startEvent = new StartEvent(); startEvent.setId("start"); process.addFlowElement(startEvent); UserTask userTask = new UserTask(); userTask.setName("The First Task"); userTask.setId("task1"); userTask.setAssignee("kermit"); process.addFlowElement(userTask); UserTask userTask2 = new UserTask(); userTask2.setName("The Second Task"); userTask2.setId("task2"); userTask2.setAssignee("kermit"); process.addFlowElement(userTask2); EndEvent endEvent = new EndEvent(); endEvent.setId("theEnd"); process.addFlowElement(endEvent); process.addFlowElement(new SequenceFlow("start", "task1")); process.addFlowElement(new SequenceFlow("start", "task2")); process.addFlowElement(new SequenceFlow("task1", "theEnd")); process.addFlowElement(new SequenceFlow("task2", "theEnd")); return model; }
Example 10
Source File: TestProcessUtil.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public static BpmnModel createTwoTasksBpmnModel() { BpmnModel model = new BpmnModel(); org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process(); model.addProcess(process); process.setId("twoTasksProcess"); process.setName("The two tasks process"); StartEvent startEvent = new StartEvent(); startEvent.setId("start"); process.addFlowElement(startEvent); UserTask userTask = new UserTask(); userTask.setName("The First Task"); userTask.setId("task1"); userTask.setAssignee("kermit"); process.addFlowElement(userTask); UserTask userTask2 = new UserTask(); userTask2.setName("The Second Task"); userTask2.setId("task2"); userTask2.setAssignee("kermit"); process.addFlowElement(userTask2); EndEvent endEvent = new EndEvent(); endEvent.setId("theEnd"); process.addFlowElement(endEvent); process.addFlowElement(new SequenceFlow("start", "task1")); process.addFlowElement(new SequenceFlow("start", "task2")); process.addFlowElement(new SequenceFlow("task1", "theEnd")); process.addFlowElement(new SequenceFlow("task2", "theEnd")); return model; }
Example 11
Source File: EventJavaTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void testStartEventWithExecutionListener() throws Exception { BpmnModel bpmnModel = new BpmnModel(); Process process = new Process(); process.setId("simpleProcess"); process.setName("Very simple process"); bpmnModel.getProcesses().add(process); StartEvent startEvent = new StartEvent(); startEvent.setId("startEvent1"); TimerEventDefinition timerDef = new TimerEventDefinition(); timerDef.setTimeDuration("PT5M"); startEvent.getEventDefinitions().add(timerDef); ActivitiListener listener = new ActivitiListener(); listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION); listener.setImplementation("${test}"); listener.setEvent("end"); startEvent.getExecutionListeners().add(listener); process.addFlowElement(startEvent); UserTask task = new UserTask(); task.setId("reviewTask"); task.setAssignee("kermit"); process.addFlowElement(task); SequenceFlow flow1 = new SequenceFlow(); flow1.setId("flow1"); flow1.setSourceRef("startEvent1"); flow1.setTargetRef("reviewTask"); process.addFlowElement(flow1); EndEvent endEvent = new EndEvent(); endEvent.setId("endEvent1"); process.addFlowElement(endEvent); byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel); new BpmnXMLConverter().validateModel(new InputStreamSource(new ByteArrayInputStream(xml))); Deployment deployment = repositoryService.createDeployment().name("test").addString("test.bpmn20.xml", new String(xml)) .deploymentProperty(DeploymentProperties.DEPLOY_AS_ACTIVITI5_PROCESS_DEFINITION, Boolean.TRUE) .deploy(); repositoryService.deleteDeployment(deployment.getId()); }
Example 12
Source File: DynamicProcess.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
protected UserTask createUserTask(String id, String name, String assignee) { UserTask userTask = new UserTask(); userTask.setName(name); userTask.setId(id); userTask.setAssignee(assignee); return userTask; }
Example 13
Source File: UserTaskJsonConverter.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
@Override protected FlowElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap) { UserTask task = new UserTask(); task.setPriority(getPropertyValueAsString(PROPERTY_USERTASK_PRIORITY, elementNode)); String formKey = getPropertyValueAsString(PROPERTY_FORMKEY, elementNode); if (StringUtils.isNotEmpty(formKey)) { task.setFormKey(formKey); } else { JsonNode formReferenceNode = getProperty(PROPERTY_FORM_REFERENCE, elementNode); if (formReferenceNode != null && formReferenceNode.get("id") != null) { if (formMap != null && formMap.containsKey(formReferenceNode.get("id").asText())) { task.setFormKey(formMap.get(formReferenceNode.get("id").asText())); } } } task.setDueDate(getPropertyValueAsString(PROPERTY_USERTASK_DUEDATE, elementNode)); task.setCategory(getPropertyValueAsString(PROPERTY_USERTASK_CATEGORY, elementNode)); JsonNode assignmentNode = getProperty(PROPERTY_USERTASK_ASSIGNMENT, elementNode); if (assignmentNode != null) { JsonNode assignmentDefNode = assignmentNode.get("assignment"); if (assignmentDefNode != null) { JsonNode typeNode = assignmentDefNode.get("type"); JsonNode canCompleteTaskNode = assignmentDefNode.get("initiatorCanCompleteTask"); if (typeNode == null || "static".equalsIgnoreCase(typeNode.asText())) { JsonNode assigneeNode = assignmentDefNode.get(PROPERTY_USERTASK_ASSIGNEE); if (assigneeNode != null && assigneeNode.isNull() == false) { task.setAssignee(assigneeNode.asText()); } task.setCandidateUsers(getValueAsList(PROPERTY_USERTASK_CANDIDATE_USERS, assignmentDefNode)); task.setCandidateGroups(getValueAsList(PROPERTY_USERTASK_CANDIDATE_GROUPS, assignmentDefNode)); if (StringUtils.isNotEmpty(task.getAssignee()) && "$INITIATOR".equalsIgnoreCase(task.getAssignee()) == false) { if (canCompleteTaskNode != null && canCompleteTaskNode.isNull() == false) { addInitiatorCanCompleteExtensionElement(Boolean.valueOf(canCompleteTaskNode.asText()), task); } else { addInitiatorCanCompleteExtensionElement(false, task); } } else if (StringUtils.isNotEmpty(task.getAssignee()) && "$INITIATOR".equalsIgnoreCase(task.getAssignee())) { addInitiatorCanCompleteExtensionElement(true, task); } } else if ("idm".equalsIgnoreCase(typeNode.asText())) { JsonNode idmDefNode = assignmentDefNode.get("idm"); if (idmDefNode != null && idmDefNode.has("type")) { JsonNode idmTypeNode = idmDefNode.get("type"); if (idmTypeNode != null && "user".equalsIgnoreCase(idmTypeNode.asText()) && (idmDefNode.has("assignee") || idmDefNode.has("assigneeField"))) { fillAssigneeInfo(idmDefNode, canCompleteTaskNode, task); } else if (idmTypeNode != null && "users".equalsIgnoreCase(idmTypeNode.asText()) && (idmDefNode.has("candidateUsers") || idmDefNode.has("candidateUserFields"))) { fillCandidateUsers(idmDefNode, canCompleteTaskNode, task); } else if (idmTypeNode != null && "groups".equalsIgnoreCase(idmTypeNode.asText()) && (idmDefNode.has("candidateGroups") || idmDefNode.has("candidateGroupFields"))) { fillCandidateGroups(idmDefNode, canCompleteTaskNode, task); } else { task.setAssignee("$INITIATOR"); addExtensionElement("activiti-idm-initiator", String.valueOf(true), task); } } } } } convertJsonToFormProperties(elementNode, task); return task; }