}
NodeList processStates = document.getElementsByTagName(PROCESS_STATE_NODE);
for (int i = 0; i < processStates.getLength(); i++) {
Node node = processStates.item(i);
Subprocess subprocess = create(node, definition);
List<VariableMapping> variablesList = new ArrayList<VariableMapping>();
NodeList nodeList = node.getChildNodes();
for (int j = 0; j < nodeList.getLength(); j++) {
Node childNode = nodeList.item(j);
if (SUB_PROCESS_NODE.equals(childNode.getNodeName())) {
subprocess.setSubProcessName(getAttribute(childNode, NAME_ATTR));
}
if (VARIABLE_NODE.equals(childNode.getNodeName())) {
VariableMapping variable = new VariableMapping();
variable.setProcessVariable(getAttribute(childNode, NAME_ATTR));
variable.setSubprocessVariable(getAttribute(childNode, MAPPED_NAME_ATTR));
variable.setUsage(getAttribute(childNode, ACCESS_ATTR));
variablesList.add(variable);
}
}
subprocess.setVariablesList(variablesList);
}
NodeList endStates = document.getElementsByTagName(END_STATE_NODE);
for (int i = 0; i < endStates.getLength(); i++) {
Node node = endStates.item(i);
create(node, definition);