1 package FND_WF_NOTIFICATION AUTHID CURRENT_USER as
2 /* $Header: afwfntfs.pls 115.3 2003/09/08 14:59:23 ctilley noship $ */
3
4
5 -- AddAttr
6 -- Add a new run-time notification attribute.
7 -- The attribute will be completely unvalidated. It is up to the
8 -- user to do any validation and insure consistency.
9 -- IN:
10 -- nid - Notification Id
11 -- aname - Attribute name
12 --
13 procedure AddAttr(nid in number,
14 aname in varchar2);
15
16
17 -- SetAttrText
18 -- Set the value of a notification attribute, given text representation.
19 -- If the attribute is a NUMBER or DATE type, then translate the
20 -- text-string value to a number/date using attribute format.
21 -- For all other types, store the value directly.
22 -- IN:
23 -- nid - Notification id
24 -- aname - Attribute Name
25 -- avalue - New value for attribute
26 --
27 procedure SetAttrText(nid in number,
28 aname in varchar2,
29 avalue in varchar2);
30
31
32 -- SetAttrNumber
33 -- Set the value of a number notification attribute.
34 -- Attribute must be a NUMBER-type attribute.
35 -- IN:
36 -- nid - Notification id
37 -- aname - Attribute Name
38 -- avalue - New value for attribute
39 --
40 procedure SetAttrNumber (nid in number,
41 aname in varchar2,
42 avalue in number);
43
44
45 -- SetAttrDate
46 -- Set the value of a date notification attribute.
47 -- Attribute must be a DATE-type attribute.
48 -- IN:
49 -- nid - Notification id
50 -- aname - Attribute Name
51 -- avalue - New value for attribute
52 --
53 procedure SetAttrDate (nid in number,
54 aname in varchar2,
55 avalue in date);
56
57
58 -- GetAttrInfo
59 -- Get type information about a notification attribute.
60 -- IN:
61 -- nid - Notification id
62 -- aname - Attribute name
63 -- OUT:
64 -- atype - Attribute type
65 -- subtype - 'SEND' or 'RESPOND',
66 -- format - Attribute format
67 --
68 procedure GetAttrInfo(nid in number,
69 aname in varchar2,
70 atype out nocopy varchar2,
71 subtype out nocopy varchar2,
72 format out nocopy varchar2);
73
74
75 -- GetAttrText
76 -- Get the value of a text notification attribute.
77 -- If the attribute is a NUMBER or DATE type, then translate the
78 -- number/date value to a text-string representation using attrbute format.
79 -- For all other types, get the value directly.
80 -- IN:
81 -- nid - Notification id
82 -- aname - Attribute Name
83 -- RETURNS:
84 -- Attribute value
85
86 function GetAttrText (nid in number,
87 aname in varchar2)
88 return varchar2;
89
90
91 -- GetAttrNumber
92 -- Get the value of a number notification attribute.
93 -- Attribute must be a NUMBER-type attribute.
94 -- IN:
95 -- nid - Notification id
96 -- aname - Attribute Name
97 -- RETURNS:
98 -- Attribute value
99
100 function GetAttrNumber (nid in number,
101 aname in varchar2)
102 return number;
103
104
105 -- GetAttrDate
106 -- Get the value of a date notification attribute.
107 -- Attribute must be a DATE-type attribute.
108 -- IN:
109 -- nid - Notification id
110 -- aname - Attribute Name
111 -- RETURNS:
112 -- Attribute value
113
114 function GetAttrDate (nid in number,
115 aname in varchar2)
116 return date;
117
118 --
119 -- GetAttrDoc
120 -- Get the displayed value of a DOCUMENT-type attribute.
121 -- Returns referenced document in format requested.
122 -- Use GetAttrText to get retrieve the actual attr value (i.e. the
123 -- document key string instead of the actual document).
124 -- NOTE:
125 -- Only PLSQL document type is implemented.
126 -- IN:
127 -- nid - Notification id
128 -- aname - Attribute Name
129 -- disptype - Requested display type. Valid values:
130 -- 'text/plain' - plain text
131 -- 'text/html' - html
132 -- '' - attachment(?)
133 -- RETURNS:
134 -- Referenced document in format requested.
135 --
136 function GetAttrDoc(
137 nid in number,
138 aname in varchar2,
139 disptype in varchar2)
140 return varchar2;
141
142
143 --
144 -- GetText
145 -- Substitute tokens in an arbitrary text string.
146 -- This function may return up to 32K chars. It can NOT be used in a view
147 -- definition or in a Form. For views and forms, use GetShortText, which
148 -- truncates values at 2000 chars.
149 -- IN:
150 -- some_text - Text to be substituted
151 -- nid - Notification id of notification to use for token values
152 -- disptype - Display type ('text/plain', 'text/html', '')
153 -- RETURNS:
154 -- Some_text with tokens substituted.
155 -- NOTE:
156 -- If errors are detected this routine returns some_text untouched
157 -- instead of raising exceptions.
158 --
159 function GetText(some_text in varchar2,
160 nid in number,
161 disptype in varchar2 default '')
162 return varchar2;
163
164 --
165 -- GetUrlText
166 -- Substitute url-style tokens (with dashes) an arbitrary text string.
167 -- This function may return up to 32K chars. It can NOT be used in a view
168 -- definition or in a Form. For views and forms, use GetShortText, which
169 -- truncates values at 2000 chars.
170 -- IN:
171 -- some_text - Text to be substituted
172 -- nid - Notification id of notification to use for token values
173 -- RETURNS:
174 -- Some_text with tokens substituted.
175 -- NOTE:
176 -- If errors are detected this routine returns some_text untouched
177 -- instead of raising exceptions.
178 --
179 function GetUrlText(some_text in varchar2,
180 nid in number)
181 return varchar2;
182
183 --
184 -- GetShortText
185 -- Substitute tokens in an arbitrary text string, limited to 2000 chars.
186 -- This function is meant to be used in view definitions and Forms, where
187 -- the field size must be limited to 2000 chars. Use GetText() to retrieve
188 -- up to 32K if the text may be longer.
189 -- IN:
190 -- some_text - Text to be substituted
191 -- nid - Notification id of notification to use for token values
192 -- RETURNS:
193 -- Some_text with tokens substituted.
194 -- NOTE:
195 -- If errors are detected this routine returns some_text untouched
196 -- instead of raising exceptions.
197 --
198 function GetShortText(some_text in varchar2,
199 nid in number)
200 return varchar2;
201
202 --
203 -- GetSubject
204 -- Get subject of notification message with token values substituted
205 -- from notification attributes.
206 -- IN:
207 -- nid - Notification Id
208 -- RETURNS:
209 -- Substituted message subject
210 -- NOTE:
211 -- If errors are detected this routine returns the subject unsubstituted,
212 -- or null if all else fails, instead of raising exceptions. It must do
213 -- this so the routine can be pragma'd and used in the
214 -- wf_notifications_view view.
215 --
216 function GetSubject(
217 nid in number)
218 return varchar2;
219
220 --
221 -- GetBody
222 -- Get body of notification message with token values substituted
223 -- from notification attributes.
224 -- This function may return up to 32K chars. It can NOT be used in a view
225 -- definition or in a Form. For views and forms, use GetShortBody, which
226 -- truncates values at 2000 chars.
227 -- IN:
228 -- nid - Notification Id
229 -- disptype - Display type ('text/plain', 'text/html', '')
230 -- RETURNS:
231 -- Substituted message body
232 -- NOTE:
233 -- If errors are detected this routine returns the body unsubstituted,
234 -- or null if all else fails, instead of raising exceptions.
235 --
236 function GetBody(
237 nid in number,
238 disptype in varchar2 default '')
239 return varchar2;
240
241 --
242 -- GetShortBody
243 -- Get body of notification message with token values substituted
244 -- from notification attributes.
245 -- This function is meant to be used in view definitions and Forms, where
246 -- the field size must be limited to 2000 chars. Use GetBody() to retrieve
247 -- up to 32K if the text may be longer.
248 -- IN:
249 -- nid - Notification Id
250 -- RETURNS:
251 -- Substituted message body
252 -- NOTE:
253 -- If errors are detected this routine returns the body unsubstituted,
254 -- or null if all else fails, instead of raising exceptions. It must do
255 -- this so the routine can be pragma'd and used in the
256 -- wf_notifications_view view.
257 --
258 function GetShortBody(nid in number)
259 return varchar2;
260
261 --
262 -- GetInfo
263 -- Return info about notification
264 -- IN
265 -- nid - Notification Id
266 -- OUT
267 -- role - Role notification is sent to
268 -- message_type - Type flag of message
269 -- message_name - Message name
270 -- priority - Notification priority
271 -- due_date - Due date
272 -- status - Notification status (OPEN, CLOSED, CANCELED)
273 --
274 procedure GetInfo(nid in number,
275 role out nocopy varchar2,
276 message_type out nocopy varchar2,
277 message_name out nocopy varchar2,
278 priority out nocopy varchar2,
279 due_date out nocopy varchar2,
280 status out nocopy varchar2);
281
282 --
283 -- Responder
284 -- Return responder of closed notification.
285 -- IN
286 -- nid - Notification Id
290 --
287 -- RETURNS
288 -- Responder to notification. If no responder was set or notification
289 -- not yet closed, return null.
291 function Responder(
292 nid in number)
293 return varchar2;
294
295 -- AccessCheck
296 -- Check that the notification is open and access key is valid.
297 -- IN
298 -- Access string <nid>/<nkey>
299 -- RETURNS
300 -- user name (if notificaiton is open and key is valid)
301 -- othersise null
302 function AccessCheck(access_str in varchar2) return varchar2;
303
304 --
305 -- Send
306 -- Send the role the specified message.
307 -- Insert a single notification in the notifications table, and set
308 -- the default send and respond attributes for the notification.
309 -- IN:
310 -- role - Role to send notification to
311 -- msg_type - Message type
312 -- msg_name - Message name
313 -- due_date - Date due
314 -- callback - Callback function
315 -- context - Data for callback
316 -- send_comment - Comment to add to notification
317 -- priority - Notification priority
318 -- RETURNS:
319 -- Notification Id
320 --
321 function Send(role in varchar2,
322 msg_type in varchar2,
323 msg_name in varchar2,
324 due_date in date default null,
325 callback in varchar2 default null,
326 context in varchar2 default null,
327 send_comment in varchar2 default null,
328 priority in number default null)
329 return number;
330
331 --
332 -- SendGroup
333 -- Send the role users the specified message.
334 -- Send a separate notification to every user assigned to the role.
335 -- IN:
336 -- role - Role of users to send notification to
337 -- msg_type - Message type
338 -- msg_name - Message name
339 -- due_date - Date due
340 -- callback - Callback function
341 -- context - Data for callback
342 -- send_comment - Comment to add to notification
343 -- priority - Notification priority
344 -- RETURNS:
345 -- Group ID - Id of notification group
346 --
347 function SendGroup(role in varchar2,
348 msg_type in varchar2,
349 msg_name in varchar2,
350 due_date in date default null,
351 callback in varchar2 default null,
352 context in varchar2 default null,
353 send_comment in varchar2 default null,
354 priority in number default null)
355 return number;
356
357 --
358 -- Forward
359 -- Forward a notification, identified by NID to another user. Validate
360 -- the user and Return error messages ...
361 -- IN:
362 -- nid - Notification Id
363 -- new_role - Role to forward notification to
364 -- forward_comment - comment to append to notification
365 -- user - role who perform this action if provided
366 -- cnt - count for recursive purpose
367 --
368 procedure Forward(nid in number,
369 new_role in varchar2,
370 forward_comment in varchar2 default null,
371 user in varchar2 default null,
372 cnt in number default 0);
373
374 --
375 -- Transfer
376 -- Transfer a notification, identified by NID to another user. Validate
377 -- the user and Return error messages ...
378 -- IN:
379 -- nid - Notification Id
380 -- new_role - Role to transfer notification to
381 -- forward_comment - comment to append to notification
382 -- user - role who perform this action if provided
383 -- cnt - count for recursive purpose
384 --
385 procedure Transfer(nid in number,
389 cnt in number default 0);
386 new_role in varchar2,
387 forward_comment in varchar2 default null,
388 user in varchar2 default null,
390
391 --
392 -- Cancel
393 -- Cancel a single notification.
394 -- IN:
395 -- nid - Notification Id
396 -- cancel_comment - Comment to append to notification
397 --
398 procedure Cancel(nid in number,
399 cancel_comment in varchar2 default null);
400
401 --
402 -- CancelGroup
403 -- Cancel all notifications belonging to a notification group
404 -- IN:
405 -- gid - Notification group id
406 -- cancel_comment - Comment to append to all notifications
407 --
408 procedure CancelGroup(gid in number,
409 cancel_comment in varchar2 default null);
410
411 --
412 -- Respond
413 -- Respond to a notification.
414 -- IN:
415 -- nid - Notification Id
416 -- respond_comment - Comment to append to notification
417 -- responder - User or role responding to notification
418 --
419 procedure Respond(nid in number,
420 respond_comment in varchar2 default null,
421 responder in varchar2 default null);
422
423 --
424 -- TestContext
425 -- Test if current context is correct
426 -- IN
427 -- nid - Notification id
428 -- RETURNS
429 -- TRUE if context ok, or context check not implemented
430 -- FALSE if context check fails
431 --
432 function TestContext(
433 nid in number)
434 return boolean;
435
436 --
437 --
438 -- VoteCount
439 -- Count the number of responses for a result_code
440 -- IN:
441 -- Gid - Notification group id
442 -- ResultCode - Result code to be tallied
443 -- OUT:
444 -- ResultCount - Number of responses for ResultCode
445 -- PercentOfTotalPop - % ResultCode ( As a % of total population )
446 -- PercentOfVotes - % ResultCode ( As a % of votes cast )
447 --
448 procedure VoteCount ( Gid in number,
449 ResultCode in varchar2,
450 ResultCount out nocopy number,
451 PercentOfTotalPop out nocopy number,
452 PercentOfVotes out nocopy number );
453 --
454 -- OpenNotifications
455 -- Determine if any Notifications in the Group are OPEN
456 --
457 --IN:
458 -- Gid - Notification group id
459 --
460 --Returns:
461 -- TRUE - if the Group contains open notifications
462 -- FALSE - if the group does NOT contain open notifications
463 --
464 function OpenNotificationsExist( Gid in Number ) return Boolean;
465
466 --
467 -- WorkCount
468 -- Count number of open notifications for user
469 -- IN:
470 -- username - user to check
471 -- RETURNS:
472 -- Number of open notifications for that user
473 --
474 function WorkCount(
475 username in varchar2)
476 return number;
477
478 --
479 -- Close
480 -- Close a notification.
481 -- IN:
482 -- nid - Notification Id
483 -- resp - Respond Required? 0 - No, 1 - Yes
484 -- responder - User or role close this notification
485 --
486 procedure Close(nid in number,
487 responder in varchar2 default null);
488
489 -- GetSubSubjectDisplay
490 -- Get the design subject of a notification and Substitute tokens in text
491 -- with the display name of the attributes in the subject.
492 -- This is used in routing rule poplists
493 -- IN:
494 -- message_type - Item type of the message
495 -- message_name - Name of the message to substitute
496 --
497 function GetSubSubjectDisplay(message_type IN VARCHAR2, message_name IN VARCHAR2)
498 return varchar2;
499
500 -- GetSubSubjectDisplayShort
501 -- Get the design subject of a notification and Substitute tokens in text
502 -- with ellipsis (...)
503 -- This is used in routing rule poplists on the Web screens
504 -- IN:
505 -- message_type - Item type of the message
506 -- message_name - Name of the message to substitute
507 --
508 function GetSubSubjectDisplayShort(message_type IN VARCHAR2, message_name IN VARCHAR2)
509 return varchar2;
510
511 -- PLSQL-Clob Processing
512
513 --Name : GetFullBody (PUBLIC)
514 --Desc : Gets full body of message with all PLSQLCLOB variables transalted.
515 -- and returns the message in 32K chunks in the msgbody out variable.
516 -- Call this repeatedly until end_of_body is true.
517 -- Call syntax is
518 --while not (end_of_msgbody) loop
519 -- wf_notification.getfullbody(nid,msgbody,end_of_msgbody);
520 --end loop;
521 procedure GetFullBody (nid in number,
522 msgbody out nocopy varchar2,
523 end_of_body in out nocopy boolean,
524 disptype in varchar2 default 'text/plain');
525
526 --Name: GetFullBodyWrapper (PUBLIC)
527 --Desc : Gets full body of message with all PLSQLCLOB variables transalted.
528 -- and returns the message in 32K chunks in the msgbody out variable.
529 -- Call this repeatedly until end_of_body is "Y". Uses string arg
530 -- instead of boolean like GetFullBody for end_of_msg_body. Created
531 -- since booleans cannot be passed via JDBC.
532 -- Call syntax is
533 --while (end_of_msgbody <> "Y") loop
534 -- wf_notification.getfullbody(nid,msgbody,end_of_msgbody);
535 --end loop;
536 procedure GetFullBodyWrapper (nid in number,
537 msgbody out nocopy varchar2,
538 end_of_body out nocopy varchar2,
539 disptype in varchar2 default 'text/plain');
540
541
542
543
544
545 END FND_WF_Notification;
546