} else if (assignmentValue.startsWith(groupPrefix)) { assignmentValue = assignmentValue.substring(groupPrefix.length(), assignmentValue.length() - 1).trim(); ((UserTask) parentElement).getCandidateGroups().add(assignmentValue); } else { ((UserTask) parentElement).getCandidateGroups().add(assignmentValue); if (model.containsResourceId(resourceId)) { Resource resource = model.getResource(resourceId); ((UserTask) parentElement).getCandidateGroups().add(resource.getName()); } else { Resource resource = new Resource(resourceId, resourceId); model.addResource(resource); ((UserTask) parentElement).getCandidateGroups().add(resource.getName());
public void parse(XMLStreamReader xtr, BpmnModel model) throws Exception { String resourceId = xtr.getAttributeValue(null, ATTRIBUTE_ID); String resourceName = xtr.getAttributeValue(null, ATTRIBUTE_NAME); Resource resource; if (model.containsResourceId(resourceId)) { resource = model.getResource(resourceId); resource.setName(resourceName); for (org.flowable.bpmn.model.Process process : model.getProcesses()) { for (FlowElement fe : process.getFlowElements()) { if (fe instanceof UserTask && ((UserTask) fe).getCandidateGroups().contains(resourceId)) { ((UserTask) fe).getCandidateGroups().remove(resourceId); ((UserTask) fe).getCandidateGroups().add(resourceName); } } } } else { resource = new Resource(resourceId, resourceName); model.addResource(resource); } BpmnXMLUtil.addXMLLocation(resource, xtr); } }
@Override protected ObjectNode createPropertiesNode(FlowElement flowElement, ObjectNode flowElementNode, ObjectMapper objectMapper) { UserTask userTask = (UserTask) flowElement; ObjectNode taskNameNode = objectMapper.createObjectNode(); putPropertyValue(BPMN_MODEL_VALUE, userTask.getName(), taskNameNode); putPropertyValue(DYNAMIC_VALUE, flowElementNode.path(USER_TASK_NAME), taskNameNode); ObjectNode assigneeNode = objectMapper.createObjectNode(); putPropertyValue(BPMN_MODEL_VALUE, userTask.getAssignee(), assigneeNode); putPropertyValue(DYNAMIC_VALUE, flowElementNode.path(USER_TASK_ASSIGNEE), assigneeNode); ObjectNode candidateUsersNode = objectMapper.createObjectNode(); putPropertyValue(BPMN_MODEL_VALUE, userTask.getCandidateUsers(), candidateUsersNode); putPropertyValue(DYNAMIC_VALUE, flowElementNode.path(USER_TASK_CANDIDATE_USERS), candidateUsersNode); ObjectNode candidateGroupsNode = objectMapper.createObjectNode(); putPropertyValue(BPMN_MODEL_VALUE, userTask.getCandidateGroups(), candidateGroupsNode); putPropertyValue(DYNAMIC_VALUE, flowElementNode.path(USER_TASK_CANDIDATE_GROUPS), candidateGroupsNode); ObjectNode propertiesNode = objectMapper.createObjectNode(); propertiesNode.set(USER_TASK_NAME, taskNameNode); propertiesNode.set(USER_TASK_ASSIGNEE, assigneeNode); propertiesNode.set(USER_TASK_CANDIDATE_USERS, candidateUsersNode); propertiesNode.set(USER_TASK_CANDIDATE_GROUPS, candidateGroupsNode); return propertiesNode; }
@Override protected ObjectNode createPropertiesNode(FlowElement flowElement, ObjectNode flowElementNode, ObjectMapper objectMapper) { UserTask userTask = (UserTask) flowElement; ObjectNode taskNameNode = objectMapper.createObjectNode(); putPropertyValue(BPMN_MODEL_VALUE, userTask.getName(), taskNameNode); putPropertyValue(DYNAMIC_VALUE, flowElementNode.path(USER_TASK_NAME), taskNameNode); ObjectNode assigneeNode = objectMapper.createObjectNode(); putPropertyValue(BPMN_MODEL_VALUE, userTask.getAssignee(), assigneeNode); putPropertyValue(DYNAMIC_VALUE, flowElementNode.path(USER_TASK_ASSIGNEE), assigneeNode); ObjectNode candidateUsersNode = objectMapper.createObjectNode(); putPropertyValue(BPMN_MODEL_VALUE, userTask.getCandidateUsers(), candidateUsersNode); putPropertyValue(DYNAMIC_VALUE, flowElementNode.path(USER_TASK_CANDIDATE_USERS), candidateUsersNode); ObjectNode candidateGroupsNode = objectMapper.createObjectNode(); putPropertyValue(BPMN_MODEL_VALUE, userTask.getCandidateGroups(), candidateGroupsNode); putPropertyValue(DYNAMIC_VALUE, flowElementNode.path(USER_TASK_CANDIDATE_GROUPS), candidateGroupsNode); ObjectNode propertiesNode = objectMapper.createObjectNode(); propertiesNode.set(USER_TASK_NAME, taskNameNode); propertiesNode.set(USER_TASK_ASSIGNEE, assigneeNode); propertiesNode.set(USER_TASK_CANDIDATE_USERS, candidateUsersNode); propertiesNode.set(USER_TASK_CANDIDATE_GROUPS, candidateGroupsNode); return propertiesNode; }
String assignee = userTask.getAssignee(); if (StringUtils.isNotEmpty(assignee) || CollectionUtils.isNotEmpty(userTask.getCandidateUsers()) || CollectionUtils.isNotEmpty(userTask.getCandidateGroups())) { if (CollectionUtils.isNotEmpty(userTask.getCandidateGroups()) && CollectionUtils.isNotEmpty(idmCandidateGroupList)) { if (userTask.getCandidateGroups().size() > 0) { ArrayNode candidateGroupsNode = objectMapper.createArrayNode(); idmNode.set("candidateGroups", candidateGroupsNode); idmNode.put("type", "groups"); for (String candidateGroup : userTask.getCandidateGroups()) { ObjectNode candidateGroupNode = objectMapper.createObjectNode(); candidateGroupNode.put("id", candidateGroup); if (CollectionUtils.isNotEmpty(userTask.getCandidateGroups())) { ArrayNode candidateArrayNode = objectMapper.createArrayNode(); for (String candidateGroup : userTask.getCandidateGroups()) { ObjectNode candidateNode = objectMapper.createObjectNode(); candidateNode.put("value", candidateGroup);
setSkipExpression(otherElement.getSkipExpression()); setCandidateGroups(new ArrayList<>(otherElement.getCandidateGroups())); setCandidateUsers(new ArrayList<>(otherElement.getCandidateUsers()));
setSkipExpression(otherElement.getSkipExpression()); setCandidateGroups(new ArrayList<>(otherElement.getCandidateGroups())); setCandidateUsers(new ArrayList<>(otherElement.getCandidateUsers()));
protected void mapProperties(Object element) { UserTask userTask = (UserTask) element; createPropertyNode("Assignee", userTask.getAssignee()); createPropertyNode("Candidate users", userTask.getCandidateUsers()); createPropertyNode("Candidate groups", userTask.getCandidateGroups()); createPropertyNode("Due date", userTask.getDueDate()); createPropertyNode("Form key", userTask.getFormKey()); createPropertyNode("Priority", userTask.getPriority()); } }
userTask.getCandidateGroups().addAll(parseDelimitedList(expression));
taskDefinition.addCandidateUserIdExpression(expressionManager.createExpression(candidateUser)); for (String candidateGroup : userTask.getCandidateGroups()) { taskDefinition.addCandidateGroupIdExpression(expressionManager.createExpression(candidateGroup));
@Override @SuppressWarnings("unchecked") protected void writeAdditionalAttributes(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception { UserTask userTask = (UserTask) element; writeQualifiedAttribute(ATTRIBUTE_TASK_USER_ASSIGNEE, userTask.getAssignee(), xtw); writeQualifiedAttribute(ATTRIBUTE_TASK_USER_OWNER, userTask.getOwner(), xtw); writeQualifiedAttribute(ATTRIBUTE_TASK_USER_CANDIDATEUSERS, convertToDelimitedString(userTask.getCandidateUsers()), xtw); writeQualifiedAttribute(ATTRIBUTE_TASK_USER_CANDIDATEGROUPS, convertToDelimitedString(userTask.getCandidateGroups()), xtw); writeQualifiedAttribute(ATTRIBUTE_TASK_USER_DUEDATE, userTask.getDueDate(), xtw); writeQualifiedAttribute(ATTRIBUTE_TASK_USER_BUSINESS_CALENDAR_NAME, userTask.getBusinessCalendarName(), xtw); writeQualifiedAttribute(ATTRIBUTE_TASK_USER_CATEGORY, userTask.getCategory(), xtw); writeQualifiedAttribute(ATTRIBUTE_FORM_FORMKEY, userTask.getFormKey(), xtw); if (userTask.getPriority() != null) { writeQualifiedAttribute(ATTRIBUTE_TASK_USER_PRIORITY, userTask.getPriority(), xtw); } if (StringUtils.isNotEmpty(userTask.getExtensionId())) { writeQualifiedAttribute(ATTRIBUTE_TASK_SERVICE_EXTENSIONID, userTask.getExtensionId(), xtw); } if (userTask.getSkipExpression() != null) { writeQualifiedAttribute(ATTRIBUTE_TASK_USER_SKIP_EXPRESSION, userTask.getSkipExpression(), xtw); } // write custom attributes BpmnXMLUtil.writeCustomAttributes(userTask.getAttributes().values(), xtw, defaultElementAttributes, defaultActivityAttributes, defaultUserTaskAttributes); }
activeTaskOwner = getActiveValue(userTask.getOwner(), DynamicBpmnConstants.USER_TASK_OWNER, taskElementProperties); activeTaskCandidateUsers = getActiveValueList(userTask.getCandidateUsers(), DynamicBpmnConstants.USER_TASK_CANDIDATE_USERS, taskElementProperties); activeTaskCandidateGroups = getActiveValueList(userTask.getCandidateGroups(), DynamicBpmnConstants.USER_TASK_CANDIDATE_GROUPS, taskElementProperties); activeTaskOwner = userTask.getOwner(); activeTaskCandidateUsers = userTask.getCandidateUsers(); activeTaskCandidateGroups = userTask.getCandidateGroups();