Tutorial: Designing Your First Business Process

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Step 9: Create Quote Document

As a result of the work you did when you designed the Parallel node, at the point at which the business process exits the For Each node, the price quotes are assigned to the priceList variable, and the availability information is assigned to the availList variable. Both the priceList and the availList variables are of data type XmlObjectList (untyped sequences of XML data).

In this step, you first transform the data in the priceList and availList variables from untyped XML data (XmlObjectList) to typed XML (XML that is valid against the XML schemas provided in your project). Subsequently, you combine the typed XML price and availability data to produce a single quote document, which is the response that your business process sends to the client that invoked it.

Note: WLI lets you to create transformations in the following ways:
Note: Transformation files can be called from your business process through control nodes. The following transformation files are provided for you in the tutorial application:
Note: You used PriceAvailTransformations.java in Step 8: Design Parallel Paths of Execution.
Note: You will use both these transformation files in this step.
Note: A description of how to create these transformation files is outside the scope of this tutorial. For more information, see Tutorial: Designing Your First Data Transformation.

In this step, you design the logic in your business process to create a single quote document from the price and availability information. This involves designing control nodes that call the PriceAvailTransformations.java and TutorialJoin.java transformation files.

This step consists of the following tasks:

 


Convert Price List to XML Document

Complete the following steps to design a node for transforming the price list (created as a result of iteration through the For Each loop) to a typed XML variable.

  1. Under the priceAvailTransformations control instance in the Data Palette, select the PriceQuoteDocument convertPriceListToXML() method.
  2. Drag the method from the Data Palette and drop it on the RequestQuote business process in the Design view, immediately after he For Each block, as shown in the following figure.
  3. Figure 10-1 Adding Control to Convert Price List to XML Document


    Adding Control to Convert Price List to XML Document

  4. Rename the node from convertPriceListToXML to Convert PriceList To PriceQuote XML.
  5. Double-click the node to open its node builder.
  6. Verify that the priceAvailTransformations control and the following method are selected in the General Settings tab:
  7. PriceQuoteDocument convertPriceListToXML
    (org.example.request.QuoteRequestDocument _quoteRequestDoc, com.bae.xml.XmlObjectList _XmlObjectListDoc)
  8. Select the Send Data tab.
  9. The Control Expects field shows with the data type expected by the convertPriceListToXML() method on the priceAvailTransformations control:

    Figure 10-2 “Control Expects” Field


    “Control Expects” Field

    Note: The convertPriceListToXML() method on the priceAvailTransformations control is designed to achieve two goals: First, to transform the XmlObjectList price data to typed XML, and then to combine the customer name, shipping address, and price data in a single variable. The convertPriceListToXML() method receives the price list in a parameter of type XmlObjectList, and the customer name and shipping address in a parameter of type QuoteRequestDocument.
  10. On the Send Data tab, under Select variables to assign, assign the variables that hold the data required by the priceAvailTransformations control as follows:
    • Click the arrow in the variable assignment field associated with QuoteRequestDocument and select requestXML (QuoteRequestDocument). The requestXML variable holds the customer name and shipping address.
    • Click the arrow in the variable assignment field associated with XmlObjectList, and select priceList (XmlObjectList).
  11. Select the Receive Data tab.
  12. The Control Returns field contains PriceQuoteDocument, which is the data type returned by the convertPriceListToXML() method on the priceAvailTransformations control.

  13. In the Select variables to assign field, select Create new variable....
  14. The Create Variable dialog box is displayed.

  15. In the Variable Name field, enter priceQuote.
  16. Select the XML tab.
  17. Expand the Typed node (by clicking the + symbol adjacent to it), and progressively expand the nodes up to schemas.
  18. Under the schemas node, expand PriceQuote.xsd, and select priceQuote.
  19. The Type Name field shows org.example.price.PriceQuoteDocument.

  20. Click OK to close the Create Variable dialog box.
  21. Click Close to close the node builder.
  22. This step completes the design of the Convert PriceList to PriceQuote XML node. At run time, the price quotes (in typed XML format), and the customer name and shipping address are assigned to the priceQuote variable.

Note: The convertPriceListToXML() method on the priceAvailTransformations control creates the price quote XML data in the preceding step.
Note: The input to the transformation method includes the original data sent by the client (in the requestXML variable), and the price data returned by the priceProcessor control (in the priceList variable) after the iterations in the For Each node.
Note: The convertPriceListToXML() method extracts the customer name and shipping address from the requestXML variable, and a list of item IDs and prices from the priceList variable, and maps the data to the new variable (priceQuote).
Note: You can double-click PriceAvailTransformations.java in the Package Explorer view and see the transformation control in the Source view. To view the data transformation, right-click on the convertAvailXMLtoXMLObj method, and select Transform Arrow symbol Goto XQuery Document.

Related Topics

Transforming Data Using XQuery Mapper

Tutorial: Building Your First Data Transformation

 


Convert Availability List to XML Quote Document

Complete the following steps to design a node to transform the availability list (created as a result of iteration through the For Each loop) to a typed XML variable.

  1. Expand the priceAvailTransformations control instance in the Data Palette, and select the following method:
  2. AvailQuoteDocument convertAvailListToXML(com.bea.xml.XmlObjectList _XmlObjectListDoc)
  3. Drag the method from the Data Palette and drop it on your RequestQuote business process in the Design view, placing it immediately after the Convert PriceList to PriceQuote XML node.
  4. Rename the node to Convert AvailList to AvailQuote XML.
  5. Double-click the node to open its node builder.
  6. Verify that the priceAvailTransformations control and the following method are selected on the General Settings tab:
  7. AvailQuoteDocument convertAvailListToXML(com.bea.xml.XmlObjectList _XmlObjectListDoc)
  8. Select the Send Data tab.
  9. The Control Expects field contains XmlObjectList, which is the data type required by the convertAvailListToXML() method on the priceAvailTransformations control.

  10. In the Select variables to assign field, select availList (XmlObjectList).
  11. Select the Receive Data tab.
  12. The Control Returns field contains AvailQuoteDocument, which is the data type returned by the convertAvailListToXML() method on the priceAvailTransformations control.

  13. In the Select variables to assign field, select Create new variable....
  14. The Create Variable dialog box is displayed.

  15. In the Variable Name field, enter availQuote.
  16. Select the XML tab.
  17. Expand the Typed node (by clicking the + symbol adjacent to it), and progressively expand the nodes up to schemas.
  18. Under the schemas node, expand AvailQuote.xsd, and select availQuote.
  19. The Type Name field shows org.example.avail.AvailQuoteDocument.

  20. Click OK to close the Create Variable dialog box.
  21. Click Close to close the node builder.
  22. This step completes the design of the Convert AvailList to AvailQuote XML node. At run time, the availability information in XML format is assigned to the availQuote variable.

Note: The convertAvailListToXML() method on the priceAvailTransformations control creates the availability XML document. The input to convertAvailListToXML() is the data returned by the availProcessor control after the iterations in the For Each node.
Note: You can double-click PriceAvailTransformations.java in the Package Explorer view and see the transformation control in the Source view. To view the data transformation, right-click on the convertAvailListToXML method, and select Transform Arrow symbol Goto XQuery Document.
Note: The following figure shows the data transformation for the convertAvailListToXML() method:

“Control Expects” Field

Note: The figure shows transformation of the data in a variable of type XmlObjectList, which contains a repeating set of untyped XML data, to the repeating element in a typed XML variable.
Note: To achieve this transformation, the repeating element in the target schema must be the single child of a root element. In this case, availRequest is the repeating element, and it is the single child of the availQuote element. Click the Source view tab in the transformation tool to see the corresponding XQuery.

 


Combine Price and Availability Quotes

Complete the following tasks:

Create Instance of TutorialJoin Control

Complete the following steps to add an instance of the TutorialJoin.java control in the business process.

  1. In the Package Explorer view, select the TutorialJoin.java file. It is available in the Tutorial_Process_Application_Web\requestquote project folder.
  2. Note: For information about building the TutorialJoin.java control, see Tutorial: Building Your First Data Tansformation.
  3. Drag the TutorialJoin.java file from the Package Explorer view to the Data Palette. An instance of the control (tutorialJoin) is created and displayed in the Data Palette.

Design Process Interaction with TutorialJoin Control

In this step, you design the business process to call the following method on the tutorialJoin control:

join(PriceQuoteDocument _priceQuoteDoc,
AvailQuoteDocument _availQuoteDoc, float taxRate)

This method combines the data returned to your business process from different systems and creating a single XML response document (quote), which is subsequently returned to the client that invoked the business process.

  1. Expand the tutorialJoin control instance in the Data Palette and select the following method:
  2. QuoteDocument join
    (org.example.price.PriceQuoteDocument _priceQuoteDoc,
    org.example.avail.AvailQuoteDocument _availQuoteDoc,float taxRate)
  3. In the Design view, drag the method from the Data Palette and drop it on your RequestQuote business process immediately after the Convert AvailList to AvailQuote XML node.
  4. Rename the node to Combine Price and Avail Quotes.
  5. Double-click the Combine Price and Avail Quotes node. The node builder opens on the General Settings tab.
  6. Confirm that tutorialJoin is displayed in the Control field, and that the following method is selected in the Method field:
  7. QuoteDocument join
    (org.example.price.PriceQuoteDocument _priceQuoteDoc,
    org.example.avail.AvailQuoteDocument _availQuoteDoc,float taxRate
  8. Select the Send Data tab.
  9. The Control Expects field shows the data type expected by the join method on the tutorialJoin control, as shown in the following figure:


    “Control Expects” Field

  10. In the Select variables to assign field, select the variables such that their data types match the data type expected (Control Expects) in the input parameters to the join() method.
    • For PriceQuoteDocument, select priceQuote (PriceQuoteDocument).
    • priceQuote holds the price quote data, which is returned from the priceProcessor service in the For Each loop in your business process.

    • For AvailQuoteDocument, select availQuote (AvailQuoteDocument).
    • availQuote holds the availability quote data, which is returned from the availProcessor service in the For Each loop in your business process.

    • For float taxRate, select taxRate (float).
    • taxRate holds the rate of sales tax applied to the quote, based on the shipping address, which is returned to your business process from the taxCalculation service.

  11. Select the Receive Data tab. The Control Returns field shows QuoteDocument, which is the data type returned by the join() method.
  12. In the Select variable to assign field, select Create new variable....
  13. The Create Variable dialog box is displayed.

  14. In the Variable Name field, enter Quote.
  15. Select the XML tab.
  16. Expand the Typed node (by clicking the + symbol adjacent to it), and progressively expand the nodes up to schemas.
  17. Under the schemas node, expand Quote.xsd, and select quote. The Type Name field shows org.example.quote.QuoteDocument.
  18. Click OK to create the new variable. The Quote variable is displayed in the Receive Data tab, and also in the Data Palette.
  19. Click Close to close the node builder.
  20. This step completes the design of the Combine Price and Avail Quotes node. At run time, the availability quote data in XML format is assigned to the Quote variable.

  21. From the Oracle Workshop for WebLogic menu, choose FileArrow symbolSave All.
  22. The only tasks that remain in this part of the tutorial are to write the quote to your file system (optional step) and create the Client Response node in the business process. The business process returns the quote you created to the client via the Client Response node.


  Back to Top       Previous  Next