use of org.jbpm.process.core.event.EventTransformerImpl in project jbpm by kiegroup.
the class IntermediateCatchEventHandler method readDataOutputAssociation.
protected void readDataOutputAssociation(org.w3c.dom.Node xmlNode, EventNode eventNode) {
// sourceRef
org.w3c.dom.Node subNode = xmlNode.getFirstChild();
String from = subNode.getTextContent();
// targetRef
subNode = subNode.getNextSibling();
String to = subNode.getTextContent();
eventNode.setVariableName(to);
// transformation
Transformation transformation = null;
subNode = subNode.getNextSibling();
if (subNode != null && "transformation".equals(subNode.getNodeName())) {
String lang = subNode.getAttributes().getNamedItem("language").getNodeValue();
String expression = subNode.getTextContent();
DataTransformer transformer = transformerRegistry.find(lang);
if (transformer == null) {
throw new IllegalArgumentException("No transformer registered for language " + lang);
}
transformation = new Transformation(lang, expression, dataOutputs.get(from));
eventNode.setMetaData("Transformation", transformation);
eventNode.setEventTransformer(new EventTransformerImpl(transformation));
}
}
use of org.jbpm.process.core.event.EventTransformerImpl in project jbpm by kiegroup.
the class BoundaryEventHandler method readDataOutputAssociation.
protected void readDataOutputAssociation(org.w3c.dom.Node xmlNode, EventNode eventNode) {
// sourceRef
org.w3c.dom.Node subNode = xmlNode.getFirstChild();
String from = subNode.getTextContent();
// targetRef
subNode = subNode.getNextSibling();
String to = subNode.getTextContent();
// transformation
Transformation transformation = null;
subNode = subNode.getNextSibling();
if (subNode != null && "transformation".equals(subNode.getNodeName())) {
String lang = subNode.getAttributes().getNamedItem("language").getNodeValue();
String expression = subNode.getTextContent();
DataTransformer transformer = transformerRegistry.find(lang);
if (transformer == null) {
throw new IllegalArgumentException("No transformer registered for language " + lang);
}
transformation = new Transformation(lang, expression, dataOutputs.get(from));
eventNode.setMetaData("Transformation", transformation);
eventNode.setEventTransformer(new EventTransformerImpl(transformation));
}
eventNode.setVariableName(to);
}
use of org.jbpm.process.core.event.EventTransformerImpl in project jbpm by kiegroup.
the class StartEventHandler method readDataOutputAssociation.
protected void readDataOutputAssociation(org.w3c.dom.Node xmlNode, StartNode startNode) {
// sourceRef
org.w3c.dom.Node subNode = xmlNode.getFirstChild();
if (!"sourceRef".equals(subNode.getNodeName())) {
throw new IllegalArgumentException("No sourceRef found in dataOutputAssociation in startEvent");
}
String source = subNode.getTextContent();
if (dataOutputs.get(source) == null) {
throw new IllegalArgumentException("No dataOutput could be found for the dataOutputAssociation.");
}
// targetRef
subNode = subNode.getNextSibling();
if (!"targetRef".equals(subNode.getNodeName())) {
throw new IllegalArgumentException("No targetRef found in dataOutputAssociation in startEvent");
}
String target = subNode.getTextContent();
startNode.setMetaData("TriggerMapping", target);
// transformation
Transformation transformation = null;
subNode = subNode.getNextSibling();
if (subNode != null && "transformation".equals(subNode.getNodeName())) {
String lang = subNode.getAttributes().getNamedItem("language").getNodeValue();
String expression = subNode.getTextContent();
DataTransformer transformer = transformerRegistry.find(lang);
if (transformer == null) {
throw new IllegalArgumentException("No transformer registered for language " + lang);
}
transformation = new Transformation(lang, expression, dataOutputs.get(source));
startNode.setMetaData("Transformation", transformation);
startNode.setEventTransformer(new EventTransformerImpl(transformation));
subNode = subNode.getNextSibling();
}
if (subNode != null) {
// no support for assignments
throw new UnsupportedOperationException(subNode.getNodeName() + " elements in dataOutputAssociations are not yet supported.");
}
startNode.addOutMapping(target, dataOutputs.get(source));
}
Aggregations