use of org.kie.api.runtime.process.DataTransformer in project jbpm by kiegroup.
the class ActionNodeBuilder method build.
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) {
super.build(process, processDescr, context, node);
ActionNode actionNode = (ActionNode) node;
DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction();
ActionDescr actionDescr = new ActionDescr();
actionDescr.setText(action.getConsequence());
actionDescr.setResource(processDescr.getResource());
ProcessDialect dialect = ProcessDialectRegistry.getDialect(action.getDialect());
dialect.getActionBuilder().build(context, action, actionDescr, (NodeImpl) node);
Transformation transformation = (Transformation) node.getMetaData().get("Transformation");
if (transformation != null) {
WorkflowProcess wfProcess = (WorkflowProcess) process;
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("imports", wfProcess.getImports());
parameters.put("classloader", context.getConfiguration().getClassLoader());
DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage());
transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters));
}
}
use of org.kie.api.runtime.process.DataTransformer in project jbpm by kiegroup.
the class EventNodeBuilder method build.
@Override
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) {
Transformation transformation = (Transformation) node.getMetaData().get("Transformation");
if (transformation != null) {
WorkflowProcess wfProcess = (WorkflowProcess) process;
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("imports", wfProcess.getImports());
parameters.put("classloader", context.getConfiguration().getClassLoader());
DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage());
transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters));
}
}
use of org.kie.api.runtime.process.DataTransformer in project jbpm by kiegroup.
the class RuleSetNodeBuilder method build.
@Override
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) {
super.build(process, processDescr, context, node);
WorkflowProcess wfProcess = (WorkflowProcess) process;
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("imports", wfProcess.getImports());
parameters.put("classloader", context.getConfiguration().getClassLoader());
for (DataAssociation dataAssociation : ((RuleSetNode) node).getInAssociations()) {
Transformation transformation = dataAssociation.getTransformation();
if (transformation != null) {
DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage());
transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters));
}
}
for (DataAssociation dataAssociation : ((RuleSetNode) node).getOutAssociations()) {
Transformation transformation = dataAssociation.getTransformation();
if (transformation != null) {
DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage());
transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters));
}
}
}
use of org.kie.api.runtime.process.DataTransformer in project jbpm by kiegroup.
the class StartNodeBuilder method build.
@Override
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) {
super.build(process, processDescr, context, node);
Transformation transformation = (Transformation) node.getMetaData().get("Transformation");
if (transformation != null) {
WorkflowProcess wfProcess = (WorkflowProcess) process;
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("imports", wfProcess.getImports());
parameters.put("classloader", context.getConfiguration().getClassLoader());
DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage());
transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters));
}
}
use of org.kie.api.runtime.process.DataTransformer 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);
}
Aggregations