Jeopardy Automators
An order jeopardy automation plug-in can be triggered when a particular condition is met, such as when a task exceeds the expected duration configured for the task or when the process that the task is a part of exceeds its excepted process duration. The automation can be any internal XQuery, XSLT, or custom automation since the jeopardy, by definition, can only be triggered by events happening within the task or the process. For more information about the characteristics for these automations, see "Automation Plug-in XQuery Examples," "Automation Plug-in XSLT Examples," and "Custom Java Automation Plug-ins."
Note:
For an order level jeopardy automation plug-in you must declare the OrderNotificationContext instead of TaskContext. For example:
declare namespace context = "java:com.mslv.oms.automation.OrderNotificationContext";
For a task level jeopardy automation plug-in, if the task level jeopardy condition Multiple events per Task instance is set indicating that the task is a multi-instance task and the event should be triggered for each instance, then you must declare TaskNotificationContext
so that the task data is passed to each instance of the event. If the task is not a multi-instance task, then OrderNotificationContext
should be declared.
The following example is an internal automator plug-in that uses methods available to the OrderNotificationContext class to get notification details from the task in combination with the XML API Notification.Request that logs the jeopardy notification details. Other jeopardy examples could also send an email or trigger a pager.
declare namespace oms="urn:com:metasolv:oms:xmlapi:1"; declare namespace automator = "java:oracle.communications.ordermanagement.automation.plugin.ScriptReceiverContextInvocation"; declare namespace context = "java:com.mslv.oms.automation.OrderNotificationContext"; declare namespace log = "java:org.apache.commons.logging.Log"; declare option saxon:output "method=xml"; declare option saxon:output "saxon:indent-spaces=2"; declare variable $automator external; declare variable $context external; declare variable $log external; declare variable $exitStatus := "success"; let $thisOrderId := context:getOrderId($context) (: let $taskMnemonic := context:getTaskMnemonic($context) :) let $notificationName := context:getNotificationName($context) let $notificationType := context:getNotificationType($context) let $orderId := fn:root(.)/oms:GetOrder.Response/oms:_root/oms:orderId let $xmlRequest := '<Notifications.Request xmlns="urn:com:metasolv:oms:xmlapi:1" />' let $notifications := context:processXMLRequest($context, $xmlRequest) return ( log:info($log, fn:concat("XQuery jeopardy: order[", $thisOrderId, "], notificationContext [", context:getClass($context), "], notificationName[", $notificationName, "], notificationType[", $notificationType, "], notifications[", $notifications, "] entered order ID [", $orderId/text(), "]")), <placeholder/> )