use of org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.SequenceFlowPropertyWriter in project kie-wb-common by kiegroup.
the class SequenceFlowConverter method toFlowElement.
public SequenceFlowPropertyWriter toFlowElement(Edge<?, ?> edge, ElementContainer process) {
ViewConnector<SequenceFlow> content = (ViewConnector<SequenceFlow>) edge.getContent();
SequenceFlow definition = content.getDefinition();
org.eclipse.bpmn2.SequenceFlow seq = bpmn2.createSequenceFlow();
SequenceFlowPropertyWriter p = propertyWriterFactory.of(seq);
seq.setId(edge.getUUID());
BasePropertyWriter pSrc = process.getChildElement(edge.getSourceNode().getUUID());
BasePropertyWriter pTgt = process.getChildElement(edge.getTargetNode().getUUID());
p.setSource(pSrc);
p.setTarget(pTgt);
seq.setId(edge.getUUID());
seq.setName(definition.getGeneral().getName().getValue());
p.setConnection(content);
SequenceFlowExecutionSet executionSet = definition.getExecutionSet();
ScriptTypeValue scriptTypeValue = executionSet.getConditionExpression().getValue();
String language = scriptTypeValue.getLanguage();
String script = scriptTypeValue.getScript();
if (script != null) {
FormalExpression formalExpression = bpmn2.createFormalExpression();
String uri = Scripts.scriptLanguageToUri(language);
formalExpression.setLanguage(uri);
formalExpression.setBody(asCData(script));
seq.setConditionExpression(formalExpression);
}
process.addChildElement(p);
process.addChildEdge(p.getEdge());
return p;
}
Aggregations