use of org.jbpm.bpmn2.handler.SendSignalAction in project jbpm by kiegroup.
the class IntermediateThrowEventHandler method handleSignalNode.
public void handleSignalNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
ActionNode actionNode = (ActionNode) node;
String executeActionAfterCompleteMetadata = (String) node.getMetaData().get("executeActionAfterComplete");
Boolean executeActionAfterComplete = executeActionAfterCompleteMetadata != null && Boolean.parseBoolean(executeActionAfterCompleteMetadata);
actionNode.setExecuteActionAfterComplete(executeActionAfterComplete);
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("dataInput".equals(nodeName)) {
String id = ((Element) xmlNode).getAttribute("id");
String inputName = ((Element) xmlNode).getAttribute("name");
dataInputs.put(id, inputName);
} else if ("dataInputAssociation".equals(nodeName)) {
readDataInputAssociation(xmlNode, actionNode);
} else if ("signalEventDefinition".equals(nodeName)) {
String signalName = checkSignalAndConvertToRealSignalNam(parser, ((Element) xmlNode).getAttribute("signalRef"), s -> s.addOutgoingNode(node));
String variable = (String) actionNode.getMetaData("MappingVariable");
actionNode.setMetaData("EventType", "signal");
actionNode.setMetaData("Ref", signalName);
actionNode.setMetaData("Variable", variable);
actionNode.setAction(new JavaDroolsAction(new SendSignalAction(actionNode, variable, signalName, dataInputs.containsValue("async"))));
}
xmlNode = xmlNode.getNextSibling();
}
}
use of org.jbpm.bpmn2.handler.SendSignalAction in project jbpm by kiegroup.
the class EndEventHandler method handleSignalNode.
public void handleSignalNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
EndNode endNode = (EndNode) node;
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("dataInput".equals(nodeName)) {
String id = ((Element) xmlNode).getAttribute("id");
String inputName = ((Element) xmlNode).getAttribute("name");
dataInputs.put(id, inputName);
} else if ("dataInputAssociation".equals(nodeName)) {
readEndDataInputAssociation(xmlNode, endNode);
} else if ("signalEventDefinition".equals(nodeName)) {
String signalName = ((Element) xmlNode).getAttribute("signalRef");
String variable = (String) endNode.getMetaData("MappingVariable");
signalName = checkSignalAndConvertToRealSignalNam(parser, signalName, s -> s.addOutgoingNode(node));
endNode.setMetaData("EventType", "signal");
endNode.setMetaData("Ref", signalName);
endNode.setMetaData("Variable", variable);
endNode.setActions(EndNode.EVENT_NODE_ENTER, Collections.singletonList(new JavaDroolsAction(new SendSignalAction(endNode, variable, signalName, dataInputs.containsValue("async")))));
}
xmlNode = xmlNode.getNextSibling();
}
}
use of org.jbpm.bpmn2.handler.SendSignalAction in project jbpm by kiegroup.
the class AbstractNodeHandler method writeJavaAction.
protected void writeJavaAction(Node node, JavaAction action, StringBuilder xmlDump) {
if (action instanceof SendSignalAction) {
SendSignalAction signalAction = (SendSignalAction) action;
String variable = signalAction.getVariable();
if (variable != null) {
xmlDump.append(" <dataInput id=\"" + XmlBPMNProcessDumper.getUniqueNodeId(node) + "_Input\" />" + EOL + " <dataInputAssociation>" + EOL + " <sourceRef>" + XmlDumper.replaceIllegalChars(variable) + "</sourceRef>" + EOL + " <targetRef>" + XmlBPMNProcessDumper.getUniqueNodeId(node) + "_Input</targetRef>" + EOL + " </dataInputAssociation>" + EOL + " <inputSet>" + EOL + " <dataInputRefs>" + XmlBPMNProcessDumper.getUniqueNodeId(node) + "_Input</dataInputRefs>" + EOL + " </inputSet>" + EOL);
}
xmlDump.append(" <signalEventDefinition signalRef=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(signalAction.getSignalName()) + "\"/>" + EOL);
} else if (action instanceof SendMessageAction) {
SendMessageAction signalAction = (SendMessageAction) action;
String variable = signalAction.getVariable();
if (variable != null) {
xmlDump.append(" <dataInput id=\"" + XmlBPMNProcessDumper.getUniqueNodeId(node) + "_Input\" />" + EOL + " <dataInputAssociation>" + EOL + " <sourceRef>" + XmlDumper.replaceIllegalChars(variable) + "</sourceRef>" + EOL + " <targetRef>" + XmlBPMNProcessDumper.getUniqueNodeId(node) + "_Input</targetRef>" + EOL + " </dataInputAssociation>" + EOL + " <inputSet>" + EOL + " <dataInputRefs>" + XmlBPMNProcessDumper.getUniqueNodeId(node) + "_Input</dataInputRefs>" + EOL + " </inputSet>" + EOL);
}
xmlDump.append(" <messageEventDefinition messageRef=\"" + XmlBPMNProcessDumper.getUniqueNodeId(node) + "_Message\"/>" + EOL);
}
}
Aggregations