use of org.jbpm.workflow.core.impl.DataAssociation in project kogito-runtimes by kiegroup.
the class IntermediateThrowEventHandler method handleSignalNode.
public void handleSignalNode(final Node node, final Element element, final String uri, final String localName, final Parser parser) throws SAXException {
ActionNode actionNode = (ActionNode) node;
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("signalEventDefinition".equals(nodeName)) {
String signalName = ((Element) xmlNode).getAttribute("signalRef");
String variable = findVariable((String) actionNode.getMetaData(MAPPING_VARIABLE), parser);
String inputVariable = findVariable((String) actionNode.getMetaData(MAPPING_VARIABLE_INPUT), parser);
signalName = checkSignalAndConvertToRealSignalNam(parser, signalName);
actionNode.setMetaData(EVENT_TYPE, "signal");
actionNode.setMetaData(Metadata.REF, signalName);
actionNode.setMetaData(Metadata.VARIABLE, variable);
List<DataAssociation> inputs = actionNode.getIoSpecification().getDataInputAssociation();
if (!inputs.isEmpty()) {
String type = inputs.get(0).getTarget().getType();
actionNode.setMetaData(SIGNAL_TYPE, type);
}
// check if signal should be send async
if (actionNode.getIoSpecification().containsInputLabel("async")) {
signalName = "ASYNC-" + signalName;
}
DroolsConsequenceAction action = createJavaAction(new SignalProcessInstanceAction(signalName, variable, inputVariable, (String) actionNode.getMetaData("customScope")));
actionNode.setAction(action);
}
xmlNode = xmlNode.getNextSibling();
}
}
use of org.jbpm.workflow.core.impl.DataAssociation in project kogito-runtimes by kiegroup.
the class AbstractNodeHandler method writeCatchIO.
protected void writeCatchIO(IOSpecification ioSpecification, StringBuilder xmlDump) {
for (DataDefinition output : ioSpecification.getDataOutput().values()) {
xmlDump.append(" <dataOutput id=\"" + output.getId() + "\" name=\"" + output.getLabel() + "\" />" + EOL);
}
for (DataAssociation output : ioSpecification.getDataOutputAssociation()) {
xmlDump.append(" <dataOutputAssociation>" + EOL);
writeDataAssociation(output, xmlDump);
xmlDump.append(" </dataOutputAssociation>" + EOL);
}
}
use of org.jbpm.workflow.core.impl.DataAssociation in project kogito-runtimes by kiegroup.
the class ExtendedNodeBuilder method buildDataAssociation.
protected void buildDataAssociation(PackageBuildContext context, Collection<DataAssociation> dataAssociations, Map<String, Object> parameters) {
for (DataAssociation dataAssociation : dataAssociations) {
Transformation transformation = dataAssociation.getTransformation();
if (transformation != null) {
DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage());
transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters));
}
List<Assignment> assignments = dataAssociation.getAssignments();
if (assignments != null) {
for (Assignment assignment : assignments) {
if (assignment.getDialect() != null) {
ProcessDialect processDialect = ProcessDialectRegistry.getDialect(assignment.getDialect());
processDialect.getAssignmentBuilder().build(context, assignment, dataAssociation.getSources(), dataAssociation.getTarget());
}
}
}
}
}
use of org.jbpm.workflow.core.impl.DataAssociation in project kogito-runtimes by kiegroup.
the class IntermediateCatchEventHandler method handleSignalNode.
protected void handleSignalNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
super.handleNode(node, element, uri, localName, parser);
EventNode eventNode = (EventNode) node;
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("signalEventDefinition".equals(nodeName)) {
String type = ((Element) xmlNode).getAttribute("signalRef");
if (type != null && type.trim().length() > 0) {
type = checkSignalAndConvertToRealSignalNam(parser, type);
List<EventFilter> eventFilters = new ArrayList<EventFilter>();
EventTypeFilter eventFilter = new EventTypeFilter();
eventFilter.setType(type);
eventFilters.add(eventFilter);
eventNode.setEventFilters(eventFilters);
}
List<DataAssociation> inputs = eventNode.getIoSpecification().getDataInputAssociation();
if (!inputs.isEmpty()) {
String signalType = inputs.get(0).getTarget().getType();
eventNode.setMetaData(SIGNAL_TYPE, signalType);
}
}
xmlNode = xmlNode.getNextSibling();
}
}
use of org.jbpm.workflow.core.impl.DataAssociation in project kogito-runtimes 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;
org.w3c.dom.Node xmlNode = element.getFirstChild();
while (xmlNode != null) {
String nodeName = xmlNode.getNodeName();
if ("signalEventDefinition".equals(nodeName)) {
String signalName = ((Element) xmlNode).getAttribute("signalRef");
String variable = findVariable((String) actionNode.getMetaData(MAPPING_VARIABLE), parser);
String inputVariable = findVariable((String) actionNode.getMetaData(MAPPING_VARIABLE_INPUT), parser);
signalName = checkSignalAndConvertToRealSignalNam(parser, signalName);
actionNode.setMetaData(EVENT_TYPE, "signal");
actionNode.setMetaData(Metadata.REF, signalName);
actionNode.setMetaData(Metadata.VARIABLE, variable);
List<DataAssociation> inputs = actionNode.getIoSpecification().getDataInputAssociation();
if (!inputs.isEmpty()) {
String type = inputs.get(0).getTarget().getType();
actionNode.setMetaData(SIGNAL_TYPE, type);
}
// check if signal should be send async
if (actionNode.getIoSpecification().containsInputLabel("async")) {
signalName = "ASYNC-" + signalName;
}
DroolsConsequenceAction action = createJavaAction(new SignalProcessInstanceAction(signalName, variable, inputVariable, (String) actionNode.getMetaData("customScope")));
actionNode.setAction(action);
}
xmlNode = xmlNode.getNextSibling();
}
}
Aggregations