// Name, description
workflow.setName("Complex math workflow");
workflow.setDescription("Complex math workflow");
Graph graph = workflow.getGraph();
// Adder nodes
Component adderComp = this.componentRegistry.getComponents(MATH_ADDER_WSDL).get(0);
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.getComponents(MATH_MULTIPLIER_WSDL).get(0);
Node multiNode = workflow.addNode(multiComp);
multiNode.setPosition(new Point(320, 130));
// Parameter node 1
InputNode paramNode1 = (InputNode) workflow.addNode(this.inputComponent);
paramNode1.setPosition(new Point(20, 30));
String paramValue1 = "2";
paramNode1.setDefaultValue(paramValue1);
// Parameter node 2
InputNode paramNode2 = (InputNode) workflow.addNode(this.inputComponent);
paramNode2.setPosition(new Point(20, 100));
String paramValue2 = "3";
paramNode2.setDefaultValue(paramValue2);
// Parameter node 3
InputNode paramNode3 = (InputNode) workflow.addNode(this.inputComponent);
paramNode3.setPosition(new Point(20, 170));
String paramValue3 = "4";
paramNode3.setDefaultValue(paramValue3);
// Parameter node 4
InputNode paramNode4 = (InputNode) workflow.addNode(this.inputComponent);
paramNode4.setPosition(new Point(20, 240));
String paramValue4 = "5";
paramNode4.setDefaultValue(paramValue4);
OutputNode outParamNode = (OutputNode) workflow.addNode(this.outputComponent);
outParamNode.setPosition(new Point(370, 240));
// Connect ports
graph.addEdge(paramNode1.getOutputPort(0), adderNode1.getInputPort(0));
graph.addEdge(paramNode2.getOutputPort(0), adderNode1.getInputPort(1));
graph.addEdge(paramNode3.getOutputPort(0), adderNode2.getInputPort(0));
graph.addEdge(paramNode4.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), outParamNode.getInputPort(0));
return workflow;
}