Updating filter tables on Route nodes

Use the IBM Integration API to update filter tables on Route nodes.

You can add and update rows on the filter table of a Route node.
Adding a new row
The following example shows you how to add a new row to a filter table by using the createRow() method:
  1. The message flow and the Route node are loaded into memory.
  2. The filter table of the Route node is loaded into memory by using the getFilterTable() method of the RouteNode object.
  3. A new filter table row is created by using the createRow() method.
  4. The value of the filter pattern property on this new row is set to value="123" by using the setFilterPattern() method.
  5. The routing output terminal property is set to NEWOUT by using the setRoutingOutputTerminal() method.
  6. The new row is then added to the filter table by using the addRow() method.
File msgFlow = new File("main.msgflow");
MessageFlow mf1 = FlowRendererMSGFLOW.read(msgFlow);
RouteNode routeNode = (RouteNode)mf1.getNodeByName("My Route Node");
RouteNode.FilterTable filterTable = (RouteNode.FilterTable)routeNode.getFilterTable();
RouteNode.FilterTableRow newRow = filterTable.createRow();
newRow.setFilterPattern("value=\"123\"");
newRow.setRoutingOutputTerminal("NEWOUT");
filterTable.addRow(newRow);
Updating a row
The following example shows you how to update rows on the filter table of a Route node.
  1. The message flow, Route node, and filter table of the Route node are loaded into memory.
  2. The rows of the filter table are loaded into memory by using the getRows() method.
  3. The filter pattern property of the first row of the filter table is set to value2="456".
  4. The routing output terminal property of the first row of the filter table is set to NEWOUT2.
File msgFlow = new File("main.msgflow");
MessageFlow mf1 = FlowRendererMSGFLOW.read(msgFlow);
RouteNode routeNode = (RouteNode)mf1.getNodeByName("My Route Node");
RouteNode.FilterTable filterTable = (RouteNode.FilterTable)routeNode.getFilterTable();
Vector<RouteNode.FilterTableRow> filterTableRows = filterTable.getRows();
filterTableRows.get(0).setFilterPattern("value2=\"456\"");
filterTableRows.get(0).setRoutingOutputTerminal("NEWOUT2");

Pattern authoring

The following examples are the same as the previously described examples, but for pattern authoring:
Adding a new row
MessageFlow mf1 = patternInstanceManager.getMessageFlow("MyFlowProject", "main.msgflow");
RouteNode routeNode = (RouteNode)mf1.getNodeByName("My Route Node");
RouteNode.FilterTable filterTable = (RouteNode.FilterTable)routeNode.getFilterTable();
RouteNode.FilterTableRow newRow = filterTable.createRow();
newRow.setFilterPattern("value=\"123\"");
newRow.setRoutingOutputTerminal("NEWOUT");
filterTable.addRow(newRow);
Updating a row
MessageFlow mf1 = patternInstanceManager.getMessageFlow("MyFlowProject", "main.msgflow");
RouteNode routeNode = (RouteNode)mf1.getNodeByName("My Route Node");
RouteNode.FilterTable filterTable = (RouteNode.FilterTable)routeNode.getFilterTable();
Vector<RouteNode.FilterTableRow> filterTableRows = filterTable.getRows();
filterTableRows.get(0).setFilterPattern("value2=\"456\"");
filterTableRows.get(0).setRoutingOutputTerminal("NEWOUT2");