1 package WF_XML AUTHID CURRENT_USER as
2 /* $Header: wfmxmls.pls 120.8.12020000.1 2012/06/30 13:46:15 appldev ship $ */
3 /*#
4 * Provides APIs to access the Oracle Workflow XML message processing subsystem.
5 * @rep:scope public
6 * @rep:product OWF
7 * @rep:displayname Workflow XML Message Processing Subsystem
8 * @rep:lifecycle active
9 * @rep:category BUSINESS_ENTITY WF_NOTIFICATION
10 * @rep:compatibility S
11 */
12
13
14 /*===========================================================================
15
16 PL*SQL TABLE NAME: wf_xml_attr_rec_type
17
18 DESCRIPTION: Stores a list of element attribute/value pairs
19 ============================================================================*/
20
21 TYPE wf_xml_attr_rec_type IS RECORD
22 (
23 attribute VARCHAR2(250), -- Name for the attribute,
24 value VARCHAR2(1000) -- Value that the attribute
25 -- will take on
26 );
27
28
29 TYPE wf_xml_attr_table_type IS TABLE OF
30 wf_xml_attr_rec_type INDEX BY BINARY_INTEGER;
31
32 TYPE wf_response_rec_t IS RECORD
33 (
34 NAME VARCHAR2(30),
35 TYPE VARCHAR2(8),
36 FORMAT VARCHAR2(240),
37 VALUE VARCHAR2(32000)
38 );
39
40 TYPE wf_responseList_t IS TABLE OF
41 wf_response_rec_t
42 INDEX BY BINARY_INTEGER;
43
44 WF_NTF_REASIGN VARCHAR2(100) := 'oracle.apps.wf.notification.reassign';
45 WF_NTF_CLOSE VARCHAR2(100) := 'oracle.apps.wf.notification.close';
46 WF_NTF_CANCEL VARCHAR2(100) := 'oracle.apps.wf.notification.cancel';
47
48 -- Part of the oracle.apps.wf.notification.send.group group
49 WF_NTF_SEND_MESSAGE VARCHAR2(100) := 'oracle.apps.wf.notification.send';
50
51 WF_NTF_SEND_QUESTION VARCHAR2(100) := 'oracle.apps.wf.notification.question';
52 WF_NTF_SEND_ANSWER VARCHAR2(100) := 'oracle.apps.wf.notification.answer'; -- As such there is no need for this
53
54 WF_NTF_SEND_SUMMARY VARCHAR2(100) :=
55 'oracle.apps.wf.notification.summary.send';
56 WF_NTF_SUMMARY VARCHAR2(100) := 'oracle.apps.fnd.wf.mailer.Mailer.notification.summary';
57
58 -- Part of the oracle.apps.wf.notification.receive group
59 WF_NTF_RECEIVE_ERROR VARCHAR2(100) :=
60 'oracle.apps.wf.notification.receive.error';
61 WF_NTF_RECEIVE_MESSAGE VARCHAR2(100) :=
62 'oracle.apps.wf.notification.receive.message';
63 WF_NTF_RECEIVE_SENDRETURN VARCHAR2(100) :=
64 'oracle.apps.wf.notification.receive.sendreturn';
65 WF_NTF_RECEIVE_UNAVAIL VARCHAR2(100) :=
66 'oracle.apps.wf.notification.receive.unavail';
67
68 -- GetTagValue - Obtain the value for a given TAG from within the
69 -- Document Tree
70 -- IN
71 -- document as a CLOB
72 -- TAG to find the value of
73 -- The position to start looking for the TAG from
74 -- OUT
75 -- Value of the TAG. ie the value between the start and end TAGs
76 -- The position in the CLOB after the find
77 -- The list of attributes associated with the TAG (Not implemented as yet)
78 procedure GetTagValue(p_doc in out NOCOPY CLOB, p_tag in varchar2,
79 p_value out NOCOPY varchar2,
80 p_pos in out NOCOPY integer,
81 p_attrlist in out NOCOPY wf_xml_attr_table_type);
82
83 -- GetXMLMessage - Return a CLOB Document containing an XML encoded
84 -- version of the notification. No recipients list
85 -- will be populated. That will be the responsibility
86 -- of the calling procedure.
87 --
88 -- IN
89 -- notification id
90 -- Protocol for the message
91 -- List of recipients to recieve the notification
92 -- mailer node name
93 -- Web Agent for the HTML attachments
94 -- Reply to address for the final notification
95 -- Language for the notification
96 -- Territory for the notification
97 -- OUT
98 -- Prioirty
99 -- A CLOB Containing the XML encoded message.
100 procedure GetXMLMessage (p_nid in number,
101 p_protocol in varchar2,
102 p_recipient_list in WF_DIRECTORY.wf_local_roles_tbl_type,
103 p_node in varchar2,
104 p_agent in varchar2,
105 p_replyto in varchar2,
106 p_nlang in varchar2,
107 p_nterr in varchar2,
108 p_priority out NOCOPY number,
109 p_message in out NOCOPY CLOB);
110
111 -- EnqueueNotification - To push a notification to the outbound notification
112 -- queue.
113 -- IN
114 -- Notification ID
115 procedure EnqueueNotification(p_nid in number);
116
117
118 -- DequeueMessage - Remove a notification from the queue
119 -- IN
120 -- Queue name to operate on
121 -- Correlation for the message - NID in this implementation
122 -- OUT
123 -- The message that is obtained from the queue.
124 -- Timeout to signal whether the queue is empty.
125
126 procedure DequeueMessage(p_queue_name in varchar2,
127 p_correlation in varchar2 default NULL,
128 p_message in out NOCOPY CLOB,
129 p_timeout out NOCOPY boolean);
130 -- GetMessage - Get email message data
131 -- IN
132 -- Queue name to operate on
133 -- OUT
134 -- Notification ID
135 -- Comma seperated list of the recipients of the notification
136 -- Status of the notification - For the purpose of message templating
137 -- Timout. Returns TRUE where the queue is empty.
138 -- Error message
139 procedure GetMessage(
140 p_queue in number,
141 p_nid out NOCOPY number,
142 p_receiverlist out NOCOPY varchar2,
143 p_status out NOCOPY varchar2,
144 p_timeout out NOCOPY integer,
145 p_error_result in out NOCOPY varchar2);
146
147 -- GetSortMessage - Get email message data
148 -- IN
149 -- Queue number to operate on
150 -- OUT
151 -- Notification ID
152 -- Recipient
153 -- Status of the notification - For the purpose of message templating
154 -- Timout. Returns TRUE where the queue is empty.
155 -- Error message
156 procedure GetShortMessage(
157 p_queue in number,
158 p_nid out NOCOPY number,
159 p_recipient out NOCOPY varchar2,
160 p_status out NOCOPY varchar2,
161 p_timeout out NOCOPY integer,
162 p_error_result in out NOCOPY varchar2);
163
164 -- GetExceptionMessage - Get email message data
165 -- IN
166 -- Queue number to operate on
167 -- OUT
168 -- Notification ID
169 -- Recipient
170 -- Status of the notification - For the purpose of message templating
171 -- Timout. Returns TRUE where the queue is empty.
172 -- Error message
173 procedure GetExceptionMessage(
174 p_queue in number,
175 p_nid out NOCOPY number,
176 p_recipient out NOCOPY varchar2,
177 p_status out NOCOPY varchar2,
178 p_timeout out NOCOPY boolean,
179 p_error_result in out NOCOPY varchar2);
180
181 -- GetShortMessage - Get email message data
182 -- IN
183 -- Queue name to operate on
184 -- OUT
185 -- Notification ID
186 -- Recipient
187 -- Status of the notification - For the purpose of message templating
188 -- Timout. Returns TRUE where the queue is empty.
189 -- Error message
190 procedure GetQueueMessage(
191 p_queuename in varchar2,
192 p_nid out NOCOPY number,
193 p_recipient out NOCOPY varchar2,
194 p_status out NOCOPY varchar2,
195 p_timeout out NOCOPY integer,
196 p_error_result in out NOCOPY varchar2);
197
198 -- RemoveNotification
199 -- To remove all enqueues messages for a given notification.
200 -- IN
201 -- Notification ID of the message to locate and remove.
202 -- NOTE
203 -- This is a destructive procedure that's sole purpose is to purge the
204 -- message from the queue. We only call this when we do not care for the
205 -- content.
206 procedure RemoveNotification(p_nid in number);
207
208 -- setFistMessage
209 -- To set the global variable g_first_message
210 -- IN
211 -- 'Y' to set the flag to TRUE
212 procedure setFirstMessage(p_first_message IN varchar2);
213
214
215 -- Generate
216 -- The generate function for the WF_NOTIFICATION_OUT queue. This
217 -- will handle all oracle.apps.wf.notification.send.% events and
218 -- generate an XML representation of the outbound notification.
219 -- IN
220 -- p_event_name - The VARCHAR2 event name
221 -- p_event_key - The VARCHAR2 event key
222 -- p_parameter_list - The wf_parameter_list_t containing the parameters
223 -- that were passed in with the event.
224 -- OUT
225 -- CLOB The XML representation of the outbound notification
226 /*#
227 * Generates the XML message content as the event data for events in the
228 * Notification Send group (oracle.apps.wf.notification.send.group). The
229 * send events are then ready to be placed on the WF_NOTIFICATION_OUT
230 * agent to be processed by the notification mailer.
231 *
232 * @param p_event_name The internal name of the event
233 * @paraminfo {rep:required}
234 * @param p_event_key The event key that identifies the specific instance of the event
235 * @paraminfo {rep:required}
236 * @param p_parameter_list The list of additional parameters for the event
237 * @paraminfo {@rep:innertype WF_PARAMETER_LIST_T} {rep:required}
238 *
239 * @return The XML message content to use as the event data payload
240 *
241 * @rep:displayname Generate Notification Content
242 * @rep:scope public
243 * @rep:lifecycle active
244 * @rep:compatibility S
245 */
246 function Generate(p_event_name in varchar2,
247 p_event_key in varchar2,
248 p_parameter_list in wf_parameter_list_t default null)
249 return clob;
250
251 function GetAttachment(p_nid in number,
252 p_doc in out NOCOPY CLOB,
253 p_agent in varchar2,
254 p_disposition in varchar2,
255 p_doc_type in varchar2,
256 p_pos in out NOCOPY integer) return integer;
257
258 -- sendNotification
259 -- This API is a wrapper to the wf_xml.enqueueNotification. It is provided
260 -- as forward compatabilty for the original mailer since the call to
261 -- wf_xml.enqueueNotification has been removed from
262 -- wf_notification.sendSingle.
263 -- To use the original mailer, one must enable the subscription that will
264 -- call this rule function.
265 -- IN
266 -- p_subscription
267 -- p_event
268 -- RETURN
269 -- varchar2 of the status
270 /*#
271 * Provides forward compatibility for the previous C-based Notification
272 * Mailer that is now replaced by the Java-based Workflow Notification
273 * Mailer. To use the C-based mailer, you must enable the subscription
274 * to the oracle.apps.wf.notification.send.group event that calls this
275 * rule function.
276 *
277 * @param p_subscription_guid The globally unique identifier of the subscription that calls this rule function
278 * @paraminfo {@rep:required}
279 * @param p_event The event message that triggers the subscription
280 * @paraminfo {@rep:innertype WF_EVENT_T} {@rep:required}
281 * @return If succeed, returns 'SUCCESS' otherwise 'ERROR'
282 *
283 * @rep:displayname Legacy Send Notification Rule
284 * @rep:scope public
285 * @rep:lifecycle obsolete
286 * @rep:compatibility N
287 */
288 function SendNotification (p_subscription_guid in raw,
289 p_event in out NOCOPY WF_EVENT_T) return varchar2;
290
291 -- receive
292 -- Handle the notification receive events
293 -- This will handle the processing of the inbound responses
294 -- IN
295 -- p_subscription_guid - The RAW GUID of the event subscription
296 -- p_event - The WF_EVENT_T containing the event information
297 function receive (p_subscription_guid in raw,
298 p_event in out NOCOPY WF_EVENT_T) return varchar2;
299
300 -- GetResponseDetails
301 -- Gets the response details from the incoming XML Notifiction
302 -- structure.
303 --
304 -- IN
305 -- message - The XML Notification structure containing the
306 -- inbound response
307 procedure getResponseDetails(message in CLOB);
308
309 procedure getResponseDetails(message in CLOB, node out NOCOPY varchar2,
310 version out NOCOPY integer,
311 fromRole out NOCOPY varchar2,
312 responses in out NOCOPY wf_responseList_t);
313
314 -- SummaryRule
315 -- To handle the summary notification request event
316 -- and call the approapriate summary generate function for
317 -- either the role or the member of the role.
318 /*#
319 * Launches summary notifications for each role that has open
320 * notifications and a notification preference of SUMMARY or SUMHTML.
321 * This function calls the appropriate APIs to generate the summary
322 * content for each role and for each member of those roles.
323 *
324 * @param p_subscription_guid The globally unique identifier of the subscription that calls this rule function
325 * @paraminfo {@rep:required}
326 * @param p_event The event message that triggers the subscription
327 * @paraminfo {@rep:innertype WF_EVENT_T} {@rep:required}
328 * @return If succeed, returns 'SUCCESS' otherwise 'ERROR'
329 *
330 * @rep:displayname Send Summary Notification Rule
331 * @rep:scope public
332 * @rep:lifecycle active
333 * @rep:compatibility S
334 */
335 function SummaryRule (p_subscription_guid in raw,
336 p_event in out NOCOPY WF_EVENT_T) return varchar2;
337
338 /*
339 ** error_rule - dispatch functionality for error subscription processing
340 **
341 ** Identical to default_rule, but if an exception is caught we raise it
342 ** up to cause a rollback. We don't want messages processed off the
343 ** error queue to be continually recycled back on to the error queue.
344 **
345 ** Returns SUCCESS or raises an exception
346 **
347 */
348 /*#
349 * Catches and raises internal exceptions in message processing to force
350 * a rollback. This API helps prevent endless loops if failed messages
351 * result in error messages that also fail.
352 *
353 * @param p_subscription_guid The globally unique identifier of the subscription that calls this rule function
354 * @paraminfo {@rep:required}
355 * @param p_event The event message that triggers the subscription
356 * @paraminfo {@rep:innertype WF_EVENT_T} {@rep:required}
357 * @return If succeed, returns 'SUCCESS' otherwise 'ERROR'
358 *
359 * @rep:displayname Send Notification Error Rule
360 * @rep:scope public
361 * @rep:lifecycle active
362 * @rep:compatibility S
363 */
364 FUNCTION error_rule(p_subscription_guid in raw,
365 p_event in out nocopy wf_event_t) return varchar2;
366
367 -- Gets the LOB content for a PLSQLCLOB
368 -- IN
369 -- pAPI the API to call
370 -- pDoc The LOB to take the document
371 procedure getDocContent(pNid in NUMBER, pAPI in VARCHAR2,
372 pDoc in out nocopy CLOB);
373
374 -- Gets the LOB content for a PLSQLCLOB
375 -- IN
376 -- pAPI the API to call
377 -- pDoc The LOB to take the document
378 procedure getBDocContent(pNid in NUMBER, pAPI in VARCHAR2,
379 pDoc in out nocopy BLOB);
380
381 -- gets the size of the current LOB table
382 function getLobTableSize return number;
383
384 -- AddElementAttribute - Add an Element Attribute Value pair to the attribute
385 -- list.
386 -- IN
387 -- Name of the attribute
388 -- Value for the attribute
389 -- The attribute list to add the name/value pair to.
390 procedure AddElementAttribute(p_attribute_name IN VARCHAR2,
391 p_attribute_value IN VARCHAR2,
392 p_attribute_list IN OUT NOCOPY wf_xml_attr_table_type);
393
394 -- NewLOBTag - Create a new TAG node and insert it into the
395 -- Document Tree
396 -- IN
397 -- document as a CLOB
398 -- Position to take the new Tag Node
399 -- New Tag to be created
400 -- Data to be added between the start and end TAGs
401 -- Attribute list to be included in the opening TAG
402 -- OUT
403 -- The document containing the new TAG.
404 function NewLOBTag (p_doc in out NOCOPY CLOB,
405 p_pos in integer,
406 p_tag in varchar2,
407 p_data in varchar2,
408 p_attribute_list IN OUT NOCOPY wf_xml_attr_table_type)
409 return integer;
410
411 -- SkipLOBTag - To move return a pointer past the nominated TAG
412 -- starting from a given position in the document.
413 -- IN
414 -- document
415 -- Position to take the new Tag Node
416 -- New Tag to be created
417 -- Data to be added
418 -- RETURN
419 -- New position past the </TAG>.
420 function SkipLOBTag (p_doc in out NOCOPY CLOB,
421 p_tag in varchar2,
422 p_offset in out NOCOPY integer,
423 p_occurance in out NOCOPY integer)
424 return integer;
425
426 -- NewLOBTag - Create a new TAG node and insert it into the
427 -- Document Tree
428 -- IN
429 -- document as a CLOB
430 -- Position to take the new Tag Node
431 -- New Tag to be created
432 -- Data to be added between the start and end TAGs
433 -- Attribute list to be included in the opening TAG
434 -- OUT
435 -- The document containing the new TAG.
436 function NewLOBTag (p_doc in out NOCOPY CLOB,
437 p_pos in integer,
438 p_tag in varchar2,
439 p_data in CLOB,
440 p_attribute_list IN OUT NOCOPY wf_xml_attr_table_type)
441 return integer;
442
443 -- SkipTag - To move return a pointer past the nominated TAG
444 -- starting from a given position in the document.
445 -- IN
446 -- document
447 -- Position to take the new Tag Node
448 -- New Tag to be created
449 -- Data to be added
450 -- RETURN
451 -- New position past the </TAG>.
452 function SkipTag (p_doc in out NOCOPY VARCHAR2,
453 p_tag in varchar2,
454 p_offset in out NOCOPY integer,
455 p_occurance in out NOCOPY integer)
456 return integer;
457
458 -- NewTag - Create a new TAG node and insert it into the
459 -- Document Tree
460 -- IN
461 -- document as a CLOB
462 -- Position to take the new Tag Node
463 -- New Tag to be created
464 -- Data to be added between the start and end TAGs
465 -- Attribute list to be included in the opening TAG
466 -- OUT
467 -- The document containing the new TAG.
468 function NewTag (p_doc in out NOCOPY VARCHAR2,
469 p_pos in integer ,
470 p_tag in varchar2,
471 p_data in varchar2,
472 p_attribute_list IN OUT NOCOPY wf_xml_attr_table_type)
473 return integer;
474
475 -- Send_Rule - This is the subscription rule function for the event group
476 -- 'oracle.apps.wf.notification.send.group'. If the message
477 -- payload is not complete return 'SUCCESS' from here, hence
478 -- incomplete message payload/event will not be enqueued to
479 -- WF_NOTIFICATION_OUT AQ.
480 -- IN
481 -- p_subscription_guid Subscription GUID as a CLOB
482 -- p_event Event Message
483 -- OUT
484 -- Status as ERROR, SUCCESS, WARNING
485 function Send_Rule(p_subscription_guid in raw,
486 p_event in out nocopy wf_event_t)
487 return varchar2;
488
489 end WF_XML;