About XQuery Expressions for Mapping Products and Orchestration Product Specifications and Fulfillment Patterns

The order item property specified in the Fulfillment Pattern Mapping Property field for the order item must map to an existing OSM orchestration fulfillment pattern entity. The value could be contained in a customer order, but more often, it is derived from other customer order parameter. This property is mandatory.

The construction of the fulfillment pattern mapping order item property follows the same rules as other order item property XQuery expressions. See "About Order Item Specification Order Item Property XQuery Expressions" for more information about the XQuery context, prolog, and body.

The following describes a common scenario for deriving fulfillment patterns from product or orchestration product specification data contained in an order. In other scenarios, the mapping from product or orchestration product specification to fulfillment pattern might be simpler; or, there might be cases where some order line items have no product specification, in which case the product specification can be derived from the context of the order item.

You typically create conceptual model products in your OSM system by importing them. (See OSM Modeling Guide for more information.) When you import products, Design Studio creates the productClassMapping.xml and productSpecMapping.xml files. These files contain mappings between conceptual model products and OSM orchestration product specifications and fulfillment patterns. The productClassMapping.xml file is provided for backward compatibility, so in this topic it is assumed that you are using the productSpecMapping.xml file. These files are created in one of the following directories:

  • If you have specified a value for the Product Specification Mapping Folder field of the Orchestration Preferences in Eclipse, it will create the two files in the directory specified.

  • If no value is specified for that field, OSM will create the productClassMapping.xml file in the resources/productClassMapping directory and the productSpecMapping.xml file in the resources/productSpecMapping directory.

You can retrieve this mapping data from one of these files by creating a data instance provider that can be referenced from an XQuery expression body using a data instance behavior.

Note:

The element names are not the same between the productClassMapping.xml and productSpecMapping.xml files. Ensure that you are using the correct element names for the file you are referencing. The names in this topic are correct for the productSpecMapping.xml file.

For example, the following XQuery creates the $productSpecMap variable that references the data instance that points to the productSpecMapping.xml file:

let $productSpecMap := vf:instance('dataInstace1')

The following code creates a variable that references the product value from the customer order. For example:

let $productSpecName  := fn:normalize-space(im:itemReference/im:primaryClassificationCode/text())

You can now create an expression that matches the product from the order with the product contained in the productSpecMapping.xml file and returns the fulfillment pattern associated with it or else defaults to the Non.Service.Offer fulfillment pattern. For example:

return
if ($productSpecName != '')
then
   fn:normalize-space($productSpecMap/productSpec
   [fn:lower-case(@name)=fn:lower-case($productSpecName)]/productSpec/text())
else
   'Non.Service.Offer'

In the following example, OSM retrieves the product Mobile Service Feature Class from the incoming customer order. OSM uses the order item property specified in the Fulfillment Pattern Mapping Property field for the order item to map the product specification to a fulfillment pattern.

The order item property specified in the Fulfillment Pattern Mapping Property field for the order item includes the following XQuery expression:

declare namespace im="http://xmlns.oracle.com/InputMessage";
(: Use the ProductSpecMap data instance behavior to retrieve the data in the productSpecMapping.xml file:  :)
   let $productSpecMap := vf:instance('ProductSpecMap')
   let $productSpecName  := 
   fn:normalize-space(im:itemReference/im:primaryClassificationCode/text())
   return
   if ($productSpecName != '')
   then
      fn:normalize-space($productSpecMap/productSpec
      [fn:lower-case(@name)=fn:lower-case($productSpecName)]/productClass/text())
   else
     'Non.Service.Offer'

The productSpecMapping.xml file includes the <productSpec> element, that maps the Mobile Service Feature Class product to the Service.Mobile fulfillment pattern:

<productSpec name="Mobile Service Feature Class" 
        cartridge="OsmCentralOMExample-ProductSpecs">
    <fulfillmentPattern>Service.Mobile</fulfillmentPattern>
</productSpec>

To summarize, to map an order line item in an incoming customer order to a fulfillment pattern, you configure the following:

  • In the order item specification:

    • A property that retrieves the conceptual model product or the OSM orchestration product specification from the incoming customer order.

    • The order item property specified in the Fulfillment Pattern Mapping Property field, that maps the product or orchestration product specification to the orchestration fulfillment pattern. To do so, OSM uses the ProductClassMap data instance behavior.

  • The ProductSpecMap data instance behavior (and the data provider that supports it), that retrieves data from the productSpecMapping.xml file.

  • The productSpecMapping.xml file used by the ProductClassMap data instance behavior, that maps products and orchestration product specifications to fulfillment patterns.

When you update your product catalog, you might need to add new fulfillment patterns. In that case, you need to:

  • Create new fulfillment patterns and conceptual model products, if necessary.

  • Add mappings to the productSpecMapping.xml file.

You do not need to change the order item specification or the data instance behavior.