Sun Adapter for Oracle Tutorials

ProcedureCreate the jcdTableSelect Collaboration Business Rules

You can create the jcdTableSelect Java Collaboration business rules by following the steps below, or by copying the jcdTableSelect Collaboration Java Code into the Collaboration Editor's Java Source Editor as described in Using the Collaboration Editor's Java Source Editor.

  1. From the Project window, double-click the jcdTableSelect Collaboration under your project's jcdALL node.

    The Java Collaboration Editor opens to the jcdTableSelect Collaboration.

  2. Create the Copy "Selectiong records from db_employee table via Table Select........" to FileClient_1.Text rule.

    1. Click the rule icon on the Business Rules toolbar to add a new rule in the Business Rules pane.

    2. From the Business Rules Designer toolbar's String menu, select Literal String.

      A String method box is added to the Business Rules Designer canvas.

    3. Double-click the value field of the String method box and enter Selectiong records from db_employee table via Table Select........ as the value.

    4. Map the output node of the String method box, to Text, under FileClient_1 in the right pane of the Business Rules Designer.

  3. Create the FileClient_1.write rule.

    1. Click the rule icon on the Business Rules toolbar to add a new rule in the Business Rules pane.

    2. Right-click the FileClient_1 node in the left pane of the Business Rules Designer, and choose Select method to call from the popup menu.

      The method selection window appears.

    3. Select and double-click write() from the method selection window.

      The write method box appears in the Business Rules Designer canvas. The FileClient_1.write rule is added to the Business Rules tree.

  4. Create the otdInputDTD_DB_Employee_1.unmarshalFromString(input.Text) rule.

    1. Click the rule icon on the Business Rules toolbar to add a new rule in the Business Rules pane.

    2. Right-click DB_EMPLOYEE under otdOracle_1 in the left pane of the Business Rules Designer, and choose Select method to call from the popup menu.

      The method selection window appears.

    3. Select select(String where) from the method selection window.

      The select method box appears in the Business Rules Designer canvas, and a link connects the DB_EMPLOYEE node in the left pane of the Business Rules Designer to the DB_EMPLOYEE input node of the select method box.

    4. Map Text under the input node in the left pane of the Business Rules Designer, to the where (String) input node of the select method box.

  5. Add a While statement and create the condition: otdOracle_1.DB_EMPLOYEE.next rule.

    1. Click the While icon on the Business Rules toolbar to add a While statement to the Business Rules tree.

    2. Right-click DB_EMPLOYEE under otdOracle_1 in the left pane of the Business Rules Designer, and choose Select method to call from the popup menu.

      The method selection window appears.

    3. Select next() from the method selection window.

      The next method box appears in the Business Rules Designer canvas, and a link connects the DB_EMPLOYEE node in the left pane of the Business Rules Designer to the DB_EMPLOYEE input node of the next method box.

    4. Map the result (boolean) output node of the next method box, to the While condition in the right pane of the Business Rules Designer.

  6. Create the Copy otdOracle_1.DB_EMPLOYEE.EMP_NO.toString to otdOutputDTD_DBemployee_1.EmpNo rule beneath the While -> rules node.

    1. Select the rules node under the While statement on the Business Rules tree, and click the rule icon on the Business Rules toolbar to add a new rule.

    2. Map the EmpNo node, under otdOracle_1 -> DB_EMPLOYEE in the left pane of the Business Rules Designer, to Emp_No node, under otdOutputDTD_DBemployee_1 in the right pane of the Business Rules Designer.

      The Business Rules Designer adds the necessary code for shortToString type conversion.

  7. Create the Copy otdOracle_1.DB_EMPLOYEE.LAST_NAME to otdOutputDTD_DBemployee_1.Lastname rule under the last rule.

    1. Click the rule icon on the Business Rules toolbar to add a new rule.

    2. Map the LAST_NAME node, under otdOracle_1 -> DB_EMPLOYEE in the left pane of the Business Rules Designer, to the Lastname node, under otdOutputDTD_DBemployee_1 in the right pane of the Business Rules Designer.

  8. Create the Copy otdOracle_1.DB_EMPLOYEE.FIRST_NAME to otdOutputDTD_DBemployee_1.Firstname rule under the last rule.

    1. Click the rule icon on the Business Rules toolbar to add a new rule.

    2. Map the FIRST_NAME node, under otdOracle_1 -> DB_EMPLOYEE in the left pane of the Business Rules Designer, to the Firstname node, under otdOutputDTD_DBemployee_1 in the right pane of the Business Rules Designer.

  9. Create the Copy Double.toString(otdOracle_1.DB_EMPLOYEE.RATE) to otdOutputDTD_DBemployee_1.Rate rule under the last rule.

    1. Click the rule icon on the Business Rules toolbar to add a new rule.

    2. Map the RATE node, under otdOracle_1 -> DB_EMPLOYEE in the left pane of the Business Rules Designer, to the Rate node, under otdOutputDTD_DBemployee_1 in the right pane of the Business Rules Designer.

      The Business Rules Designer adds the necessary code to create the business rule..

  10. Create the Copy otdOracle_1.DB_EMPLOYEE.LAST_UPDATE.toString to otdOutputDTD_DBemployee_1.LastDate rule.

    1. Click the rule icon on the Business Rules toolbar to add a new rule.

    2. Right-click LAST_UPDATE under otdOracle_1 -> DB_EMPLOYEE in the left pane of the Business Rules Designer, and choose Select method to call from the popup menu.

      The method selection window appears.

    3. Select toString() from the method selection window.

      The toString method box appears in the Business Rules Designer canvas.

    4. Map LAST_UPDATE under otdOracle_1 -> DB_EMPLOYEE in the left pane of the Business Rules Designer, to the Date input node of the toString method box.

    5. Map the result (String) output node of the toString method box, to LastDate under otdOutputDTD_DBemployee_1 in the right pane of the Business Rules Designer.

  11. Create the Copy otdOutputDTD_DBemployee_1.marshalToString to FileClient_1.Text rule under the last rule.

    1. Click the rule icon on the Business Rules toolbar to add a new rule.

    2. Right-click otdOutputDTD_DBemployee_1 in the left pane of the Business Rules Designer, and choose Select method to call from the popup menu.

      The method selection window appears.

    3. Select marshalToString() from the method selection window.

      The marshalToString method box appears in the Business Rules Designer canvas, and a link connects otdOutputDTD_DBemployee_1 in the left pane of the Business Rules Designer to the DBemployee input node of the marshalToString method box.

    4. Map the result (String) output node of the marshalToString method box to the Text node, under FileClient_1 in the right pane of the Business Rules Designer.

  12. Create the FileClient_1.write rule.

    1. Click the rule icon on the Business Rules toolbar to add a new rule.

    2. Right-click the FileClient_1 node in the left pane of the Business Rules Designer, and choose Select method to call from the popup menu.

      The method selection window appears.

    3. Select and double-click write() from the method selection window.

      The write method box appears in the Business Rules Designer canvas. The FileClient_1.write rule is added to the Business Rules tree.

  13. Create the Copy "Table Select Done." to FileClient_1.Text rule.

    1. From the Business Rules tree, select the While statement, then click the rule icon on the Business Rules toolbar to add a new rule.

      A new rule is added to the main trunk of the Business Rules tree.

    2. From the Business Rules Designer toolbar's String menu, select Literal String.

      A String method box is added to the Business Rules Designer canvas.

    3. Double-click the value field of the String method box and enter Table Select Done. as the value.

    4. Map the output node of the String method box, to Text, under FileClient_1 in the right pane of the Business Rules Designer.

  14. Create the FileClient_1.write rule.

    1. Click the rule icon on the Business Rules toolbar to add a new rule in the Business Rules pane.

    2. Right-click the FileClient_1 node in the left pane of the Business Rules Designer, and choose Select method to call from the popup menu.

      The method selection window appears.

    3. Select and double-click write() from the method selection window.

      The write method box appears in the Business Rules Designer canvas. The FileClient_1.write rule is added to the Business Rules tree.

  15. Click Save All to save your current changes.

    The completed jcdTableSelect Collaboration definition appears as follows:

    Image shows the completed jcdTableSelect Java Collaboration
Definition business rules.