JsonNode itemsNode = assignmentNode.get(EDITOR_PROPERTIES_GENERAL_ITEMS);
if(itemsNode != null) {
Iterator<JsonNode> assignmentIterator = itemsNode.getElements();
while (assignmentIterator.hasNext()) {
JsonNode assignmentItemNode = assignmentIterator.next();
PotentialOwner potentialOwner = Bpmn2Factory.eINSTANCE.createPotentialOwner();
String resourceType = assignmentItemNode.get(PROPERTY_USERTASK_RESOURCE_TYPE).asText();
String includeExclusion = "INCLUDE";
String isContainSub = assignmentItemNode.get(PROPERTY_USERTASK_RESOURCE_IS_CONTAINSSUB).asText();
String resourceName = assignmentItemNode.get(PROPERTY_USERTASK_RESOURCE_NAME).asText();
String expressionBody = assignmentItemNode.get(PROPERTY_USERTASK_RESOURCE_EXPRESSION).asText();
BpmnModelUtil.addExtensionAttribute(potentialOwner, FixFlowPackage.Literals.DOCUMENT_ROOT__RESOURCE_TYPE, resourceType);
BpmnModelUtil.addExtensionAttribute(potentialOwner, FixFlowPackage.Literals.DOCUMENT_ROOT__INCLUDE_EXCLUSION, includeExclusion);
BpmnModelUtil.addExtensionAttribute(potentialOwner, FixFlowPackage.Literals.DOCUMENT_ROOT__IS_CONTAINS_SUB, isContainSub);
ResourceAssignmentExpression resourceAssignmentExpression = Bpmn2Factory.eINSTANCE.createResourceAssignmentExpression();
potentialOwner.setName(resourceName);
FormalExpression formalExpression = Bpmn2Factory.eINSTANCE.createFormalExpression();
formalExpression.setBody(expressionBody);
formalExpression.setId(expressionBody);
resourceAssignmentExpression.setExpression(formalExpression);
potentialOwner.setResourceAssignmentExpression(resourceAssignmentExpression);
task.getResources().add(potentialOwner);
}
}
}
return task;