About Order Item Specification Order Item Hierarchy XQuery Expressions

This topic describes how to use the Order Item Specification editor Order Item Hierarchies tab, Key Expression and Parent Key Expression areas, XQuery subtabs to write expressions that specify the relative hierarchy of order items, in the same order or between different orders, based on an order item value, such as lineId and parentLineId and has the following characteristics:

  • Context: The Key Expression and Parent Key Expression area XQuery input document is the order item. Specifically order item properties that indicate the relative hierarchy, such as order item lineId and parentLineID properties. For example:

    <osm:orderItem 
     xmlns:osm="http://xmlns.oracle.com/communications/ordermanagement/model"
     id="1288881040699">
    .....
       <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:productClass>Fixed Service Plan Class</im:productClass>
          <im:serviceId>552131313131</im:serviceId>
          <im:productSpec>Service.Fixed</im:productSpec>
          <im:lineItemPayload> [34 lines]
          <im:region>Sao Paulo</im:region>
       <osm:properties>
    </osm:orderItem>
    
  • Prolog: You can declare the order item specification namespace and the OSM namespace in the XQuery prolog. For example:

    declare namespace osm="http://xmlns.oracle.com/communications/ordermanagement/model";
    declare namespace im="http://oracle.communications.ordermanagement.unsupported.centralom";
    

    You can declare the OrchestrationXQueryFunctions class in the prolog to use the ancestors method that returns the current node and all ancestors of the current node based on the specified hierarchy definition. This method can be useful when creating dependencies between order items based on hierarchy. For example:

    declare namespace osmfn = "java:oracle.communications.ordermanagement.orchestration.generation.OrchestrationXQueryFunctions";
    

    See "OSM XQuery Functions" for more information about the OrchestrationXQueryFunctions class. See OSM Modeling Guide for an example of how the ancestors method is used.

  • Body: The XQuery body must specify an order item property defined in the order item specification.

    For example, for the Key Expression, you can identify a unique key for each order item, typically the order item line ID:

    fn:normalize-space(osm:properties/im:LineId/text())
    

    For example, for the Parent Key Expression, you can identify a parent order line item, typically the line ID for the parent order line item:

    fn:normalize-space(osm:properties/im:parentLineId/text())
    

In the following example, the key expression uses the parent order line item's <lineId> element from the order item property customer order:

declare namespace im="http://oracle.communications.ordermanagement.unsupported.centralom";
declare namespace osm="http://xmlns.oracle.com/communications/ordermanagement/model";
fn:normalize-space(osm:properties/im:lineId/text())

The parent key expression uses the child order line item's <parentLineId> element from the incoming customer order:

declare namespace im="http://oracle.communications.ordermanagement.unsupported.centralom";
declare namespace osm="http://xmlns.oracle.com/communications/ordermanagement/model";
fn:normalize-space(osm:properties/im:parentLineId/text())