// const0
ConstantNode const0 = (ConstantNode) workflow.addNode(this.constantComponent);
const0.setPosition(new Point(20, 180));
// if
IfNode ifNode = (IfNode) workflow.addNode(this.ifComponent);
ifNode.setPosition(new Point(170, 180));
// Adder nodes
Component adderComp = this.componentRegistry.getComponent(Adder.WSDL_PATH);
Node adder = workflow.addNode(adderComp);
adder.setPosition(new Point(400, 10));
// Multiplier node
Component multiComp = this.componentRegistry.getComponent(Multiplier.WSDL_PATH);
Node multiplier = workflow.addNode(multiComp);
multiplier.setPosition(new Point(400, 90));
// endif
Node endif = workflow.addNode(this.endifComponent);
endif.setPosition(new Point(550, 40));
// Output
OutputNode output = (OutputNode) workflow.addNode(this.outputComponent);
output.setConfiguredName("output");
output.setPosition(new Point(700, 40));
// Connect ports
graph.addEdge(x.getOutputPort(0), adder.getInputPort(0));
graph.addEdge(x.getOutputPort(0), multiplier.getInputPort(0));
graph.addEdge(y.getOutputPort(0), adder.getInputPort(1));
graph.addEdge(y.getOutputPort(0), multiplier.getInputPort(1));
graph.addEdge(const0.getOutputPort(0), ifNode.getInputPort(0));
graph.addEdge(ifNode.getControlOutPorts().get(0), adder.getControlInPort());
graph.addEdge(ifNode.getControlOutPorts().get(1), multiplier.getControlInPort());
graph.addEdge(adder.getOutputPort(0), endif.getInputPort(0));
graph.addEdge(multiplier.getOutputPort(0), endif.getInputPort(1));
graph.addEdge(endif.getOutputPort(0), output.getInputPort(0));
// Set the default values
// This needs to be after connection.
x.setDefaultValue("2");
y.setDefaultValue("3");
const0.setValue("adder");
ifNode.setXPath("$0 = 'adder'");
return workflow;
}