public Class generateNodeFor() {
return EventNode.class;
}
public void writeNode(Node node, StringBuilder xmlDump, int metaDataType) {
EventNode eventNode = (EventNode) node;
String attachedTo = (String) eventNode.getMetaData("AttachedTo");
if (attachedTo == null) {
writeNode("intermediateCatchEvent", eventNode, xmlDump, metaDataType);
xmlDump.append(">" + EOL);
if (eventNode.getVariableName() != null) {
xmlDump.append(" <dataOutput id=\"" + XmlBPMNProcessDumper.getUniqueNodeId(eventNode) + "_Output\" name=\"event\" />" + EOL);
xmlDump.append(" <dataOutputAssociation>" + EOL);
xmlDump.append(
" <sourceRef>" + XmlBPMNProcessDumper.getUniqueNodeId(eventNode) + "_Output</sourceRef>" + EOL +
" <targetRef>" + XmlDumper.replaceIllegalChars(eventNode.getVariableName()) + "</targetRef>" + EOL);
xmlDump.append(" </dataOutputAssociation>" + EOL);
xmlDump.append(" <outputSet>" + EOL);
xmlDump.append(" <dataOutputRefs>" + XmlBPMNProcessDumper.getUniqueNodeId(eventNode) + "_Output</dataOutputRefs>" + EOL);
xmlDump.append(" </outputSet>" + EOL);
}
if (eventNode.getEventFilters().size() > 0) {
String type = ((EventTypeFilter) eventNode.getEventFilters().get(0)).getType();
if (type.startsWith("Message-")) {
type = type.substring(8);
xmlDump.append(" <messageEventDefinition messageRef=\"" + XmlDumper.replaceIllegalChars(type) + "\"/>" + EOL);
} else {
xmlDump.append(" <signalEventDefinition signalRef=\"" + XmlDumper.replaceIllegalChars(type) + "\"/>" + EOL);
}
}
endNode("intermediateCatchEvent", xmlDump);
} else {
String type = ((EventTypeFilter) eventNode.getEventFilters().get(0)).getType();
if (type.startsWith("Escalation-")) {
type = type.substring(attachedTo.length() + 12);
boolean cancelActivity = (Boolean) eventNode.getMetaData("CancelActivity");
writeNode("boundaryEvent", eventNode, xmlDump, metaDataType);
xmlDump.append("attachedToRef=\"" + attachedTo + "\" ");
if (!cancelActivity) {
xmlDump.append("cancelActivity=\"false\" ");
}
xmlDump.append(">" + EOL);
xmlDump.append(" <escalationEventDefinition escalationRef=\"" + XmlDumper.replaceIllegalChars(type) + "\" />" + EOL);
endNode("boundaryEvent", xmlDump);
} else if (type.startsWith("Error-")) {
type = type.substring(attachedTo.length() + 7);
writeNode("boundaryEvent", eventNode, xmlDump, metaDataType);
xmlDump.append("attachedToRef=\"" + attachedTo + "\" ");
xmlDump.append(">" + EOL);
xmlDump.append(" <errorEventDefinition errorRef=\"" + XmlDumper.replaceIllegalChars(type) + "\" />" + EOL);
endNode("boundaryEvent", xmlDump);
} else if (type.startsWith("Timer-")) {
type = type.substring(attachedTo.length() + 7);
boolean cancelActivity = (Boolean) eventNode.getMetaData("CancelActivity");
writeNode("boundaryEvent", eventNode, xmlDump, metaDataType);
xmlDump.append("attachedToRef=\"" + attachedTo + "\" ");
if (!cancelActivity) {
xmlDump.append("cancelActivity=\"false\" ");
}
xmlDump.append(">" + EOL);
xmlDump.append(
" <timerEventDefinition>" + EOL +
" <timeCycle xs:type=\"tFormalExpression\">" + XmlDumper.replaceIllegalChars((String) eventNode.getMetaData("TimeCycle")) + "</timeCycle>" + EOL +
" </timerEventDefinition>" + EOL);
endNode("boundaryEvent", xmlDump);
} else if (type.startsWith("Compensate-")) {
type = type.substring(attachedTo.length() + 7);
writeNode("boundaryEvent", eventNode, xmlDump, metaDataType);