// Name, description
workflow.setName("Complex math workflow");
workflow.setDescription("Complex math workflow");
Graph graph = workflow.getGraph();
// Adder nodes
Component adderComp = this.componentRegistry
.getComponent(Adder.WSDL_PATH);
Node adderNode1 = workflow.addNode(adderComp);
adderNode1.setPosition(new Point(170, 50));
Node adderNode2 = workflow.addNode(adderComp);
adderNode2.setPosition(new Point(170, 210));
// Multiplier node
Component multiComp = this.componentRegistry
.getComponent(Multiplier.WSDL_PATH);
Node multiNode = workflow.addNode(multiComp);
multiNode.setPosition(new Point(320, 130));
// Input node 1
InputNode inputNode1 = (InputNode) workflow
.addNode(this.inputComponent);
inputNode1.setPosition(new Point(20, 30));
// Input node 2
InputNode inputNode2 = (InputNode) workflow
.addNode(this.inputComponent);
inputNode2.setPosition(new Point(20, 100));
// Input node 3
InputNode inputNode3 = (InputNode) workflow
.addNode(this.inputComponent);
inputNode3.setPosition(new Point(20, 170));
// Input node 4
InputNode inputNode4 = (InputNode) workflow
.addNode(this.inputComponent);
inputNode4.setPosition(new Point(20, 240));
// Output
OutputNode outputNode = (OutputNode) workflow
.addNode(this.outputComponent);
outputNode.setPosition(new Point(500, 130));
// Connect ports
graph.addEdge(inputNode1.getOutputPort(0), adderNode1.getInputPort(0));
graph.addEdge(inputNode2.getOutputPort(0), adderNode1.getInputPort(1));
graph.addEdge(inputNode3.getOutputPort(0), adderNode2.getInputPort(0));
graph.addEdge(inputNode4.getOutputPort(0), adderNode2.getInputPort(1));
graph.addEdge(adderNode1.getOutputPort(0), multiNode.getInputPort(0));
graph.addEdge(adderNode2.getOutputPort(0), multiNode.getInputPort(1));
graph.addEdge(multiNode.getOutputPort(0), outputNode.getInputPort(0));
// Set the default values
// This needs to be after connection.
inputNode1.setConfiguredName("a");
inputNode2.setConfiguredName("b");