In this step of the tutorial, you create the logic to extract a list of items from the RFQ received from a client, and begin designing the business process to determine the price and availability of the items requested by the client.
A For Each node represents a point in a business process where a set of activities is performed repeatedly, once for each item in a list. A For Each node includes the following:
An iteration variable holds the current element being processed in the For Each loop, for the life of the loop.
The following section gives you a brief overview of XML schemas. Read this section before you proceed with designing the For Each node in your business process.
The business process that you create in this tutorial is designed to start when it receives an RFQ (in the form of an XML file) from a client. The RFQ must contain valid XML, that is, XML data valid against an XML schema (QuoteRequest.xsd
in this case).
The QuoteRequest.xsd
schema is available in your application at the following location: Tutorial_Process_Application_Utility\Schemas
.
Note: | To make the schemas in your project available in the business process, you must place them in a Schemas folder in Tutorial_Process_Application_Utility (utility project). |
For more information, see “Creating and Importing Schema Files” in Transforming Data Using XQuery.
XML schemas in your application’s Schemas
folder are compiled to generate XML Beans. In this way, Oracle Workshop for WebLogic generates a set of interfaces that represent different aspects of your XML schemas. XML Bean types correspond to types in the XML schema itself. XML Beans provide Java counterparts for all built-in schema types, and generate Java counterparts for any derived types in your schema.
In
Step 2: Specify How the Process Is Started, you created a variable (requestXML
) to which the RFQ document (that your business process receives from a client) is assigned. When you work with such variables in the Design view, you work with a graphical representation of the XML schema that is associated with the variable.
The following figure is a graphical representation of the quoteRequest
element in the QuoteRequest.xsd
schema against which the RFQ document from clients is valid:
Note the following characteristics of the QuoteRequest.xsd
schema:
quoteRequest
. It specifies the following child elements: customerName
, shipAddress
, and widgetRequest
.shipAddress
element specifies the following attributes: street
, city
, state
, and zip
.widgetRequest
element is a repeating element (represented graphically by ). In other words, there can be one or more occurrences of the widgetRequest
element in an associated XML document. The widgetRequest
element, in turn, contains two elements: widgetId
and quantity
.
The business process in this scenario dictates that each pair of widgetId
and quantity
elements received in the RFQ documents from clients is processed. This processing begins with a For Each node. In each iteration through the For Each loop, one widgetRequest
item must be extracted from the requestXML
variable, and an activity (or a set of activities) must be performed on that item.
Creating the logic for your business process to iterate over the sequence of items in the RFQ document involves the following tasks:
The business process now has a For Each node, as shown in the following figure.
A list of the variables (typed XML) in your project is displayed.
The requestXML
variable contains the repeating XML element for which you want to design the iteration logic. A representation of the XML schema in the requestXML
variable is displayed in the Select Node pane.
The Repeating element and Iteration Variable fields are filled with the following data:
$requestXML/ns0:widgetRequest
iter_forEach1
.At run time, the current element being processed in the For Each loop is assigned to the iteration variable.
The iteration variable, iter_forEach1
, is created and added to the list of variables in the Data Palette. It is of XML type WidgetRequestDocument.WidgetRequest.
For information about how the iteration variable is used in the For Each loop, see Design “Create PriceList” Node.
This step completes the design of the iteration logic for your For Each node.
The node is updated in the Design view to reflect the work you did to define the condition.
The icon indicates that an XML query is defined for the node.
After you create the iteration logic in the For Each node, you must define the activity or set of activities to be performed during each iteration.
You add activities to the For Each loop by creating nodes within it to support your business logic. In Step 8: Design Parallel Paths of Execution, you create a Parallel node and design it so that the business process executes two sets of activities in parallel: request for price, and determination of availability for the items requested by the client.