use of io.automatiko.engine.workflow.process.core.node.Assignment in project automatiko-engine by automatiko-io.
the class TaskHandler method readDataOutputAssociation.
protected void readDataOutputAssociation(org.w3c.dom.Node xmlNode, WorkItemNode workItemNode, Map<String, String> dataOutputs) {
// sourceRef
org.w3c.dom.Node subNode = xmlNode.getFirstChild();
List<String> sources = new ArrayList<>();
sources.add(subNode.getTextContent());
subNode = subNode.getNextSibling();
while ("sourceRef".equals(subNode.getNodeName())) {
sources.add(subNode.getTextContent());
subNode = subNode.getNextSibling();
}
// targetRef
String target = 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);
// transformation.setCompiledExpression(transformer.compile(expression));
subNode = subNode.getNextSibling();
}
// assignments
List<Assignment> assignments = new LinkedList<Assignment>();
while (subNode != null) {
String expressionLang = ((Element) subNode).getAttribute("expressionLanguage");
if (expressionLang == null || expressionLang.trim().isEmpty()) {
expressionLang = "XPath";
}
org.w3c.dom.Node ssubNode = subNode.getFirstChild();
String from = ssubNode.getTextContent();
String to = ssubNode.getNextSibling().getTextContent();
assignments.add(new Assignment(expressionLang, from, to));
subNode = subNode.getNextSibling();
}
workItemNode.addOutAssociation(new DataAssociation(sources.stream().map(source -> dataOutputs.get(source)).collect(Collectors.toList()), target, assignments, transformation));
}
use of io.automatiko.engine.workflow.process.core.node.Assignment in project automatiko-engine by automatiko-io.
the class CompositeContextNodeFactory method outMappingWithJqAssignment.
public CompositeContextNodeFactory outMappingWithJqAssignment(String stateDataFilter) {
Assignment outputAssignment = new Assignment("jq", "", "");
outputAssignment.setMetaData("Action", new OutputJqAssignmentAction(stateDataFilter));
getCompositeNode().addOutAssociation(new DataAssociation(Collections.emptyList(), "", Arrays.asList(outputAssignment), null));
return this;
}
use of io.automatiko.engine.workflow.process.core.node.Assignment in project automatiko-engine by automatiko-io.
the class CompositeContextNodeFactory method inMappingWithJqAssignment.
public CompositeContextNodeFactory inMappingWithJqAssignment(String stateDataFilter) {
Assignment inputAssignment = new Assignment("jq", "", "");
inputAssignment.setMetaData("Action", new InputJqAssignmentAction(stateDataFilter));
getCompositeNode().addInAssociation(new DataAssociation(Collections.emptyList(), "", Arrays.asList(inputAssignment), null));
return this;
}
use of io.automatiko.engine.workflow.process.core.node.Assignment in project automatiko-engine by automatiko-io.
the class MappableNodeFactory method outMappingWithJqAssignment.
default MappableNodeFactory outMappingWithJqAssignment(String outputExpression, String scopeExpression, boolean ignoreScopeExpression) {
Assignment outAssignment = new Assignment("jq", null, null);
outAssignment.setMetaData("Action", new TaskOutputJqAssignmentAction(outputExpression, scopeExpression, ignoreScopeExpression));
getMappableNode().addOutAssociation(new DataAssociation(Collections.emptyList(), "", Arrays.asList(outAssignment), null));
return this;
}
use of io.automatiko.engine.workflow.process.core.node.Assignment in project automatiko-engine by automatiko-io.
the class StartNodeFactory method outMapping.
public StartNodeFactory outMapping(String source, String target, String assignmentDialect, String assignmentFrom, String assignmentTo) {
List<Assignment> assignments = null;
if (assignmentFrom != null && assignmentTo != null) {
assignments = Arrays.asList(new Assignment(assignmentDialect, assignmentFrom, assignmentTo));
}
DataAssociation dataAssociation = new DataAssociation(source, target, assignments, null);
getStartNode().addOutAssociation(dataAssociation);
return this;
}
Aggregations