Sun Adapter for Oracle Tutorials

Creating the bpPsSelect Business Rules

The bpPsSelect business process describes how to use a Prepared Statement query to select all records in the Oracle database via the Business Process Designer.

ProcedureCreate the bpPsSelect Business Rules

  1. Double-click bpPsSelect in the Projects window to open the Business Process Designer to the bpPsSelect Business Process.

  2. Create the bpPsSelect FileClient.receive -> FileClient.write rule.

    1. Add a Business Rule to the link between FileClient.receive and FileClient.write and double-click the new Business Rule icon to open the Business Rule Designer.

    2. From the Business Rule Designer toolbar String menu, select string literal.

    3. Enter Selecting record(s) from db_employee table via Prepared Statement select...as the String value in the string literal method box.

    4. Map the Selecting record(s) from db_employee table via Prepared Statement select... output node of the string literal method box, to text under FileClient.write.input in the Input pane (right pane) of the Business Rule Designer.

  3. Create the FileClient.write -> otdOracle.Select_psPSSelectAll rule.

    1. Add a Business Rule to the link between FileClient.write and otdOracle.Select_psPSSelectAll and double-click the new Business Rule icon to open the Business Rule Designer.

    2. From the Business Rule Designer toolbar Number menu, select number literal.

    3. Enter 0.0 as the number value.

    4. Map the 0.0 output node of the number literal method box, to EMP_NO under otdOracle.Select_psPSSelectAll.Input -> input in the Input pane of the Business Rule Designer.

  4. Create the Records found -> otdInputDTD_DBemployees.marshal rule in Case 1 of the Decision branching activity.

    1. Add a Business Rule to the link between the Records found input node and otdInputDTD_DBemployees.marshal and double-click the new Business Rule icon to open the Business Rule Designer.

    2. From the Business Rule Designer String menu, select String.

      If String is not available from the String menu, click Settings on the String menu to open the Method Palette, and select String as an option from the String tab. This will add String to the String menu

    3. Map EMP_NO under otdOracle.Select_psPSSelectAll.Output -> output -> Select_psPSSelectAllPSResponseTypeList in the Output pane of the Business Rule Designer, to the object1? input node of the String method box.

    4. Map the return string output node of the String method box, to EmpNo under otdInputDTD_DBemployees.marshal.Input -> DBemployees -> X_sequence_A in the Input pane of the Business Rule Designer

    5. From the Business Rule Designer String menu, select String to add another String method box.

    6. Map RATE under otdOracle.Select_psPSSelectAll.Output -> output -> Select_psPSSelectAllPSResponseTypeList in the Output pane of the Business Rule Designer, to the object1? input node of the String method box.

    7. Map the return string output node of the String method box, to Rate under otdInputDTD_DBemployees.marshal.Input -> DBemployees -> X_sequence_A in the Input pane of the Business Rule Designer

    8. Map the nodes in the Output pane of the Business Rule Designer, to their corresponding nodes under otdInputDTD_DBemployees.marshal.Input -> DBemployees -> X_sequence_A in the Input pane, as follows:

      • LAST_NAME -> Lastname

      • FIRST_NAME -> Firstname

      • LAST_UPDATE -> LastDate

      Image shows the Records found -> otdInputDTD_DBemployees.marshal
rule in the Business Rule Designer.
  5. Create the otdInputDTD_DBemployees.marshal -> FileClient.write rule in Case 1 of the Decision branching activity.

    1. Add a Business Rule to the link between otdInputDTD_DBemployees.marshaland FileClient.write within the Records found element, and double-click the new Business Rule icon to open the Business Rule Designer.

    2. Map contents under otdInputDTD_DBemployee.marshal.Output, in the Output pane of the Business Rule Designer, to text under FileClient.write.Input3 in the Input pane of the Business Rule Designer.

  6. Create the Norecord -> FileClient.write rule in Case 2 of the Decision branching activity.

    1. Add a Business Rule to the link between No record input node and FileClient.write within the Records found element, and double-click the new Business Rule icon to open the Business Rule Designer.

    2. From the Business Rule Designer toolbar String menu, select string literal.

    3. Enter Records Not Found as the String value in the string literal method box.

    4. Map the Records Not Found output node of the string literal method box, to text under FileClient.write.Input2 in the Input pane (right pane) of the Business Rule Designer.

  7. Create the Decision Gate Properties for the Decision Case 1 and Case 2.

    1. Double-click the red Case 1 icon between Decision input node and Records found input node.

      The Decision Gate Properties Editor appears.

    2. From the Decision Gate Properties Editor toolbar Operator menu, select Settings.

      The Method Pallette appears.

    3. From the Method Palette, click the Operator tab and select the greater than option (for Case 1) and select the lesser or equal option (for case 2). Click Close.

      The new options are added to the Operator menu.

    4. From the Decision Gate Properties Editor toolbar Operator menu, select greater than.

      The greater than method box is added to the editor's canvas.

    5. Map rowCount under otdOracle.Select_psPSSelectAll.Output -> output in the left pane of the Decision Gate Properties Editor, to the number1 input node of the greater than method box.

    6. Double-click the number2 field of the greater than method box, and change the value to 0.0.

    7. Map 00 output node of the greater than method box, to the Result node in the right pane of the Decision Gate Properties Editor.

    8. From the Order of Execution field, select Case 2.

    9. From the Decision Gate Properties Editor toolbar Operator menu, select lessor or equal.

      The lessor or equal method box is added to the editor's canvas.

    10. Map rowCount under otdOracle.Select_psPSSelectAll.Output -> output in the left pane of the Decision Gate Properties Editor, to the number1 input node of the lessor or equal method box.

    11. Double-click the number2 field of the lessor or equal method box, and change the value to 0.0.

    12. Map 00 output node of the lessor or equal method box, to the Result node in the right pane of the Decision Gate Properties Editor.

    13. Click OK to close the Decision Gate Properties Editor.

      The Case 1 and 2 icons change from red to green to indicate that the properties have been set.

  8. Create the Decision.end -> FileClient.write rule.

    1. Add a Business Rule to the link between the Decision.end element and FileClient.write, and double-click the new Business Rule icon to open the Business Rule Designer.

    2. From the Business Rule Designer toolbar String menu, select string literal.

    3. Enter Select Done as the String value in the string literal method box.

    4. Map the Select Done output node of the string literal method box, to text under FileClient.write.Input3 in the Input pane of the Business Rule Designer.

  9. Save your project.