About Order Item Specification Order Item Property XQuery Expressions

This topic describes how to use the Order Item Specification editor, Order Item Properties tab, Property Expression area, XQuery tab to write an expression that specifies order item properties based on the input context. These expressions have the following characteristics:

  • Context: The Property Expression area XQuery input document is a node from the node-set returned by the order item selector (see "About Order Sequence Order Item Selector XQuery Expressions"). OSM runs every order item Property Expression area XQuery against each node (starting with the first and ending with the last node) in the node-set returned by the order item selector.

  • Prolog: You can declare the following variables within the prolog to access additional context information:

    • The $inputDoc variable can be declared in the prolog of an OSM XQuery to provide access to the original input customer order. This external function can be useful if you need to generate order item properties based on elements outside of the order item node-set defined in the order item selector. The format for declaring this variable in the XQuery prolog is:

      declare variable $inputDoc as document-node() external;
      

      You can then access this variable within the XQuery body. For example, the following XQuery body uses $inputDoc to define the ItemReferenceName value:

      let $inputOrderData:= $inputDoc/GetOrder.Response/_root
      fn:normalize-space(cso:ItemReferenceName/text())
      

      For more information about typical customer order structures, see OSM Modeling Guide.

    • The $salesOrderLines variable can be used in an OSM XQuery to provide access to original order item node-set before it is selected by the orchestration sequence's order item selector. This can be useful if the order item selector XQuery changes the selected order item node-set (for example, by rearranging the order of the elements). The format for declaring this variable in the XQuery prolog is:

      declare variable $salesOrderLines as document-node() external;
      

      You can access this variable within the XQuery body. For more information about typical customer order structures, see OSM Modeling Guide.

  • Body: The XQuery body must specify the order item element that provides the values for each order item property you define.

After these XQuery expressions have run against an order item, the order item and the order item properties become internally accessible as an XQuery context for other OSM entities. For example,

<osm:orderItem 
 xmlns:osm="http://xmlns.oracle.com/communications/ordermanagement/model" id="1288881040699">
   <osm:name>Commercial Fixed Service [Add]</osm:name>
   <osm:orderItemSpec xmlns="http://xmlns.oracle.com/communications/ordermanagement/model">
      <osm:name>CustomerOrderItemSpecification</osm:name>
      <osm:namespace>
         http://oracle.communications.ordermanagement.unsupported.centralom
      </osm:namespace>
   </osm:orderItemSpec>
   <osm:productSpec xmlns="http://xmlns.oracle.com/communications/ordermanagement/model">
      <osm:name>Service.Fixed</osm:name>
      <osm:namespace>
         http://oracle.communications.ordermanagement.unsupported.centralom
      </osm:namespace>
   </osm:productSpec>
   <osm:properties xmlns:im="http://oracle.communications.ordermanagement.unsupported. centralom">
      <im:typeCode>PRODUCT</im:typeCode>
      <im:parentLineId>3</im:parentLineId>
      <im:requestedDeliveryDate>2013-06-31T12:00:00</im:requestedDeliveryDate>
      <im:lineItemName>Commercial Fixed Service [Add]</im:lineItemName>
      <im:lineId>4</im:lineId>
      <im:ServiceActionCode>UPDATE</im:ServiceActionCode>
      <im:productSpec>Fixed Service Plan Class</im:productSpec>
      <im:serviceId>552131313131</im:serviceId>
      <im:fulfillPatt>Service.Fixed</im:fulfillPatt>
      <im:lineItemPayload> [34 lines]
      <im:region>Sao Paulo</im:region>
   <osm:properties>
</osm:orderItem>

The following examples show some ways to map data in an incoming customer order to an order item property. The current context is a single node from salesOrderLines, which is one of the nodes returned by executing the orchestration sequence order item selector against the input message (see "About Order Sequence Order Item Selector XQuery Expressions").

  • Order management personnel need to know what the requested delivery date is for order items. Adding the date to the order item allows the order management personnel to see it in the OSM web clients. In addition, OSM needs the requested delivery date to calculate the order start date.

    To retrieve the requested delivery data for an order item, OSM looks in the incoming customer order for the <requestedDeliveryDate> element:

    <im:requestedDeliveryDate>2001-12-31T12:00:00</im:requestedDeliveryDate>
    

    The definition of the requestedDeliveryDate order item property includes the following XQuery, which returns the text of the <requestedDeliveryDate> element:

    declare namespace im="http://xmlns.oracle.com/InputMessage";
    fn:normalize-space(im:requestedDeliveryDate/text())
    
  • Order management personnel need to identify order items in the OSM web clients. The lineItemName order item property includes the following XQuery:

    declare namespace im="http://xmlns.oracle.com/InputMessage";
    fn:normalize-space(fn:concat(im:itemReference/im:name/text(),' [',im:serviceActionCode/text(),']'))
    

    This XQuery looks for two elements, <name> and <serviceActionCode>:

    <im:name>Fixed Caller ID</im:name>
    <im:serviceActionCode>Add</im:serviceActionCode>
    

    It then concatenates the text retrieved from the two elements to form the order item name, in this case Fixed Caller ID [Add].

  • Order management personnel need to identify the products or orchestration product specifications from the customer order so that order items can be mapped to orchestration fulfillment patterns (see "About XQuery Expressions for Mapping Products and Orchestration Product Specifications and Fulfillment Patterns"). The following example shows the product specification data in the message, contained in the <primaryClassificationCode> element:

    <im:primaryClassificationCode>Mobile Service Feature Class
    </im:primaryClassificationCode>
    

    The productClass order item property uses the following XQuery expression to get the data:

    declare namespace im="http://xmlns.oracle.com/InputMessage";
    fn:normalize-space(im:itemReference/im:primaryClassificationCode/text())