return create(node, parent, node.getNodeName());
}
@SuppressWarnings("unchecked")
private <T extends GraphElement> T create(Node node, GraphElement parent, String typeName) {
GraphElement element = JpdlVersionRegistry.getElementTypeDefinition(jpdlVersion, typeName).createElement();
if (parent != null) {
parent.addChild(element);
}
if (element instanceof NamedGraphElement) {
((NamedGraphElement) element).setName(getAttribute(node, NAME_ATTR));
}
NodeList nodeList = node.getChildNodes();
for (int j = 0; j < nodeList.getLength(); j++) {
Node childNode = nodeList.item(j);
if (DESCRIPTION_NODE.equals(childNode.getNodeName())) {
((Describable) element).setDescription(getTextContent(childNode));
}
if (HANDLER_NODE.equals(childNode.getNodeName()) || ASSIGNMENT_NODE.equals(childNode.getNodeName())) {
((Delegable) element).setDelegationClassName(getAttribute(childNode, CLASS_ATTR));
element.setDelegationConfiguration(getTextContent(childNode));
}
if (ACTION_NODE.equals(childNode.getNodeName())) {
// only transition actions loaded here
String eventType;
if (element instanceof Transition) {