DBA Data[Home] [Help]

PACKAGE: APPS.WF_NOTIFICATION

Source


1 package WF_NOTIFICATION as
2 /* $Header: wfntfs.pls 120.9.12010000.7 2009/02/26 01:36:28 alepe ship $ */
3 /*#
4  * Provides APIs to access the Oracle Workflow Notification
5  * System and manage notifications.
6  * @rep:scope public
7  * @rep:product OWF
8  * @rep:displayname Workflow Notification System
9  * @rep:lifecycle active
10  * @rep:compatibility S
11  * @rep:category BUSINESS_ENTITY WF_NOTIFICATION
12  * @rep:ihelp FND/@notif_api See the related online help
13  */
14 
15 --
16 -- Type
17 --
18 type tdType is table of varchar2(4005) index by binary_integer;
19 
20 --
21 -- Constant values
22 --
23 
24 -- Document attribute presentation type tags
25 doc_text varchar2(30) := 'text/plain';
26 doc_html varchar2(30) := 'text/html';
27 fwk_region_start varchar2(20) :=  'JSP:/OA_HTML/OA.jsp?';
28 notification_macro varchar2(20) := 'WF_NOTIFICATION';
29 fwk_mailer_page varchar2(100) := '/OA_HTML/OA.jsp?page=/oracle/apps/fnd/wf/worklist/webui/NotifMailerPG';
30 
31 
32 -- Cached NLS values
33 -- 64 is drawned from v$nls_valid_values view.
34 nls_language  varchar2(64);
35 nls_territory varchar2(64);
36 nls_charset   varchar2(64);
37 
38 -- Debug
39 debug   boolean := FALSE;
40 
41 
42 -- Bug 3065814
43 -- Global context variables for post-notification
44 g_context_user  varchar2(320);
45 g_context_user_comment VARCHAR2(4000);
46 g_context_recipient_role varchar2(320);
47 g_context_original_recipient varchar2(320);
48 g_context_from_role varchar2(320);
49 g_context_new_role   varchar2(320);
50 g_context_more_info_role  varchar2(320);
51 g_context_proxy varchar2(320);
52 
53 -- User's NLS date mask
54 g_nls_date_mask varchar2(50);
55 
56 -- NTF_TABLE
57 --   Generate a "Browser Look and Feel (BLAF)" look a like table.
58 -- ADA compliance is achieved through "scope".
59 --
60 -- IN
61 --   cells - array of table cells
62 --   col   - number of columns
63 --   type  - V to generate a vertical table
64 --         - H to generate a horizontal table
65 --   rs    - the result html code for the table
66 --
67 -- NOTE
68 --   type - Vertical table is Header always on the first column
69 --        - Horizontal table is Headers always on first row
70 --
71 --   cell has the format:
72 --     R40%:content of the cell here
73 --     ^ ^
74 --     | |
75 --     | + -- width specification
76 --     +-- align specification (L-Left, C-Center, R-Right)
77 --
78 procedure NTF_Table(cells in tdType,
79                     col   in pls_integer,
80                     type  in varchar2,  -- 'V'ertical or 'H'orizontal
81                     rs    in out nocopy varchar2);
82 --
83 -- WF_MSG_ATTR
84 --   Create a table of message attributes
85 -- NOTE
86 --   o Considered using dynamic sql passing in attributes as a comma delimited
87 --     list.  The cost of non-reusable sql may be high.
88 --   o Considered using bind variables with dynamic sql.  Then we must impose
89 --     a hard limit on the number of bind variables.  If a limit exceed we
90 --     need some fall back handling.
91 --   o Parsing the comma delimited list and making individual select is more
92 --     costly.  But the sql will be reusable, it may end up cheaper.
93 --
94 function wf_msg_attr(nid    in number,
95                      attrs  in varchar2,
96                      disptype in varchar2)
97 return varchar2;
98 
99 -- AddAttr
100 --   Add a new run-time notification attribute.
101 --   The attribute will be completely unvalidated.  It is up to the
102 --   user to do any validation and insure consistency.
103 -- IN:
104 --   nid - Notification Id
105 --   aname - Attribute name
106 --
107 /*#
108  * Adds a new runtime notification attribute. Perform validation and insure
109  * consistency in the use of the attribute, as it is completely unvalidated
110  * by Oracle Workflow.
111  * @param nid Notification ID
112  * @param aname Attribute Name
113  * @rep:scope public
114  * @rep:lifecycle active
115  * @rep:displayname Add Notification Attribute
116  * @rep:compatibility S
117  * @rep:ihelp FND/@notif_api#a_addatt See the related online help
118  */
119 procedure AddAttr(nid in number,
120                   aname in varchar2);
121 
122 
123 -- SetAttrText
124 --   Set the value of a notification attribute, given text representation.
125 --   If the attribute is a NUMBER or DATE type, then translate the
126 --   text-string value to a number/date using attribute format.
127 --   For all other types, store the value directly.
128 -- IN:
129 --   nid - Notification id
130 --   aname - Attribute Name
131 --   avalue - New value for attribute
132 --
133 /*#
134  * Sets the value of a notification text attribute at either send or respond
135  * time. The notification agent (sender) may set the value of SEND attributes.
136  * The performer (responder) may set the value of RESPOND attributes.
137  * @param nid Notification ID
138  * @param aname Attribute Name
139  * @param avalue Attribute Value
140  * @rep:scope public
141  * @rep:lifecycle active
142  * @rep:displayname Set Notification Text Attribute Value
143  * @rep:compatibility S
144  * @rep:businessevent oracle.apps.wf.notification.setattrtext
145  * @rep:ihelp FND/@notif_api#a_setatt See the related online help
146  */
147 procedure SetAttrText(nid in number,
148                       aname in varchar2,
149                       avalue in varchar2);
150 
151 
152 -- SetAttrNumber
153 --   Set the value of a number notification attribute.
154 --   Attribute must be a NUMBER-type attribute.
155 -- IN:
156 --   nid - Notification id
157 --   aname - Attribute Name
158 --   avalue - New value for attribute
159 --
160 /*#
161  * Sets the value of a notification number attribute at either send or respond
162  * time. The notification agent (sender) may set the value of SEND attributes.
163  * The performer (responder) may set the value of RESPOND attributes.
164  * @param nid Notification ID
165  * @param aname Attribute Name
166  * @param avalue Attribute Value
167  * @rep:scope public
168  * @rep:lifecycle active
169  * @rep:displayname Set Notification Number Attribute Value
170  * @rep:compatibility S
171  * @rep:ihelp FND/@notif_api#a_setatt See the related online help
172  */
173 procedure SetAttrNumber (nid in number,
174                          aname in varchar2,
175                          avalue in number);
176 
177 
178 -- SetAttrDate
179 --   Set the value of a date notification attribute.
180 --   Attribute must be a DATE-type attribute.
181 -- IN:
182 --   nid - Notification id
183 --   aname - Attribute Name
184 --   avalue - New value for attribute
185 --
186 /*#
187  * Sets the value of notification date attribute at either send or respond
188  * time. The notification agent (sender) may set the value of SEND attributes.
189  * The performer (responder) may set the value of RESPOND attributes.
190  * @param nid Notification ID
191  * @param aname Attribute Name
192  * @param avalue Attribute Value
193  * @rep:scope public
194  * @rep:lifecycle active
195  * @rep:displayname Set Notification Date Attribute Value
196  * @rep:compatibility S
197  * @rep:ihelp FND/@notif_api#a_setatt See the related online help
198  */
199 procedure SetAttrDate (nid in number,
200                        aname in varchar2,
201                        avalue in date);
202 
203 
204 -- GetAttrInfo
205 --   Get type information about a notification attribute.
206 -- IN:
207 --   nid - Notification id
208 --   aname - Attribute name
209 -- OUT:
210 --   atype  - Attribute type
211 --   subtype - 'SEND' or 'RESPOND',
212 --   format - Attribute format
213 --
214 /*#
215  * Returns information about a notification attribute, such as its type,
216  * subtype, and format, if any is specified. The subtype is always SEND
217  * or RESPOND to indicate the attribute's source.
218  * @param nid Notification ID
219  * @param aname Attribute Name
220  * @param atype Attribute Type
221  * @param subtype Attribute Subtype ('SEND' or 'RESPOND')
222  * @param format Attribute Format
223  * @rep:scope public
224  * @rep:lifecycle active
225  * @rep:displayname Get Notification Attribute Information
226  * @rep:compatibility S
227  * @rep:ihelp FND/@notif_api#a_getattinfo See the related online help
228  */
229 procedure GetAttrInfo(nid in number,
230                       aname in varchar2,
231                       atype out nocopy varchar2,
232                       subtype out nocopy varchar2,
233                       format out nocopy varchar2);
234 
235 
236 -- GetAttrText
237 --   Get the value of a text notification attribute.
238 --   If the attribute is a NUMBER or DATE type, then translate the
239 --   number/date value to a text-string representation using attrbute format.
240 --   For all other types, get the value directly.
241 -- IN:
242 --   nid - Notification id
243 --   aname - Attribute Name
244 --   ignore_notfound - Ignore if Not Found
245 -- RETURNS:
246 --   Attribute value
247 /*#
248  * Returns the value of a specified text message attribute.
249  * @param nid Notification ID
250  * @param aname Attribute Name
251  * @param ignore_notfound Ignore if Not Found
252  * @return Text Attribute Value
253  * @rep:scope public
254  * @rep:lifecycle active
255  * @rep:displayname Get Notification Text Attribute Value
256  * @rep:compatibility S
257  * @rep:ihelp FND/@notif_api#a_getatt See the related online help
258  */
259 function GetAttrText (nid in number,
260                       aname in varchar2,
261    	              ignore_notfound in boolean default NULL)
262 return varchar2;
263 
264 
265 -- GetAttrNumber
266 --   Get the value of a number notification attribute.
267 --   Attribute must be a NUMBER-type attribute.
268 -- IN:
269 --   nid - Notification id
270 --   aname - Attribute Name
271 -- RETURNS:
272 --   Attribute value
273 /*#
274  * Returns the value of a specified number message attribute.
275  * @param nid Notification ID
276  * @param aname Attribute Name
277  * @return Number Attribute Value
278  * @rep:scope public
279  * @rep:lifecycle active
280  * @rep:displayname Get Notification Number Attribute Value
281  * @rep:compatibility S
282  * @rep:ihelp FND/@notif_api#a_getatt See the related online help
283  */
284 function GetAttrNumber (nid in number,
285                         aname in varchar2)
286 return number;
287 
288 
289 -- GetAttrDate
290 --   Get the value of a date notification attribute.
291 --   Attribute must be a DATE-type attribute.
292 -- IN:
293 --   nid - Notification id
294 --   aname - Attribute Name
295 -- RETURNS:
296 --   Attribute value
297 /*#
298  * Returns the value of a specified date message attribute.
299  * @param nid Notification ID
300  * @param aname Attribute Name
301  * @return Date Attribute Value
302  * @rep:scope public
303  * @rep:lifecycle active
304  * @rep:displayname Get Notification Date Attribute Value
305  * @rep:compatibility S
306  * @rep:ihelp FND/@notif_api#a_getatt See the related online help
307  */
308 function GetAttrDate (nid in number,
309                       aname in varchar2)
310 return date;
311 
312 --
313 -- GetAttrDoc
314 --   Get the displayed value of a DOCUMENT-type attribute.
315 --   Returns referenced document in format requested.
316 --   Use GetAttrText to get retrieve the actual attr value (i.e. the
317 --   document key string instead of the actual document).
318 -- NOTE:
319 --   Only PLSQL document type is implemented.
320 -- IN:
321 --   nid - Notification id
322 --   aname - Attribute Name
323 --   disptype - Requested display type.  Valid values:
324 --               'text/plain' - plain text
325 --               'text/html' - html
326 --               '' - attachment(?)
327 -- RETURNS:
328 --   Referenced document in format requested.
329 --
330 /*#
331  * Returns the displayed value of a Document-type attribute. The
332  * referenced document appears in either plain text or HTML format, as
333  * requested. If you wish to retrieve the actual attribute value, that is,
334  * the document key string instead of the actual document, use GetAttrText().
335  * @param nid Notification ID
336  * @param aname Attribute Name
337  * @param disptype Display Type
338  * @return Document Attribute Value
339  * @rep:scope public
340  * @rep:lifecycle active
341  * @rep:displayname Get Notification Document Attribute Value
342  * @rep:compatibility S
343  * @rep:ihelp FND/@notif_api#a_gad See the related online help
344  */
345 function GetAttrDoc(
346   nid in number,
347   aname in varchar2,
348   disptype in varchar2)
349 return varchar2;
350 
351 --
352 -- SetFrameworkAgent
353 --   Check the URL for a JSP: entry and then substitute
354 --   it with the value of the APPS_FRAMEWORK_AGENT
355 --   profile option.
356 -- IN:
357 --   URL - URL to be ckecked
358 -- RETURNS:
359 --   URL with Frame work agent added
360 -- NOTE:
361 --   If errors are detected this routine returns some_text untouched
362 --   instead of raising exceptions.
363 --
364 function SetFrameworkAgent(url in varchar2)
365 return varchar2;
366 
367 --
368 -- GetText
369 --   Substitute tokens in an arbitrary text string.
370 --     This function may return up to 32K chars. It can NOT be used in a view
371 --   definition or in a Form.  For views and forms, use GetShortText, which
372 --   truncates values at 2000 chars.
373 -- IN:
374 --   some_text - Text to be substituted
375 --   nid - Notification id of notification to use for token values
376 --   disptype - Display type ('text/plain', 'text/html', '')
377 -- RETURNS:
378 --   Some_text with tokens substituted.
379 -- NOTE:
380 --   If errors are detected this routine returns some_text untouched
381 --   instead of raising exceptions.
382 --
383 /*#
384  * Substitutes tokens in an arbitrary text string using token values from a
385  * particular notification. This function may return up to 32K characters.
386  * You cannot use this function in a view definition or in an Oracle Forms
387  * Developer form. For views and forms, use GetShortText() which truncates
388  * values at 1950 characters. If an error is detected, this function returns
389  * some_text unsubstituted rather than raise exceptions.
390  * @param some_text Text to be substituted
394  * @rep:scope public
391  * @param nid Notification ID
392  * @param disptype Display Type
393  * @return Substituted Text
395  * @rep:lifecycle active
396  * @rep:displayname Get Notification Text
397  * @rep:compatibility S
398  * @rep:ihelp FND/@notif_api#a_gettext See the related online help
399  */
400 function GetText(some_text in varchar2,
401                  nid in number,
402                  disptype in varchar2 default '')
403 return varchar2;
404 
405 --
406 -- GetUrlText
407 --   Substitute url-style tokens (with dashes) an arbitrary text string.
408 --     This function may return up to 32K chars. It can NOT be used in a view
409 --   definition or in a Form.  For views and forms, use GetShortText, which
410 --   truncates values at 2000 chars.
411 -- IN:
412 --   some_text - Text to be substituted
413 --   nid - Notification id of notification to use for token values
414 -- RETURNS:
415 --   Some_text with tokens substituted.
416 -- NOTE:
417 --   If errors are detected this routine returns some_text untouched
418 --   instead of raising exceptions.
419 --
420 
421 function GetUrlText(some_text in varchar2,
422                     nid in number)
423 return varchar2;
424 pragma restrict_references(GetUrlText, WNDS);
425 
426 --
427 -- GetShortText
428 --   Substitute tokens in an arbitrary text string, limited to 2000 chars.
429 --     This function is meant to be used in view definitions and Forms, where
430 --   the field size must be limited to 2000 chars.  Use GetText() to retrieve
431 --   up to 32K if the text may be longer.
432 -- IN:
433 --   some_text - Text to be substituted
434 --   nid - Notification id of notification to use for token values
435 -- RETURNS:
436 --   Some_text with tokens substituted.
437 -- NOTE:
438 --   If errors are detected this routine returns some_text untouched
439 --   instead of raising exceptions.
440 --
441 /*#
442  * Substitutes tokens in an arbitrary text string using token values from a
443  * particular notification. This function may return up to 1950 characters.
444  * This function is meant for use in view definitions and Oracle Forms
445  * Developer forms, where the field size is limited to 1950 characters. Use
446  * GetText() in other situations where you need to retrieve up to 32K
447  * characters. If an error is detected, this function returns some_text
448  * unsubstituted rather than raise exceptions.
449  * @param some_text Text to be substituted
450  * @param nid Notification ID
451  * @return Substituted Text
452  * @rep:scope public
453  * @rep:lifecycle active
454  * @rep:displayname Get Notification Short Text
455  * @rep:compatibility S
456  * @rep:ihelp FND/@notif_api#a_gst See the related online help
457  */
458 function GetShortText(some_text in varchar2,
459                       nid in number)
460 return varchar2;
461 pragma restrict_references(GetShortText, WNDS);
462 
463 --
464 -- GetSubject
465 --   Get subject of notification message with token values substituted
466 --   from notification attributes.
467 -- IN:
468 --   nid - Notification Id
469 -- RETURNS:
470 --   Substituted message subject
471 -- NOTE:
472 --   If errors are detected this routine returns the subject unsubstituted,
473 --   or null if all else fails, instead of raising exceptions.  It must do
474 --   this so the routine can be pragma'd and used in the
475 --   wf_notifications_view view.
476 --
477 /*#
478  * Returns the subject line for the notification message. Any message
479  * attribute in the subject is token substituted with the value of the
480  * corresponding message attribute.
481  * @param nid Notification ID
482  * @return Subject Text
483  * @rep:scope public
484  * @rep:lifecycle active
485  * @rep:displayname Get Notification Subject
486  * @rep:compatibility S
487  * @rep:ihelp FND/@notif_api#a_getsubj See the related online help
488  */
489 function GetSubject(
490   nid in number)
491 return varchar2;
492 --pragma restrict_references(GetSubject, WNDS);
493 
494 --
495 -- GetBody
496 --   Get body of notification message with token values substituted
497 --   from notification attributes.
498 --     This function may return up to 32K chars. It can NOT be used in a view
499 --   definition or in a Form.  For views and forms, use GetShortBody, which
500 --   truncates values at 2000 chars.
501 -- IN:
502 --   nid - Notification Id
503 --   disptype - Display type ('text/plain', 'text/html', '')
504 -- RETURNS:
505 --   Substituted message body
506 -- NOTE:
507 --   If errors are detected this routine returns the body unsubstituted,
508 --   or null if all else fails, instead of raising exceptions.
509 --
510 /*#
511  * Returns the HTML or plain text message body for the notification,
512  * depending on the message body type specified. Any message attribute
513  * in the body is token substituted with the value of the corresponding
517  * truncates values at 1950 characters. Note that the returned plain text
514  * notification attribute. This function may return up to 32K characters.
515  * You cannot use this function in view definitions or in Oracle
516  * Developer forms. For views and forms, use GetShortBody( ) which
518  * message body is not formatted, it should be wordwrapped as appropriate
519  * for the output device. Body text may contain tabs (which indicate
520  * indentation) and newlines (which indicate paragraph termination).
521  * @param nid Notification ID
522  * @param disptype Display Type
523  * @return Notification Body
524  * @rep:scope public
525  * @rep:lifecycle active
526  * @rep:displayname Get Notification Body
527  * @rep:compatibility S
528  * @rep:ihelp FND/@notif_api#a_getbody See the related online help
529  */
530 function GetBody(
531   nid in number,
532   disptype in varchar2 default '')
533 return varchar2;
534 
535 --
536 -- GetShortBody
537 --   Get body of notification message with token values substituted
538 --   from notification attributes.
539 --     This function is meant to be used in view definitions and Forms, where
540 --   the field size must be limited to 2000 chars.  Use GetBody() to retrieve
541 --   up to 32K if the text may be longer.
542 -- IN:
543 --   nid - Notification Id
544 -- RETURNS:
545 --   Substituted message body
546 -- NOTE:
547 --   If errors are detected this routine returns the body unsubstituted,
548 --   or null if all else fails, instead of raising exceptions.  It must do
549 --   this so the routine can be pragma'd and used in the
550 --   wf_notifications_view view.
551 --
552 /*#
553  * Returns the message body for the notification. Any message attribute
554  * in the body is token substituted with the value of the corresponding
555  * notification attribute. This function may return up to 1950 characters.
556  * This function is meant for use in view definitions and Oracle Developer
557  * forms, where the field size is limited to 1950 characters. Use GetBody()
558  * in other situations where you need to retrieve up to 32K characters.
559  * Note that the returned plain text message body is not formatted; it
560  * should be wordwrapped as appropriate for the output device. Body text
561  * may contain tabs (which indicate indentation) and newlines (which
562  * indicate paragraph termination). If an error is detected, this function
563  * returns the body unsubstituted or null if all else fails, rather than
564  * raise exceptions.
565  * @param nid Notification ID
566  * @return Notification Body
567  * @rep:scope public
568  * @rep:lifecycle active
569  * @rep:displayname Get Notification Short Body
570  * @rep:compatibility S
571  * @rep:ihelp FND/@notif_api#a_gsb See the related online help
572  */
573 function GetShortBody(nid in number)
574 return varchar2;
575 pragma restrict_references(GetShortBody, WNDS);
576 
577 --
578 -- GetInfo
579 --   Return info about notification
580 -- IN
581 --   nid - Notification Id
582 -- OUT
583 --   role - Role notification is sent to
584 --   message_type - Type flag of message
585 --   message_name - Message name
586 --   priority - Notification priority
587 --   due_date - Due date
588 --   status - Notification status (OPEN, CLOSED, CANCELED)
589 --
590 /*#
591  * Returns the role that the notification is sent to, the item type of the
592  * message, the name of the message, the notification priority, the due
593  * date and the status for the specified notification.
594  * @param nid Notification ID
595  * @param role Recipient Role
596  * @param message_type Message Type
597  * @param message_name Message Name
598  * @param priority Priority
599  * @param due_date Due Date
600  * @param status Status
601  * @rep:scope public
602  * @rep:lifecycle active
603  * @rep:displayname Get Notification Information
604  * @rep:compatibility S
605  * @rep:ihelp FND/@notif_api#a_getinfo See the related online help
606  */
607 procedure GetInfo(nid in number,
608                   role out nocopy varchar2,
609                   message_type out nocopy varchar2,
610                   message_name out nocopy varchar2,
611                   priority out nocopy varchar2,
612                   due_date out nocopy varchar2,
613                   status out nocopy varchar2);
614 
615 --
616 -- Responder
617 --   Return responder of closed notification.
618 -- IN
619 --   nid - Notification Id
620 -- RETURNS
621 --   Responder to notification.  If no responder was set or notification
622 --   not yet closed, return null.
623 --
624 /*#
625  * Returns the responder of a closed notification. If the notification was
626  * closed using the Web Notification interface the value returned will be a
627  * valid role defined in the view WF_ROLES. If the Notification was closed
628  * using the e-mail interface then the value returned will be an e-mail address.
629  * @param nid Notification ID
630  * @return Responder
631  * @rep:scope public
632  * @rep:lifecycle active
633  * @rep:displayname Get Notification Responder
634  * @rep:compatibility S
635  * @rep:ihelp FND/@notif_api#responder See the related online help
636  */
637 function Responder(
638   nid in number)
639 return varchar2;
640 
641 -- AccessCheck
645 -- RETURNS
642 --   Check that the notification is open and access key is valid.
643 -- IN
644 --   Access string <nid>/<nkey>
646 --   user name (if notificaiton is open and key is valid)
647 --   othersise null
648 /*#
649  * Returns a username if the notification access string is valid and the
650  * notification is open, otherwise it returns null. The access string is
651  * automatically generated by the notification mailer that sends the
652  * notification and is used to verify the authenticity of both text and
653  * HTML versions of e-mail notifications.
654  * @param access_str Access String
655  * @return Username
656  * @rep:scope public
657  * @rep:lifecycle active
658  * @rep:displayname Check Notification Access
659  * @rep:compatibility S
660  * @rep:ihelp FND/@notif_api#a_acccheck See the related online help
661  */
662 function AccessCheck(access_str in varchar2) return varchar2;
663 pragma restrict_references(AccessCheck, WNDS);
664 
665 --
666 -- Send
667 --   Send the role the specified message.
668 --   Insert a single notification in the notifications table, and set
669 --   the default send and respond attributes for the notification.
670 -- IN:
671 --   role - Role to send notification to
672 --   msg_type - Message type
673 --   msg_name - Message name
674 --   due_date - Date due
675 --   callback - Callback function
676 --   context - Data for callback
677 --   send_comment - Comment to add to notification
678 --   priority - Notification priority
679 -- RETURNS:
680 --   Notification Id
681 --
682 /*#
683  * Sends the specified message to a role, returning a notification ID if
684  * successful. The notification ID must be used in all future references
685  * to the notification. If your message has message attributes, the procedure
686  * looks up the values of the attributes from the message attribute table or
687  * it can use an optionally supplied callback interface function to get the
688  * value from the item type attributes table.
689  * @param role Recipient Role
690  * @param msg_type Message Type
691  * @param msg_name Message Name
692  * @param due_date Due Date
693  * @param callback Callback Function
694  * @param context Context
695  * @param send_comment Send Comment
696  * @param priority Priority
697  * @return Notification ID
698  * @rep:scope public
699  * @rep:lifecycle active
700  * @rep:displayname Send Notification
701  * @rep:compatibility S
702  * @rep:ihelp FND/@notif_api#a_send See the related online help
703  */
704 function Send(role in varchar2,
705               msg_type in varchar2,
706               msg_name in varchar2,
707               due_date in date default null,
708               callback in varchar2 default null,
709               context in varchar2 default null,
710               send_comment in varchar2 default null,
711               priority in number default null)
712 return number;
713 
714 --
715 -- SendGroup
716 --   Send the role users the specified message.
717 --   Send a separate notification to every user assigned to the role.
718 -- IN:
719 --   role - Role of users to send notification to
720 --   msg_type - Message type
721 --   msg_name - Message name
722 --   due_date - Date due
723 --   callback - Callback function
724 --   context - Data for callback
725 --   send_comment - Comment to add to notification
726 --   priority - Notification priority
727 -- RETURNS:
728 --   Group ID - Id of notification group
729 --
730 /*#
731  * Sends a separate notification to all the users assigned to a specific role
732  * and returns a number called a notification group ID, if successful. The
733  * notification group ID identifies that group of users and the notification
734  * they each received. If your message has message attributes, the procedure
735  * looks up the values of the attributes from the message attribute table or
736  * it can use an optionally supplied callback interface function to get the
737  * value from the item type attributes table.
738  * @param role Recipient Role
739  * @param msg_type Message Type
740  * @param msg_name Message Name
741  * @param due_date Due Date
742  * @param callback Callback Function
743  * @param context Context
744  * @param send_comment Send Comment
745  * @param priority Priority
746  * @return Notification Group ID
747  * @rep:scope public
748  * @rep:lifecycle active
749  * @rep:displayname Send Group Notification
750  * @rep:compatibility S
751  * @rep:ihelp FND/@notif_api#a_sndgrp See the related online help
752  */
753 function SendGroup(role in varchar2,
754                    msg_type in varchar2,
755                    msg_name in varchar2,
756                    due_date in date default null,
757                    callback in varchar2 default null,
758                    context in varchar2 default null,
759                    send_comment in varchar2 default null,
760                    priority in number default null)
761 return number;
762 
763 --
764 -- Forward
765 --   Forward a notification, identified by NID to another user. Validate
766 --   the user and Return error messages ...
767 -- IN:
768 --   nid - Notification Id
769 --   new_role - Role to forward notification to
770 --   forward_comment - comment to append to notification
771 --   user - role who perform this action if provided
775 --                  WA    - By Proxy User thro' Worklist Access
772 --   cnt - count for recursive purpose
773 --   action_source - From where the procedure is called from
774 --                  RULE  - Routing Rule
776 --                  ADMIN - Status Monitor
777 --
778 /*#
779  * Delegates a notification to a new role to perform work, even though
780  * the original role recipient still maintains ownership of the notification
781  * activity. Also implicitly calls the Callback function specified in the
782  * Send or SendGroup function with FORWARD mode. A comment can be supplied
783  * to explain why the forward is taking place.
784  * @param nid Notification ID
785  * @param new_role New Recipient Role for the Notification
786  * @param forward_comment Forwarding Comment
787  * @param user For Internal Use Only
788  * @param cnt For Internal Use Only
789  * @param action_source For Internal Use Only
790  * @rep:scope public
791  * @rep:lifecycle active
792  * @rep:displayname Forward Notification
793  * @rep:compatibility S
794  * @rep:businessevent oracle.apps.wf.notification.reassign
795  * @rep:ihelp FND/@notif_api#a_forward See the related online help
796  */
797 procedure Forward(nid             in number,
798                   new_role        in varchar2,
799                   forward_comment in varchar2 default null,
800                   user            in varchar2 default null,
801                   cnt             in number   default 0,
802                   action_source   in varchar2 default null);
803 
804 --
805 -- Transfer
806 --   Transfer a notification, identified by NID to another user. Validate
807 --   the user and Return error messages ...
808 -- IN:
809 --   nid - Notification Id
810 --   new_role - Role to transfer notification to
811 --   forward_comment - comment to append to notification
812 --   user - role who perform this action if provided
813 --   cnt - count for recursive purpose
814 --   action_source - From where the procedure is called from
815 --                  RULE  - Routing Rule
816 --                  WA    - By Proxy User thro' Worklist Access
817 --                  ADMIN - Status Monitor
818 --
819 /*#
820  * Forwards a notification to a new role and transfers ownership of the
821  * notification to the new role. It also implicitly calls the Callback
822  * function specified in the Send or SendGroup function with TRANSFER mode.
823  * A comment can be supplied to explain why the forward is taking place.
824  * @param nid Notification ID
825  * @param new_role New Recipient Role for the Notification
826  * @param forward_comment Forwarding Comment
827  * @param user For Internal Use Only
828  * @param cnt For Internal Use Only
829  * @param action_source For Internal Use Only
830  * @rep:scope public
831  * @rep:lifecycle active
832  * @rep:displayname Transfer Notification
833  * @rep:compatibility S
834  * @rep:businessevent oracle.apps.wf.notification.reassign
835  * @rep:ihelp FND/@notif_api#a_transfer See the related online help
836  */
837 procedure Transfer(nid in number,
838                   new_role in varchar2,
839                   forward_comment in varchar2 default null,
840                   user in varchar2 default null,
841                   cnt in number default 0,
842                   action_source in varchar2 default null);
843 
844 --
845 -- Cancel
846 --   Cancel a single notification.
847 -- IN:
848 --   nid - Notification Id
849 --   cancel_comment - Comment to append to notification
850 --
851 /*#
852  * Cancels a notification. The notification status is then changed to
853  * 'CANCELED' but the row is not removed from the WF_NOTIFICATIONS table
854  * until a purge operation is performed. If the notification was delivered
855  * via e-mail and expects a response, a 'Canceled' e-mail is sent to the
856  * original recipient as a warning that the notification is no longer valid.
857  * @param nid Notification ID
858  * @param cancel_comment Cancel Comment
859  * @rep:scope public
860  * @rep:lifecycle active
861  * @rep:displayname Cancel Notification
862  * @rep:compatibility S
863  * @rep:businessevent oracle.apps.wf.notification.cancel
864  * @rep:ihelp FND/@notif_api#a_cancel See the related online help
865  */
866 procedure Cancel(nid in number,
867                  cancel_comment in varchar2 default null);
868 
869 --
870 -- CancelGroup
871 --   Cancel all notifications belonging to a notification group
872 -- IN:
873 --   gid - Notification group id
874 --   cancel_comment - Comment to append to all notifications
875 --
876 /*#
877  * Cancels the individual copies of a specific notification sent to all users in
878  * a notification group. The notifications are identified by the notification
879  * Group ID (gid). The notification status is then changed to 'CANCELED' but the
880  * rows are not removed from the WF_NOTIFICATIONS table until a purge operation
881  * is performed. If the notification was delivered via e-mail and expects a
882  * response, a 'Canceled' e-mail is sent to the original recipient as a warning
883  * that the notification is no longer valid.
884  * @param gid Notification Group ID
885  * @param cancel_comment Cancel Comment
886  * @param timeout Timeout
887  * @rep:scope public
888  * @rep:lifecycle active
889  * @rep:displayname Cancel Group Notification
890  * @rep:compatibility S
894 procedure CancelGroup(gid in number,
891  * @rep:businessevent oracle.apps.wf.notification.cancel
892  * @rep:ihelp FND/@notif_api#a_cnclgrp See the related online help
893  */
895                       cancel_comment in varchar2 default null,
896 		      timeout in boolean default FALSE);
897 
898 --
899 -- Respond
900 --   Respond to a notification.
901 -- IN:
902 --   nid - Notification Id
903 --   respond_comment - Comment to append to notification
904 --   responder - User or role responding to notification
905 --   action_source - From where the procedure is called from
906 --                  RULE  - Routing Rule
907 --                  WA    - By Proxy User thro' Worklist Access
908 --                  ADMIN - Status Monitory
909 --
910 /*#
911  * Completes the response to the notification when the performer applies the
912  * response. The procedure marks the notification as 'CLOSED' and communicates
913  * RESPOND attributes back to the database via the callback function (if supplied).
914  * This procedure also accepts the name of the individual who actually responded
915  * to the notification and stores in the RESPONDER column of WF_NOTIFICATIONS table.
916  * @param nid Notification ID
917  * @param respond_comment Respond Comment
918  * @param responder Performer who responded to the notification
919  * @param action_source For Internal Use Only
920  * @rep:scope public
921  * @rep:lifecycle active
922  * @rep:displayname Respond to Notification
923  * @rep:compatibility S
924  * @rep:businessevent oracle.apps.wf.notification.respond
925  * @rep:ihelp FND/@notif_api#a_respond See the related online help
926  */
927 procedure Respond(nid             in number,
928                   respond_comment in varchar2 default null,
929                   responder       in varchar2 default null,
930                   action_source   in varchar2 default null);
931 
932 --
933 -- TestContext
934 --   Test if current context is correct
935 -- IN
936 --   nid - Notification id
937 -- RETURNS
938 --   TRUE if context ok, or context check not implemented
939 --   FALSE if context check fails
940 --
941 /*#
942  * Tests if the current context is correct by calling the Item Type
943  * Selector/Callback function. This function returns TRUE if the context
944  * check is OK, or if no Selector/Callback function is implemented. It
945  * returns FALSE if the context check fails.
946  * @param nid Notification ID
947  * @return True if check is OK, False otherwise
948  * @rep:scope public
949  * @rep:lifecycle active
950  * @rep:displayname Test Context
951  * @rep:compatibility S
952  * @rep:ihelp FND/@notif_api#a_tc See the related online help
953  */
954 function TestContext(
955   nid in number)
956 return boolean;
957 
958 --
959 --
960 -- VoteCount
961 --      Count the number of responses for a result_code
962 -- IN:
963 --      Gid -  Notification group id
964 --      ResultCode - Result code to be tallied
965 -- OUT:
966 --      ResultCount - Number of responses for ResultCode
967 --      PercentOfTotalPop - % ResultCode ( As a % of total population )
968 --      PercentOfVotes - % ResultCode ( As a % of votes cast )
969 --
970 /*#
971  * Counts the number of responses for a specified result code.
972  * @param Gid Notification Group ID
973  * @param ResultCode Result code to be tallied
974  * @param ResultCount Vote Count
975  * @param PercentOfTotalPop Percent of total population
976  * @param PercentOfVotes Percent of votes cast
977  * @rep:scope public
978  * @rep:lifecycle active
979  * @rep:displayname Vote Count
980  * @rep:compatibility S
981  * @rep:ihelp FND/@notif_api#a_votec See the related online help
982  */
983 procedure VoteCount (   Gid                     in  number,
984                         ResultCode              in  varchar2,
985                         ResultCount             out nocopy number,
986                         PercentOfTotalPop       out nocopy number,
987                         PercentOfVotes          out nocopy number );
988 --
989 -- OpenNotificationsExist
990 --      Determine if any Notifications in the Group are OPEN
991 --
992 --IN:
993 --      Gid -  Notification group id
994 --
995 --Returns:
996 --      TRUE  - if the Group contains open notifications
997 --      FALSE - if the group does NOT contain open notifications
998 --
999 /*#
1000  * Returns 'TRUE' if any notification associated with the specified notification
1001  * group ID is 'OPEN', otherwise it returns 'FALSE'.
1002  * @param Gid Notification Group ID
1003  * @return Notification Open Status
1004  * @rep:scope public
1005  * @rep:lifecycle active
1006  * @rep:displayname Open Notifications Exist
1007  * @rep:compatibility S
1008  * @rep:ihelp FND/@notif_api#a_opennt See the related online help
1009  */
1010 function OpenNotificationsExist( Gid    in Number ) return Boolean;
1011 
1012 --
1013 -- WorkCount
1014 --   Count number of open notifications for user
1015 -- IN:
1016 --   username - user to check
1017 -- RETURNS:
1018 --   Number of open notifications for that user
1019 --
1020 /*#
1021  * Returns the number of open notifications assigned to a role.
1022  * @param username Recipient Role
1023  * @return Open Notification Count
1024  * @rep:scope public
1025  * @rep:lifecycle active
1029  */
1026  * @rep:displayname Work Count
1027  * @rep:compatibility S
1028  * @rep:ihelp FND/@notif_api#a_wct See the related online help
1030 function WorkCount(
1031   username in varchar2)
1032 return number;
1033 
1034 --
1035 -- Close
1036 --   Close a notification.
1037 -- IN:
1038 --   nid - Notification Id
1039 --   resp - Respond Required?  0 - No, 1 - Yes
1040 --   responder - User or role close this notification
1041 --
1042 /*#
1043  * Closes a notification.
1044  * @param nid Notification ID
1045  * @param responder Role performing close
1046  * @rep:scope public
1047  * @rep:lifecycle active
1048  * @rep:displayname Close Notification
1049  * @rep:compatibility S
1050  * @rep:businessevent oracle.apps.wf.notification.close
1051  * @rep:ihelp FND/@notif_api#a_close See the related online help
1052  */
1053 procedure Close(nid in number,
1054                 responder in varchar2 default null);
1055 
1056 -- GetSubSubjectDisplay
1057 --   Get the design subject of a notification and Substitute tokens in text
1058 --   with the display name of the attributes in the subject.
1059 --   This is used in routing rule poplists
1060 -- IN:
1061 --   message_type - Item type of the message
1062 --   message_name - Name of the message to substitute
1063 --
1064 function GetSubSubjectDisplay(message_type IN VARCHAR2, message_name IN VARCHAR2)
1065 return varchar2;
1066 
1067 -- GetSubSubjectDisplayShort
1068 --   Get the design subject of a notification and Substitute tokens in text
1069 --   with ellipsis (...)
1070 --   This is used in routing rule poplists on the Web screens
1071 -- IN:
1072 --   message_type - Item type of the message
1073 --   message_name - Name of the message to substitute
1074 --
1075 function GetSubSubjectDisplayShort(message_type IN VARCHAR2, message_name IN VARCHAR2)
1076 return varchar2;
1077 
1078 -- PLSQL-Clob Processing
1079 
1080 --Name : GetFullBody (PUBLIC)
1081 --Desc : Gets full body of message with all PLSQLCLOB variables transalted.
1082 --       and returns the message in 32K chunks in the msgbody out variable.
1083 --       Call this repeatedly until end_of_body is true.
1084 --       Call syntax is
1085 --while not (end_of_msgbody) loop
1086 --   wf_notification.getfullbody(nid,msgbody,end_of_msgbody);
1087 --end loop;
1088 procedure GetFullBody (nid in number,
1089                        msgbody  out nocopy varchar2,
1090                        end_of_body in out nocopy boolean,
1091                        disptype in varchar2 default 'text/plain');
1092 
1093 --Name: GetFullBodyWrapper (PUBLIC)
1094 --Desc : Gets full body of message with all PLSQLCLOB variables transalted.
1095 --       and returns the message in 32K chunks in the msgbody out variable.
1096 --       Call this repeatedly until end_of_body is "Y". Uses string arg
1097 --       instead of boolean like GetFullBody for end_of_msg_body. Created
1098 --       since booleans cannot be passed via JDBC.
1099 --       Call syntax is
1100 --while (end_of_msgbody <> "Y") loop
1101 --   wf_notification.getfullbody(nid,msgbody,end_of_msgbody);
1102 --end loop;
1103 procedure GetFullBodyWrapper (nid in number,
1104                               msgbody  out nocopy varchar2,
1105                               end_of_body out nocopy varchar2,
1106                               disptype in varchar2 default 'text/plain');
1107 
1108 --Name WriteToClob (PUBLIC)
1109 /*#
1110  * Appends a character string to the end of a character large object
1111  * (CLOB). You can use this procedure to help build the CLOB for a
1112  * PL/SQL CLOB document attribute for a notification.
1113  * @param clob_loc CLOB Locator
1114  * @param msg_string Message string to append
1115  * @rep:scope public
1116  * @rep:lifecycle active
1117  * @rep:displayname Write to CLOB
1118  * @rep:compatibility S
1119  * @rep:ihelp FND/@notif_api#a_wrtclob See the related online help
1120  */
1121 procedure WriteToClob  ( clob_loc      in out nocopy clob,
1122                          msg_string    in  varchar2);
1123 
1124 --
1125 -- GetAttrClob
1126 --   Get the displayed value of a PLSQLCLOB DOCUMENT-type attribute.
1127 --   Returns referenced document in format requested.
1128 --   Use GetAttrText to get retrieve the actual attr value (i.e. the
1129 --   document key string instead of the actual document).
1130 -- NOTE:
1131 --   Only PLSQL document type is implemented.
1132 -- IN:
1133 --   nid      - Notification id
1134 --   astring  - the string to substitute on (ex: '&ATTR1 is your order..')
1135 --   disptype - Requested display type.  Valid values:
1136 --               wf_notification.doc_text - 'text/plain'
1137 --               wf_notification.doc_html - 'text/html'
1138 --   document - The clob into which
1139 --   aname    - Attribute Name (the first part of the string that matches
1140 --              the attr list)
1141 --
1142 procedure GetAttrClob(
1143   nid       in number,
1144   astring   in varchar2,
1145   disptype  in varchar2,
1146   document  in out nocopy clob,
1147   aname     out nocopy varchar2);
1148 
1149 --
1150 -- GetAttrClob
1151 --   Get the displayed value of a PLSQLCLOB DOCUMENT-type attribute.
1152 --   Returns referenced document in format requested.
1153 --   Use GetAttrText to get retrieve the actual attr value (i.e. the
1154 --   document key string instead of the actual document).
1155 --   The document type of the PLSQLCLOB document is returned from the
1159 -- IN:
1156 --   user-defined API
1157 -- NOTE:
1158 --   Only PLSQL document type is implemented.
1160 --   nid      - Notification id
1161 --   astring  - the string to substitute on (ex: '&ATTR1 is your order..')
1162 --   disptype - Requested display type.  Valid values:
1163 --               wf_notification.doc_text - 'text/plain'
1164 --               wf_notification.doc_html - 'text/html'
1165 --   document - Th clob into which
1166 --   aname    - Attribute Name (the first part of the string that matches
1167 --              the attr list)
1168 --
1169 procedure GetAttrClob(
1170   nid       in  number,
1171   astring   in  varchar2,
1172   disptype  in  varchar2,
1173   document  in  out nocopy clob,
1174   doctype   out nocopy varchar2,
1175   aname     out nocopy varchar2);
1176 
1177 --Name Read_Clob
1178 --reads a specific clob in 32K chunks. Call this repeatedly until
1179 --end_of_clob is true.
1180 procedure read_clob (line out nocopy varchar2 ,
1181                      end_of_clob in out nocopy boolean);
1182 
1183 -- Name: NewClob
1184 -- Creates a new record in the temp table with a clob
1185 -- this is necessary because clobs cannot reside in plsql
1186 -- but must be part of a table.
1187 procedure NewClob  (clobloc       in out nocopy clob,
1188                     msg_string    in  varchar2);
1189 
1190 
1191 --Name ReadAttrClob (PUBLIC)
1192 --Desc : Gets full text of a PLSQLCLOB variable
1193 --       and returns the 32K chunks in the doctext out variable.
1194 --       Call this repeatedly until end_of_text is true.
1195 --USE :  use this to get the value of idividual PLSQLCLOBs such as attachments.
1196 --       to susbtitute a PLSQLSQL clob into a message body, use GetFullBody
1197 procedure ReadAttrClob(nid in number,
1198                        aname in varchar2,
1199                        doctext in out nocopy varchar2,
1200                        end_of_text in out nocopy boolean);
1201 
1202 --variable used in clob manipulation
1203 last_nid       pls_integer;
1204 last_disptype  varchar(30);
1205 clob_exists    pls_integer;
1206 clob_chunk     pls_integer:=0;
1207 temp_clob      clob;
1208 
1209 
1210 --
1211 -- Denormalization of Notifications
1212 --
1213 
1214 --
1215 -- GetSessionLanguage (PRIVATE)
1216 --   Try to return the cached session language value.
1217 --   If it is not cached yet, call the real query function.
1218 --
1219 function GetSessionLanguage
1220 return varchar2;
1221 
1222 --
1223 -- GetNLSLanguage (PRIVATE)
1224 --   Get the NLS Lanugage setting of current session
1225 --   Try to cached the value for future use.
1226 -- NOTE:
1227 --   Because it tried to use cached values first.  The subsequent calls
1228 -- will give you the cached values instead of the current value.
1229 --
1230 procedure GetNLSLanguage(language  out nocopy varchar2,
1231                          territory out nocopy varchar2,
1232                          charset   out nocopy varchar2);
1233 
1234 --
1235 -- Denormalize_Notification
1236 --   Populate the donormalized value to WF_NOTIFICATIONS table according
1237 -- to the language setting of username provided.
1238 -- IN:
1239 --   nid - Notification id
1240 --   username - optional role name, if not provided, use the
1241 --              recipient_role of the notification.
1242 --   langcode - language code
1243 --
1244 -- NOTE: username has precedence over langcode.  Either username or
1245 --       langcode is needed.
1246 --
1247 /*#
1248  * Stores denormalized values for certain notification fields, including the
1249  * notification subject, in the WF_NOTIFICATIONS table. If you are using
1250  * the Notification System to send a notification outside of a workflow
1251  * process, you must call Denormalize_Notification() after setting the values
1252  * for any notification attributes, in order to populate the denormalized
1253  * fields. This procedure tests whether the language in which the notification
1254  * should be delivered matches the current session language, and stores the
1255  * denormalized information according to this setting only if the languages match.
1256  * @param nid Notification ID
1257  * @param username Recipient Role
1258  * @param langcode Language Code
1259  * @rep:scope public
1260  * @rep:lifecycle active
1261  * @rep:displayname Denormalize Notification
1262  * @rep:compatibility S
1263  * @rep:ihelp FND/@notif_api#a_dnrm See the related online help
1264  */
1265 procedure Denormalize_Notification(nid      in number,
1266                                    username in varchar2 default null,
1267                                    langcode in varchar2 default null);
1268 
1269 --
1270 -- NtfSignRequirementsMet
1271 --   Checks if the notification's singature requirements are met
1272 -- IN
1273 --   nid - notification id
1274 -- OUT
1275 --   true - if the ntf is signed
1276 --   false - if the ntf is not signed
1277 --
1278 /*#
1279  * Returns 'TRUE' if the response to a notification meets the signature
1280  * requirements imposed by the electronic signature policy for the
1281  * notification.
1282  * @param nid Notification ID
1283  * @return Signature Status
1284  * @rep:scope public
1285  * @rep:lifecycle active
1286  * @rep:displayname Notification Signature Requirements Met
1287  * @rep:compatibility S
1288  * @rep:ihelp FND/@notif_api#a_signmet See the related online help
1292 
1289  */
1290 function NtfSignRequirementsMet(nid in number)
1291 return boolean;
1293 --
1294 -- Request More Info
1295 --
1296 
1297 --
1298 -- UpdateInfo
1299 --   non-null username: Ask this user for more information
1300 --   null username: Reply to the inquery
1301 --   comment could be question or answer
1302 -- IN
1303 --   nid - Notification Id
1304 --   username - User to whom the comment is intended
1305 --   comment - Comment text
1306 --   wl_user - Worklist user to whom the notfication belongs, in case a proxy is acting
1307 --   action_source - Source from where the call is made. Could be null or 'WA'
1308 --
1309 procedure UpdateInfo(nid      in number,
1310                      username in varchar2 default null,
1311                      comment  in varchar2 default null,
1312                      wl_user  in varchar2 default null,
1313                      action_source in varchar2 default null,
1314                      cnt      in number default 0);
1315 
1316 --
1317 -- IsValidInfoRole
1318 --   Check to see if a role is a participant so far
1319 function IsValidInfoRole(nid      in number,
1320                          username in varchar2)
1321 return boolean;
1322 
1323 --
1324 -- More Info mailer support - bug 2282139
1325 --
1326 -- UpdateInfo2 - Called from mailer
1327 --   non-null username - Ask this user for more information
1328 --   null username - Reply to the inquery
1329 --   from email - From email id of responder/requestor
1330 --   comment - could be question or answer
1331 --
1332 procedure UpdateInfo2(nid        in number,
1333                      username   in varchar2 default null,
1334                      from_email in varchar2 default null,
1335                      comment    in varchar2 default null);
1336 
1337 -- UpdateInfoGuest - Called for updating more info when access
1338 --                   key is present
1339 --   responder - Sesson user responding to More info request
1340 --   moreinfoanswer - could be question or answer
1341 --
1342 procedure UpdateInfoGuest(nid                in number,
1343                           moreinforesponder  in varchar2 default null,
1344                           moreinfoanswer     in varchar2 default null);
1345 
1346 --
1347 -- HideMoreInfo
1348 --   Checks the notification attribute #HIDE_MOREINFO to see if the
1349 --   More Information request button is allowed or hidden. Just in case
1350 --   more_info_role becomes not null with direct table update...
1351 function HideMoreInfo(nid in number) return varchar2;
1352 
1353 --
1354 -- GetComments
1355 --   Consolidates the questions and answers asked for the notification.
1356 --   Also returns the last question asked
1357 --   This is for the mailer to send the history with the email.
1358 procedure GetComments(nid          in  number,
1359                       display_type in  varchar2,
1360                       html_history out nocopy varchar2,
1361                       last_ques    out nocopy varchar2);
1362 
1363 -- bug 2581129
1364 -- GetSubject
1365 --   Get subject of notification message with token values substituted
1366 --   from notification attributes. Overloaded to have display type
1367 -- IN
1368 --   nid - Notification Id
1369 --   disptype - Display Type
1370 -- RETURNS
1371 --   Substituted message subject
1372 -- NOTE
1373 --   If errors are detected this routine returns the subject unsubstituted,
1374 --   or null if all else fails, instead of raising exceptions.
1375 --
1376 function GetSubject(nid      in number,
1377                     disptype in varchar2)
1378 return varchar2;
1379 --pragma restrict_references(GetSubject, WNDS);
1380 
1381 --
1382 -- GetAttrBlob
1383 --   Get the displayed value of a PLSQLBLOB DOCUMENT-type attribute.
1384 --   Returns referenced document in format requested.
1385 --   Use GetAttrText to get retrieve the actual attr value (i.e. the
1386 --   document key string instead of the actual document).
1387 -- NOTE:
1388 --   Only PLSQL document type is implemented.
1389 -- IN:
1390 --   nid      - Notification id
1391 --   astring  - the string to substitute on (ex: '&ATTR1 is your order..')
1392 --   disptype - Requested display type.  Valid values:
1393 --               wf_notification.doc_text - 'text/plain'
1394 --               wf_notification.doc_html - 'text/html'
1395 --   document - The blob into which
1396 --   aname    - Attribute Name (the first part of the string that matches
1397 --              the attr list)
1398 --
1399 procedure GetAttrBlob(
1400   nid       in number,
1401   astring   in varchar2,
1402   disptype  in varchar2,
1403   document  in out nocopy blob,
1404   aname     out nocopy varchar2);
1405 
1406 --
1407 -- GetAttrBlob
1408 --   Get the displayed value of a PLSQLBLOB DOCUMENT-type attribute.
1409 --   Returns referenced document in format requested.
1410 --   Use GetAttrText to get retrieve the actual attr value (i.e. the
1411 --   document key string instead of the actual document).
1412 --   The document type of the PLSQLBLOB document is returned from the
1413 --   user-defined API
1414 -- NOTE:
1415 --   Only PLSQL document type is implemented.
1416 -- IN:
1417 --   nid      - Notification id
1418 --   astring  - the string to substitute on (ex: '&ATTR1 is your order..')
1419 --   disptype - Requested display type.  Valid values:
1420 --               wf_notification.doc_text - 'text/plain'
1424 --              the attr list)
1421 --               wf_notification.doc_html - 'text/html'
1422 --   document - Th blob into which
1423 --   aname    - Attribute Name (the first part of the string that matches
1425 --
1426 procedure GetAttrBlob(
1427   nid       in  number,
1428   astring   in  varchar2,
1429   disptype  in  varchar2,
1430   document  in  out nocopy blob,
1431   doctype   out nocopy varchar2,
1432   aname     out nocopy varchar2);
1433 
1434 --
1435 -- Set_NTF_Table_Direction
1436 -- Sets the default direction of notification tables
1437 -- generated through wf_notification.wf_ntf_history
1438 -- and wf_notification.wf_msg_attr
1439 procedure Set_NTF_Table_Direction(direction in varchar2);
1440 
1441 --
1442 -- Set_NTF_Table_Type
1443 -- Sets the default table type for attr tables
1444 -- generated through wf_notification.wf_msg_attr
1445 procedure Set_NTF_Table_type(tableType in varchar2);
1446 
1447 --
1448 -- SubstituteSpecialChars (PUBLIC)
1449 --   Substitutes the occurence of special characters like <, >, \, ', " etc
1450 --   with their html codes in any arbitrary string.
1451 -- IN
1452 --   some_text - text to be substituted
1453 -- RETURN
1454 --   substituted text
1455 /*#
1456  * Substitutes HTML character entity references for special characters in
1457  * a text string and returns the modified text including the substitutions.
1458  * You can use this function as a security precaution when creating a PL/SQL
1459  * document or a PL/SQL CLOB document that contains HTML, to ensure that only
1460  * the HTML code you intend to include is executed.
1461  * @param some_text Text string with HTML characters
1462  * @return String with HTML characters substituted with HTML codes
1463  * @rep:scope public
1464  * @rep:lifecycle active
1465  * @rep:displayname Substitute HTML Special Characters
1466  * @rep:compatibility S
1467  * @rep:ihelp FND/@notif_api#a_subsc See the related online help
1468  */
1469 function SubstituteSpecialChars(some_text in varchar2)
1470 return varchar2;
1471 pragma restrict_references(SubstituteSpecialChars, WNDS);
1472 
1473 
1474 
1475 --
1476 -- isFwkRegion
1477 -- Verifies whether message body is embedded with framework regions
1478 -- IN
1479 --  nid - Notificatin ID
1480 -- RETURN
1481 --  'Y' or 'N'
1482 function isFwkRegion(nid in number) return varchar2;
1483 
1484 --
1485 -- isFwkRegion
1486 -- Overridden for bug 5456241: Default doc type is text/html
1487 -- Verifies whether message body is embedded with framework regions
1488 -- IN
1489 --  nid - Notificatin ID
1490 --  content_type display type (text/plain or text/html)
1491 -- RETURN
1492 --  'Y' or 'N'
1493 function isFwkRegion(nid in number, content_type in varchar2 ) return varchar2;
1494 
1495 --
1496 -- isFwkBody
1497 -- Verifies whether message body is embedded with framework regions
1498 -- IN
1499 --  nid - Notificatin ID
1500 -- RETURN
1501 --  'Y' or 'N'
1502 function isFwkBody(nid in number) return varchar2;
1503 
1504 -- isFwkBody :
1505 -- Overridden for bug 5456241: Default doc type is text/html
1506 -- Verifies whether message body is embedded with framework regions
1507 -- IN
1508 --  nid - Notificatin ID
1509 --  content_type - Display Type (text/plain or text/html)
1510 -- RETURN
1511 --  'Y' or 'N'
1512 
1513 function isFwkBody(nid in number, content_type in varchar2) return varchar2;
1514 
1515 --
1516 -- fwkTokenExist
1517 -- Checks if any notification attribute exist in given message body,
1518 -- is of type DOCUMENT and its value starts with 'JSP:/OA_HTML/OA.jsp?';
1519 --
1520 -- IN
1521 --  nid - Notification ID
1522 --  msgbody - Notification Message body
1523 -- RETURN
1524 --  'Y' or 'N'
1525 --
1526 function fwkTokenExist(nid in number, msgbody in varchar2) return varchar2;
1527 
1528 --
1529 -- getNtfActInfo
1530 -- Fetches Itemtype, itemkey, activity id of a notification
1531 -- IN
1532 --  nid - Notification ID
1533 -- OUT
1534 --  l_itype Itemtype of the notification activity
1535 --  l_itype Itemkey of the process part of which the notification was sent
1536 --  l_actid Activity ID of the Notification Activity in the process
1537 
1538 procedure getNtfActInfo (nid     in  number,
1539                          l_itype out nocopy varchar2,
1540                          l_ikey  out nocopy varchar2,
1541                          l_actid out nocopy number);
1542 
1543 --
1544 -- GetAttrDoc2
1545 --   Get the displayed value of a DOCUMENT-type attribute.
1546 --   Returns referenced document in format requested along with the
1547 --   document type specified by the user.
1548 -- NOTE:
1549 --   Only PLSQL document type is implemented.
1550 --   This procedure wraps the  original implementation and the function
1551 --   GetAttrDoc will call this procedure.
1552 -- IN:
1553 --   nid      - Notification id
1554 --   aname    - Attribute Name
1555 --   disptype - Requested display type.  Valid values:
1556 --               'text/plain' - plain text
1557 --               'text/html' - html
1558 --               '' - attachment(?)
1559 -- RETURNS:
1560 --   Referenced document in format requested.
1561 --   Document type specified by the user
1562 --
1563 
1564 procedure GetAttrDoc2(
1565    nid      in number,
1569    doctype  out nocopy varchar2);
1566    aname    in varchar2,
1567    disptype in varchar2,
1568    document out nocopy varchar2,
1570 
1571 --
1572 -- getFwkBodyURL
1573 --   This API returns a URL to access notification body with
1574 --   Framework content embedded
1575 -- IN:
1576 --   nid      - Notification id
1577 --   disptype - Requested display type.  Valid values:
1578 --               'text/plain' - plain text
1579 --               'text/html' - html
1580 -- RETURNS:
1581 --   Returns the URL returned by call to getFwkBodyURLLang
1582 --
1583 
1584 function getFwkBodyURL( nid in number,
1585                         contenttype varchar2 ) return varchar2;
1586 
1587 --
1588 -- getFwkBodyURLLang
1589 --   This API returns a URL to access notification body with
1590 --   Framework content embedded.
1591 -- IN:
1592 --   nid      - Notification id
1593 --   disptype - Requested display type.  Valid values:
1594 --               'text/plain' - plain text
1595 --               'text/html' - html
1596 -- RETURNS:
1597 --   Returns the URL to access the notification detail body
1598 --
1599 
1600 function getFwkBodyURLLang( nid in number,
1601                             contenttype varchar2,
1602                             language varchar2) return varchar2;
1603 
1604 
1605 --
1606 -- getFwkBodyURL
1607 --   This API returns a URL to access notification body with
1608 --   Framework content embedded.
1609 -- IN:
1610 --   p_nid      - Notification id
1611 --   p_contenttype - Requested display type.  Valid values:
1612 --                 'text/plain' - plain text
1613 --                 'text/html' - html,
1614 --   p_language     language value of that notification / user
1615 --   p_nlsCalendar  nls calender of that user
1616 --
1617 -- RETURNS:
1618 --   Returns the URL to access the notification detail body
1619 --
1620 
1621 function getFwkBodyURL2( p_nid in number,
1622                          p_contenttype varchar2,
1623                          p_language varchar2,
1624                          p_nlsCalendar varchar2) return varchar2;
1625 
1626 
1627 --
1628 -- getSummaryURL
1629 --   This API returns a URL to access summary of notiifications
1630 --
1631 -- IN:
1632 --   mailer_role  - role for which summary of notifications required
1633 --   disptype     - Requested display type.  Valid values:
1634 --               'text/plain' - plain text
1635 --               'text/html' - html
1636 -- RETURNS:
1637 --   Returns the URL to access the summary of notiification for the role
1638 --
1639 
1640 function getSummaryURL( mailer_role varchar2,
1641                         contenttype varchar2 ) return varchar2;
1642 
1643 
1644 
1645 -- getSummaryURL
1646 --   This API returns a URL to access summary of notiifications
1647 --
1648 -- IN:
1649 --   p_mailer_role   - role for which summary of notifications required
1650 --   p_contentType   - Requested display type.  Valid values:
1651 --                   'text/plain' - plain text
1652 --                   'text/html' - html
1653 --   p_nlsCalendar   - nls Calender of that role / user
1654 --
1655 -- RETURNS:
1656 --   Returns the URL to access the summary of notiification for the role
1657 --
1658 
1659 function getSummaryURL2( p_mailer_role IN varchar2,
1660                          p_contentType IN varchar2,
1661                          p_nlsCalendar IN varchar2) return varchar2;
1662 
1663 
1664 -- GetSignatureRequired
1665 -- Determine signing requirements for a policy
1666 -- IN:
1667 --   nid - Notification id - used for error context only
1668 --   p_sig_policy - Policy Name
1669 -- OUT:
1670 --   p_sig_required - Y/N
1671 --   p_fwk_sig_flavor - sigFlavor for browser signing.
1672 --   p_email_sig_flavor - sigFlavor for email
1673 --   p_render_hint - hints like ATTR_ONLY or FULL_TEXT
1674 
1675 procedure GetSignatureRequired(p_sig_policy in varchar2,
1676      p_nid in number,
1677      p_sig_required out nocopy varchar2,
1678      p_fwk_sig_flavor out nocopy varchar2,
1679      p_email_sig_flavor out nocopy varchar2,
1680      p_render_hint out nocopy varchar2);
1681 
1682 -- SetUIErrorMessage
1683 -- API for Enhanced error handling for OAFwk UI Bug#2845488 grengara
1684 -- This procedure can be used for handling exceptions gracefully when dynamic SQL is invloved
1685 
1686 procedure SetUIErrorMessage;
1687 
1688 --
1689 -- GetComments2
1690 --   Creates the Action History table for a given a notification id based on
1691 --   different filter criteria.
1692 -- IN
1693 --   p_nid - Notification id
1694 --   p_display_type - Display Type
1695 --   p_action_type - Action Type to look for (REASSIGN, RESPOND, QA,...)
1696 --   p_comment_date - Comment Date
1697 --   p_from_role - Comment provider
1698 --   p_to_role - Comment receiver
1699 --   p_hide_reassign - If Reassign comments be shown or not
1700 --   p_hide_requestinfo - If More Info request be shown or not
1701 -- OUT
1702 --   p_action_history - Action History table
1703 --
1704 procedure GetComments2(p_nid              in  number,
1705                        p_display_type     in  varchar2 default '',
1706                        p_action_type      in  varchar2 default null,
1710                        p_hide_reassign    in  varchar2 default 'N',
1707                        p_comment_date     in  date     default null,
1708                        p_from_role        in  varchar2 default null,
1709                        p_to_role          in  varchar2 default null,
1711                        p_hide_requestinfo in  varchar2 default 'N',
1712                        p_action_history   out nocopy varchar2);
1713 
1714 
1715 --
1716 -- SetComments
1717 --   Private procedure that is used to store a comment record into WF_COMMENTS
1718 --   table with the denormalized information. A record is inserted for every
1719 --   action performed on a notification.
1720 -- IN
1721 --   p_nid - Notification Id
1722 --   p_from_role - Internal Name of the comment provider
1723 --   p_to_role - Internal Name of the comment recipient
1724 --   p_action - Action performed
1725 --   p_action_source - Source from where the action is performed
1726 --   p_user_comment - Comment Text
1727 --
1728 procedure SetComments(p_nid           in number,
1729                       p_from_role     in varchar2,
1730                       p_to_role       in varchar2,
1731                       p_action        in varchar2,
1732                       p_action_source in varchar2,
1733                       p_user_comment  in varchar2);
1734 
1735 --
1736 -- Resend
1737 --   Private procedure to resend a notification given the notification id. This
1738 --   procedure checks the mail status and recipient's notification preference to
1739 --   see if it is eligible to send e-mail.
1740 -- IN
1741 --   p_nid - Notification Id
1742 --
1743 procedure Resend(p_nid in number);
1744 
1745 --
1746 -- getNtfResponse
1747 -- Fetches result(response) CODE and response display prompt to the notification
1748 -- IN
1749 --  p_nid - Notification ID
1750 -- OUT
1751 --  p_result_code    Result code of the notification
1752 --  p_result_display Display value of the result code
1753 
1754 procedure getNtfResponse (p_nid     in  number,
1755                           p_result_code out nocopy varchar2,
1756                           p_result_display  out nocopy varchar2);
1757 
1758 --
1759 -- SetNLSLanguage (PRIVATE)
1760 --   Set the NLS Lanugage setting of current session
1761 --
1762 procedure SetNLSLanguage(p_language  in varchar2,
1763                          p_territory in varchar2);
1764 
1765 --
1766 -- PropagateHistory (PUBLIC)
1767 --  This API allows Product Teams to publish custom action
1768 --  to WF_COMMENTS table.
1769 --
1770 procedure propagatehistory(p_item_type     in varchar2,
1771                            p_item_key      in varchar2,
1772                            p_document_id   in varchar2,
1773                            p_from_role     in varchar2,
1774                            p_to_role       in varchar2,
1775                            p_action        in varchar2,
1776                            p_action_source in varchar2,
1777                            p_user_comment  in varchar2) ;
1778 
1779 --
1780 -- Resend_Failed_Error_Ntfs (CONCURRENT PROGRAM API)
1781 --   API to re-enqueue notifications with mail_status FAILED and UNAVAIL in order
1782 --   to re-send them. Mailer had processed these notifications earlier and updated
1783 --   the status since these notifications could not be delivered/processed.
1784 --
1785 -- OUT
1786 --   errbuf  - CP error message
1787 --   retcode - CP return code (0 = success, 1 = warning, 2 = error)
1788 -- IN
1789 --   p_mail_status - Mail status that needs to be resent.
1790 --                   ERROR - Only for FYI notifications
1791 --                   FAILED - All notifications
1792 --   p_msg_type - Message type of the notification
1793 --   p_role     - Workflow role whose notifications are to be re-enqueued
1794 --
1795 --   p_from_date - Notification has been sent on or after this date
1796 --   p_to_date   - Notification has been sent on before this date
1797 --               - Type is varchar2 because CP reports problems with Date type
1798 --
1799 procedure Resend_Failed_Error_Ntfs(errbuf        out nocopy varchar2,
1800                                    retcode       out nocopy varchar2,
1801                                    p_mail_status in varchar2 default null,
1802                                    p_msg_type    in varchar2 default null,
1803                                    p_role        in varchar2 default null,
1804 				   p_from_date   in varchar2 default null,
1805 				   p_to_date     in varchar2 default null);
1806 
1807 -- Denormalize Custom Columns
1808 procedure denormalizeColsConcurrent(retcode      out nocopy varchar2,
1809   			            errbuf       out nocopy varchar2,
1810 			            p_item_type  in varchar2,
1811 			            p_status     in varchar2,
1812     			            p_recipient  in varchar2);
1813 
1814 END WF_Notification;