startNode.addTrigger(trigger);
break;
} else if ("signalEventDefinition".equals(nodeName)) {
String type = ((Element) xmlNode).getAttribute("signalRef");
if (type != null && type.trim().length() > 0) {
EventTrigger trigger = new EventTrigger();
EventTypeFilter eventFilter = new EventTypeFilter();
eventFilter.setType(type);
trigger.addEventFilter(eventFilter);
String mapping = (String) startNode.getMetaData("TriggerMapping");
if (mapping != null) {
trigger.addInMapping(mapping, "event");
}
startNode.addTrigger(trigger);
}
} else if ("messageEventDefinition".equals(nodeName)) {
String messageRef = ((Element) xmlNode).getAttribute("messageRef");
Map<String, Message> messages = (Map<String, Message>)
((ProcessBuildData) parser.getData()).getMetaData("Messages");
if (messages == null) {
throw new IllegalArgumentException("No messages found");
}
Message message = messages.get(messageRef);
if (message == null) {
throw new IllegalArgumentException("Could not find message " + messageRef);
}
startNode.setMetaData("MessageType", message.getType());
EventTrigger trigger = new EventTrigger();
EventTypeFilter eventFilter = new EventTypeFilter();
eventFilter.setType("Message-" + messageRef);
trigger.addEventFilter(eventFilter);
String mapping = (String) startNode.getMetaData("TriggerMapping");
if (mapping != null) {
trigger.addInMapping(mapping, "event");
}
startNode.addTrigger(trigger);
} else if ("timerEventDefinition".equals(nodeName)) {
org.w3c.dom.Node subNode = xmlNode.getFirstChild();
while (subNode instanceof Element) {
String subNodeName = subNode.getNodeName();
if ("timeCycle".equals(subNodeName)) {
String period = subNode.getTextContent();
String language = ((Element) subNode).getAttribute("language");
if (language == null || language.trim().length() == 0) {
language = "int";
}
if (period != null && period.trim().length() > 0) {
ConstraintTrigger trigger = new ConstraintTrigger();
trigger.setConstraint("");
if ("int".equals(language)) {
trigger.setHeader("timer (int:" + period + " " + period + ")");
} else {
trigger.setHeader("timer (" + language + ":" + period + ")");
}
startNode.addTrigger(trigger);
break;
}
}