![]() ![]() ![]() ![]() ![]() ![]() |
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 quote data are assigned to the priceList
variable, and the availability quote data are assigned to the availList
variable. Both the priceList
and the availList
variables are of data type XmlObjectList (an 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 (that is, to XML that is valid against the XML Schemas provided in your project). Subsequently, you combine the XML-typed price and availability data to produce a single quote document, which comprises the response your business process sends to the client that invoked it.
BEA Products allows you to create Transformations in the following ways:
RequestQuoteTransformation.java
was created for you the first time you created a transformation from a node builder, that is, when you needed to map the data types from the Request for Quote message to the input of the taxCalculation
control. (To review, see "To Call the Tax Calculation Web Service From Your Business Process" in
Step 4: Invoke a Web Service) You subsequently created several additional transformation methods on RequestQuoteTransformation.java
(and associated XQ files) on Control nodes within the Parallel node you designed.
The following Transformation files were created using this method, and are provided for you in the tutorial application: PriceAvailTransformations.java
and TutorialJoin.java
. You used PriceAvailTransformations.java
in the previous step (Step 8: Design Parallel Paths of Execution) and you will use it again in this step, as well as TutorialJoin.java
in this step.
In this step, you design the logic in your business process that creates a single quote document from the price and availability data already calculated. This involves designing Control nodes that call the PriceAvailTransformations.java
and TutorialJoin.java
Transformation files.
Note: | A description of how to create these Transformation files is outside the scope of this tutorial. However, to learn how to create TutorialJoin.java , see
Tutorial: Building Your First Data Transformation. |
In this step, in which you create a single quote document for a client, you must complete the following tasks:
Complete the following steps to design a node to transform the price list (created as a result of iteration through the For Each loop) to a variable whose data type is typed-XML. To do so, you use methods on the priceAvailTransformations control.
PriceQuoteDocument convertPriceListToXML
(QuoteRequestDocument _quoteRequestDoc, XmlObjectList _XmlObjectListDoc)
PriceQuoteDocument convertPriceListToXML
(org.example.request.QuoteRequestDocument _quoteRequestDoc, com.bae.xml.XmlObjectList _XmlObjectListDoc)
The Control Expects field is populated with the data type expected by the convertPriceListToXML
() method on the priceAvailTransformations control:
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, the shipping address, and the price quote data (the price list) 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 QuoteRequestDocumen t. To learn more about the priceAvailTransformations control, see
Note About the Transformation on This Node. |
The Control Returns field is populated with PriceQuoteDocument
, which is the data type returned by the convertPriceListToXML
() method on the priceAvailTransformations control.
org.example.price.PriceQuoteDocument
.This step completes the design of the Convert PriceList to PriceQuote XML node. At run time, the price quote data (in typed-XML format), and the customer name and shipping address are assigned to the priceQuote variable.
The convertPriceListToXML
() method on the priceAvailTransformations control does the work of creating the price quote XML data in the preceding step.
In brief, 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 complete.
The convertPriceListToXML
() method extracts the customer name and shipping address from the requestXML variable, and a list of widget IDs and prices from the priceList variable, and maps the data to the new variable (priceQuote).
It is left as an exercise to the reader to view this and other transformation methods on the priceAvailTransformations control. For example, you can double-click PriceAvailTransformations.java in the Package Explorer to display the Transformation control in the Source view. Right-click on the convertAvailXMLtoXMLObj method, and select Goto XQuery Document to open the Transformation tool. Use the Design view and Source view tabs in the transformation tool to see the data map that represents the transformation and the corresponding XQuery. Use the Test View tab to test the XQuery. For example the following figure shows the map for the convertAvailXMLtoXMLObj()
method:
Tutorial: Building Your First Data Transformation
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 variable whose data type is typed-XML. To do so, you use methods on the priceAvailTransformations control.
AvailQuoteDocument convertAvailListToXML(com.bea.xml.XmlObjectList _XmlObjectListDoc)
AvailQuoteDocument convertAvailListToXML(com.bea.xml.XmlObjectList _XmlObjectListDoc)
The Control Expects field is populated with XmlObjectList
, which is the data type expected by the convertAvailListToXML
() method on the priceAvailTransformations control.
The Control Returns field is populated with AvailQuoteDocument
, which is the data type returned by the convertAvailListToXML
() method on the priceAvailTransformations control.
org.example.avail.AvailQuoteDocument
.This step completes the design of the Convert AvailList to AvailQuote XML node. At run time, the availability quote data in XML format are assigned to the availQuote variable.
The convertAvailListToXML
() method on the priceAvailTransformations control does the work of creating the availability quote XML data. The input to convertAvailListToXML
() is the availability data returned by the availProcessor control after the iterations in the For Each node complete.
You can double-click PriceAvailTransformations.java in the Package Explorer to display the Transformation control in Source view. Right click on convertAvailListToXML
method, and select Go to XQuery Document from the drop-down menu to open the Transformation tool. The following figure shows the map for the convertAvailListToXML
() method:
The preceding figure shows the transformation of the data in a variable of type XmlObjectList
, which contains a repeating set of untyped XML data, to the repeating element in an XML-typed variable. Note that 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.
The TutorialJoin.java
control is provided in your tutorial application. It is available in the requestquote folder in your Tutorial_Process_ApplicationWeb project folder. To learn how to build the TutorialJoin.java
control, see
Tutorial: Building Your First Data Tansformation.
Complete the following steps to add an instance of this control to your business process.
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 join
method does the work of combining the data returned to your business process from different systems and creating a single XML response document (quote), which is subsequently returned to the business process' client.
QuoteDocument join
(org.example.price.PriceQuoteDocument
_priceQuoteDoc,
org.example.avail.AvailQuoteDocument_availQuoteDoc,float
taxRate)
QuoteDocument join
(org.exampel.price.PriceQuoteDocument
_priceQuoteDoc,
org.example.avail.AvailQuoteDocument_availQuoteDoc,float
taxRate
The Control Expects field is populated with the data type expected by the join
method on the tutorialJoin control, as shown in the following figure:
join
() method, as follows:priceQuote holds the price quote data, which is returned from the priceProcessor service in the For Each loop in your business process.
availQuote holds the availability quote data, which is returned from the availProcessor service in the For Each loop in your business process.
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.
On the Receive Data tab, the Control Returns field is populated with QuoteDocument
, which is the data type returned by the join
() method.
The Variable Type field is populated with org.example.quote.QuoteDocument
.
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.
To complete Part III of the tutorial, it only remains to write the quote to your file system (an optional step), and to create the Client Response node in your business process. The business process returns the quote you created to the client via the Client Response node.
To learn how to create Transformation controls, and specifically to learn how to design the TutorialJoin.java control used in this section, see Tutorial: Building Your First Data Transformation.
![]() ![]() ![]() |