Dependency XQuery Expressions

This topic includes information about Orchestration XQuery expressions related to orchestration dependencies:

About Order Item Dependency Property Correlation XQuery Expressions

This topic describes how to use one of the following fields:

  • Orchestration Fulfillment Pattern editor, Orchestration Plan tab, Dependencies tab, Order Item Dependency subtab, XQuery subtab for the Property Correlation selection

  • Orchestration Dependency editor, Order Item Dependencies tab, XQuery subtab for the Property Correlation selection

to write an expression that specifies dependencies between different order items using order item properties. The Property Correlation XQuery has the same context, prolog, and body structure as the Orchestration Fulfillment Pattern editor, Order Components tab, Order Item Association subtab, XQuery subtab. See "About Associating Order Items Using Property Correlations XQuery Expressions" for more information.

The following example shows a dependency that requires provisioning of an Internet service before shipping a modem. This involves two order items: provision Internet service and ship modem. The correlating property is the order item ID.

declare namespace osm="http://xmlns.oracle.com/communications/ordermanagement/model";
declare namespace im="http://sample.broadband";
let $bbProvision := osm:fromOrderComponent/osm:orderItem[osm:name="Internet Service"]
let $bbModem := osm:toOrderComponent/osm:orderItem[osm:name/text()='Broadband Modem' 
   and osm:properties/im:SiteID/text() = $bbProvision/osm:properties/im:SiteID/text()]
return
   <osm:dependency fromOrderItemId='{$bbProvision/@id}' toOrderItemId='{$bbModem/@id}'/> 

In this example:

  • $bbProvision contains the broadband service order item in the blocking Provision order component.

  • $bbModem is the broadband modem in the waiting Ship order component.

  • The XQuery returns a dependency from the Internet Service order item to its associated Broadband Modem order item, identified by $bbProvision/@id and $bbModem/@id.

If the order item IDs are:

  • $bbProvision/@id = 1301589468772

  • $bbModem/@id = 1301589468785

Then the XQuery returns the following:

<osm:dependency fromOrderItemId='1301589468772' toOrderItemId='1301589468785'/>

About Wait Delay Duration XQuery Expressions

This topic describes how to use one of the following fields:

  • Orchestration Fulfillment Pattern editor, Orchestration Plan tab, Dependencies subtab, Wait Condition subtab, Wait Delay area, Duration Expression area XQuery subtab for the Duration selection

  • Orchestration Dependency editor, Wait for Condition tab, Wait Delay area, Duration Expression area XQuery subtab for the Duration selection

to write an expression that specifies the duration of delay, based on an order item property, before starting a waiting order component after all dependencies have been resolved.

  • Context: The Duration XQuery input document is the entire set of order items included in the order contained in the toOrderComponent element. You can return the value of requestedDeliveryDate to help determine the wait delay duration. For example:

    <toOrderComponent xmlns="">
     <osm:orderItem [35 lines]
     <osm:orderItem [37 lines]
     <osm:orderItem [42 lines]
     <osm:orderItem 
     xmlns:osm="http://xmlns.oracle.com/communications/ordermanagement/model" id="5678">
     <osm:name>Broadband Bundle [Add]</osm:name>
    .....
      <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>Broadband Bundle [Add]</im:lineItemName>
       <im:lineId>4</im:lineId>
       <im:SiteID>10</im:SiteID>
       <im:ServiceActionCode>UPDATE</im:ServiceActionCode>
       <im:productClass>Broadband Bundle Class</im:productClass>
       <im:serviceId>1112223333</im:serviceId>
       <im:productSpec>Broadband.Bundle</im:productSpec>
       <im:lineItemPayload> [34 lines]
       <im:region>Sao Paulo</im:region>
      <osm:properties>
     <osm:orderItem [57 lines]
     <osm:orderItem [57 lines]
     <osm:orderItem [42 lines]
     <osm:orderItem [37 lines]
     <osm:orderItem [37 lines]
     <osm:orderItem [57 lines]
    </toOrderComponent>
    
  • Prolog: You can declare the order item 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";
    
  • Body: The XQuery body returns a duration value based on the requestedDeliveryDate order item property:

    let $mydate := osm:toOrderComponent[1]/osm:orderItem[1]/osm:properties[1]/*[namespace-uri()='http://oracle.communications.ordermanagement.unsupported.centralom' and local-name()='requestedDeliveryDate'][1]/text() 
    return  
    if (fn:current-dateTime()- xs:dateTime($mydate) < xs:dayTimeDuration('PT10H'))  then 
        'PT10H' 
    else 
        'PT10M'
    return
    

    where

    • osm:toOrderComponent: Provides the entire set of order items included in the order.

    • osm:orderItem: These are the order items in the toOrderComponent category. The remainder of this expression identifies the namespace of the order item specification and returns the value of the requestedDeliveryDate element.

    • The if statement checks to see if the value of the requestedDeliveryDate is less than the hard-coded dayTimeDuration value. These values conform to the XSD duration data type.

    • The then statement returns 10 hours if the if statement evaluates to true.

    • The else statement return 10 months if the if statement evaluates to false.

The following example shows the sample XQuery to return a duration value.

declare namespace osm="http://xmlns.oracle.com/communications/ordermanagement/model"; 
declare namespace im="http://oracle.communications.ordermanagement.unsupported.centralom"; 
 
let $mydate := osm:toOrderComponent[1]/osm:orderItem[1]/osm:properties[1]/*[namespace-uri()='http://oracle.communications.ordermanagement.unsupported.centralom' and local-name()='requestedDeliveryDate'][1]/text() 
return  
if (fn:current-dateTime()- xs:dateTime($mydate) < xs:dayTimeDuration('PT10H'))  then 
    'PT10H' 
else 
    'PT10M'

About Wait Delay Date and Time XQuery Expressions

This topic describes how to use one of the following fields:

  • Orchestration Fulfillment Pattern editor, Orchestration Plan tab, Dependencies subtab, Wait Condition subtab, Wait Delay area, Duration Expression area XQuery subtab for the Date Time Expression selection

  • Orchestration Dependency editor, Wait for Condition tab, Wait Delay area, Duration Expression area XQuery subtab for the Date Time Expression selection

to write an expression that specifies the date and time, based on an order item property, for starting a waiting order component after all dependencies have been resolved.

  • Context: The Date Time Expression XQuery input document is the entire set of order items included in the order contained in the toOrderComponent element. You can use the requestedDeliveryDate order item property to determine the date and time that the XQuery should start after all blocking items have resolved. For example:

    <toOrderComponent xmlns="">
     <osm:orderItem [35 lines]
     <osm:orderItem [37 lines]
     <osm:orderItem [42 lines]
     <osm:orderItem 
     xmlns:osm="http://xmlns.oracle.com/communications/ordermanagement/model" id="5678">
     <osm:name>Broadband Bundle [Add]</osm:name>
    .....
      <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>Broadband Bundle [Add]</im:lineItemName>
       <im:lineId>4</im:lineId>
       <im:SiteID>10</im:SiteID>
       <im:ServiceActionCode>UPDATE</im:ServiceActionCode>
       <im:productClass>Broadband Bundle Class</im:productClass>
       <im:serviceId>1112223333</im:serviceId>
       <im:productSpec>Broadband.Bundle</im:productSpec>
       <im:lineItemPayload> [34 lines]
       <im:region>Sao Paulo</im:region>
      <osm:properties>
     <osm:orderItem [57 lines]
     <osm:orderItem [57 lines]
     <osm:orderItem [42 lines]
     <osm:orderItem [37 lines]
     <osm:orderItem [37 lines]
     <osm:orderItem [57 lines]
    </toOrderComponent>
    
  • Prolog: You can declare the order item 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";
    
  • Body: The XQuery body returns a date and time value based on the requestedDeliveryDate order item property:

    osm:toOrderComponent[1]/osm:orderItem[1]/osm:properties[1]/*[namespace-uri()='http://oracle.communications.ordermanagement.unsupported.centralom' and local-name()='requestedDeliveryDate'][1]/text() 
    

    osm:toOrderComponent: returns the entire set of order items included in the order and returns the requested delivery date of all order items for the wait delay date and time.

The following example shows the sample XQuery to return a date time value.

declare namespace osm="http://xmlns.oracle.com/communications/ordermanagement/model"; 
declare namespace im="http://oracle.communications.ordermanagement.unsupported.centralom"; 
 
osm:toOrderComponent[1]/osm:orderItem[1]/osm:properties[1]/*[namespace-uri()='http://oracle.communications.ordermanagement.unsupported.centralom' and local-name()='requestedDeliveryDate'][1]/text() 

About Order Data Change Wait Condition XQuery Expressions

This topic describes how to use the Orchestration Fulfillment Pattern editor, Orchestration Plan tab, Dependencies subtab, Wait Condition subtab, Wait for Condition area, XQuery subtab for the Data Change Notification selection,

This topic describes how to use one of the following fields:

  • Orchestration Fulfillment Pattern editor, Orchestration Plan tab, Dependencies subtab, Wait Condition subtab, Wait for Condition area, XQuery subtab for the Data Change Notification selection

  • Orchestration Dependency editor, Wait for Condition tab, Wait for Condition area, XQuery subtab for the Data Change Notification selection

to write an expression that specifies a value that must exist in order item property (typically a blocking order item property) before a waiting order item starts.

  • Context: The Data Change Notification XQuery input document is the task view task data that was changed using an update order transaction.

  • Prolog: You can declare the $blockingIndexes variable in the XQuery prolog that contains an index of data element for all blocking order items. For example:

    declare variable $blockingIndexes as xs:integer* external;
    
  • Body: The XQuery body returns a specific value and will wait until all blocking order items have the corresponding value and the XQuery returns true.

The following example shows the XQuery that evaluates the data change. The dependency is met when all blocking order items have reached a state of PROVISION STARTED.

(:   The $blockingIndexes variable contains data element indexes for all blocking order items:   :)
declare variable $blockingIndexes as xs:integer* external;
(:   Specify "PROVISION STARTED" as the data value that must be met:   :)
let $expectedMilestoneCode := "PROVISION STARTED"
(:   $milestoneValues contains a set of milestones for all blocking order items:   :)
let $milestoneValues := 
     /GetOrder.Response/_root/ControlData/Functions/ProvisioningFunction/orderItem/orderItemRef[
     fn:index-of($blockingIndexes, xs:integer(@referencedIndex)) !=
     0]/milestone[text() eq $expectedMilestoneCode]
(:   Return true only if all the milestones in ProvisioningFunction/orderItem/orderItemRef are PROVISION STARTED:   :)
return fn:count($milestoneValues) eq fn:count($blockingIndexes)

The following example returns true when at least one blocking item is completed.

declare namespace oms="urn:com:metasolv:oms:xmlapi:1";
declare variable $blockingIndexes as xs:integer* external;
let $component := //ControlData/Functions/NetworkProvisionFunction
let $lineItem := $component/orderItem/orderItemRef[fn:index-of($blockingIndexes, xs:integer(@referencedIndex)) != 0]
return
     if (fn:exists($lineItem))
     then
        let $statusValue := $lineItem/OrderItemStatus/text() = "completed"
        return
        if (fn:count($statusValue)>0) 
        then 
            fn:true()
        else 
            fn:false()
     else 
        fn:false() 

About Order Item Inter-Order Dependency XQuery Expressions

This topic describes how to use the Order Item Specification editor, Order Item Dependency tab, Order Item Selector area, XQuery tab to write an expression that creates dependencies between the order items on the follow-on order and the order items on the base order. It is the follow-on order that generates this dependency on the base order.

  • Context: The Order Item Selector XQuery input document is typically an order item on a follow-on order (the waiting order).

  • Prolog: You can declare the OSM namespace, the cartridge namespace for the target order (the base order), and the namespace of the query task that contains the order data you want to view. For example:

    declare namespace osm="http://xmlns.oracle.com/communications/ordermanagement/model";
    declare namespace im="CommunicationsSalesOrderFulfillmentPIP";
    declare namespace osmc="urn:oracle:names:ordermanagement:cartridge: CommunicationsSalesOrderFulfillmentPIP:1.0.0:view:CommunicationsSalesOrderQueryTask";
    
  • Body: The CRM that sends the follow-on order must specify the reference number that uniquely identifies the base order and also the order item line ID of the blocking order item. You can define a variable (such as $dependingLineId) that extracts the dependent line ID from the order item context. For example:

    let $dependingLineId := fn:normalize-space(osm:properties/im:DependingSalesOrderBaseLineId)
    

    You can configure a web service data instance provider that runs a FindOrder web service that searches for orders based on the reference value (osm:properties/prop:Ref/text())) in the follow-on order that generates a FindOrder response that includes the order ID of the base order. See OSM Developer's Guide for more information about configuring web service data instance providers. For example:

    <ord:FindOrder xmlns:ord="http://xmlns.oracle.com/communications/ordermanagement"
       xmlns:osm="http://xmlns.oracle.com/communications/ordermanagement/model"
       xmlns:prop="http://oracle.communications.ordermanagement.unsup.centralom">
       <ord:ViewBy>
          <ord:AmendmentFilter>
             <ord:LevelOfDetail>AmendmentsSummary</ord:LevelOfDetail>
          </ord:AmendmentFilter>
          <ord:LifecycleEventFilter>
             <ord:RetrieveLifecycleEvents>false</ord:RetrieveLifecycleEvents>
          </ord:LifecycleEventFilter>
       </ord:ViewBy>
       <ord:SelectBy>
          <ord:Reference>{fn:normalize-space(osm:properties/prop:Ref/text())} </ord:Reference>
       </ord:SelectBy>
    </ord:FindOrder>
    

    This data instance provider returns the order ID of the base order which you can capture in an XQuery variable (such as $parentOrderID). You can use this variable in a data instance provider that runs a GetOrder web service to obtain the order item details from the base order. For example, the following XQuery populates the GetOrder request message using the results from the "findOrder" data instance provider to provide the value for the order ID of the base order in the Order ID field:

    <ord:GetOrder xmlns:ord="http://xmlns.oracle.com/communications/ordermanagement"
        xmlns:osm="http://xmlns.oracle.com/communications/ordermanagement/model">
            <ord:OrderId>{vf:instance("findOrder")/ord:Order[last()]/ord:Amendments/ord:AmendedOrderSummary/ord:Id/text()}</ord:OrderId> <ord:View>CommunicationsSalesOrderQueryTask</ord:View>
    </ord:GetOrder>
    

    This data instance provider returns all order item instances in the base order that you can then search through to find the blocking order item using the $dependingLineId variable. You can capture the results in an XQuery variable (such as $parentOrderItemId). For example:

    let $parentOrderItemId :=fn:normalize-space(vf:instance("getOrder") /ord:Data/osmc:_root/osmc:ControlData/osmc:OrderItem [osmc:BaseLineId=$dependingLineId]/@index)
    

    The XQuery body returns the order ID of the base order and the order item property that specifies the blocking order item on the base order:

     <osm:dependency fromOrderId="{$parentOrderId}" fromOrderItemId="{$parentOrderItemId}"/>
    

    where

    • <osm:dependency fromOrderId: Returns the base order ID.

    • fromOrderItemId: Returns the blocking order item property value that controls the dependency. OSM internally monitors the blocking order item until it is no longer being processed by any order component on the base order.

The following example shows an XQuery for an inter-order dependency.

declare namespace ord="http://xmlns.oracle.com/communications/ordermanagement";
declare namespace im="CommunicationsSalesOrderFulfillmentPIP";
declare namespace osmc="urn:oracle:names:ordermanagement:cartridge: CommunicationsSalesOrderFulfillmentPIP:1.0.0:view:CommunicationsSalesOrderQueryTask";
let $dependingLineId := fn:normalize-space(osm:properties /im:DependingSalesOrderBaseLineId)
return
   if(fn:not($dependingLineId = ''))
   then
(: Use the data instance behavior "findOrder" to find the base order:   :)
      let $parentOrderId := fn:normalize-space(vf:instance("findOrder")/ord:Order[last()]/ord:Amendments/ord:AmendedOrderSummary/ord:Id/text())
(: Use the data instance behavior "getOrder" to find the associated order item ID in the base order: :)
      let $parentOrderItemId :=
         fn:normalize-space(vf:instance("getOrder")/ord:Data/
         osmc:_root/osmc:ControlData/osmc:OrderItem[osmc:BaseLineId=$dependingLineId]/@index)
      return
         if(fn:not($parentOrderId = '') and fn:not($parentOrderItemId = ''))
      then
(: Return the dependency: :)
      <osm:dependency fromOrderId="{$parentOrderId}" fromOrderItemId="{$parentOrderItemId}"/>
      else()
   else()