use of org.activiti.bpmn.model.Resource in project Activiti by Activiti.
the class ResourceParser method parse.
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.activiti.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);
}
Aggregations