DBA Data[Home] [Help]

PACKAGE: APPS.WF_EVENT

Source


1 package WF_EVENT as
2 /* $Header: WFEVENTS.pls 120.3 2008/04/23 20:59:46 vshanmug ship $ */
3 /*#
4  * Provides APIs to communicate with the Business Event System and manage
5  * events.
6  * @rep:scope public
7  * @rep:product OWF
8  * @rep:displayname Workflow Business Event System
9  * @rep:lifecycle active
10  * @rep:compatibility S
11  * @rep:category BUSINESS_ENTITY WF_EVENT
12  * @rep:ihelp FND/@evtapis See the related online help
13  */
14 ------------------------------------------------------------------------------
15 navigation  binary_integer := dbms_aq.first_message;
16 ------------------------------------------------------------------------------
17 /*
18 ** exception source indicator - used by dispatch and listen (NONE | WF | RULE)
19 */
20 WF_EXCEPTION_SOURCE varchar2(10) := 'NONE';
21 ------------------------------------------------------------------------------
22 /*
23 ** **** PRIVATE VARIABLE - NOT FOR CUSTOMER USE ******
24 ** phase maxthreshold - used by dispatch to determine which subscriptions to
25 **		     execute, only those with a phase < phase threshold
26 ** **** PRIVATE VARIABLE - NOT FOR CUSTOMER USE ******
27 */
28 PHASE_MAXTHRESHOLD number := 100;
29 ------------------------------------------------------------------------------
30 /*
31 ** **** PRIVATE VARIABLE - NOT FOR CUSTOMER USE ******
32 ** phase minstart   - used by dispatch to determine which subscriptions to
33 **		   execute, only those with a phase >= phase threshold
34 ** **** PRIVATE VARIABLE - NOT FOR CUSTOMER USE ******
35 */
36 PHASE_MINTHRESHOLD number := 0;
37 ------------------------------------------------------------------------------
38 /*
39 ** **** PRIVATE VARIABLE - NOT FOR CUSTOMER USE ******
40 ** account name  - current schema
41 **
42 ** **** PRIVATE VARIABLE - NOT FOR CUSTOMER USE ******
43 */
44 ACCOUNT_NAME  varchar2(320);
45 ------------------------------------------------------------------------------
46 /*
47 ** **** PRIVATE VARIABLE - NOT FOR CUSTOMER USE ******
48 ** local_system_guid - the value of local system guid
49 ** local_system_status - status of the local system
50 ** local_system_name - status of the local system
51 ** **** PRIVATE VARIABLE - NOT FOR CUSTOMER USE ******
52 */
53 local_system_guid  raw(16);
54 local_system_status varchar2(10);
55 local_system_name  varchar2(30);
56 
57 
58 schema_name         varchar2(30);
59 
60 ------------------------------------------------------------------------------
61 /*
62 ** **** PRIVATE VARIABLE - NOT FOR CUSTOMER USE ******
63 ** evt_param_index - pl/sql table to hold hash values of event parameters.
64 ** **** PRIVATE VARIABLE - NOT FOR CUSTOMER USE ******
65 */
66 
67 TYPE Event_Param_INDEX is table of varchar2(4000) index by binary_integer;
68 evt_param_index Event_Param_INDEX;
69 
70 /*
71 ** **** PRIVATE VARIABLE - NOT FOR CUSTOMER USE ******
72 ** sub_param_index - pl/sql table to hold hash values of subscription parameters.
73 ** **** PRIVATE VARIABLE - NOT FOR CUSTOMER USE ******
74 */
75 
76 TYPE Subscription_Param_INDEX is table of varchar2(4000) index by binary_integer;
77 sub_param_index Subscription_Param_INDEX;
78 
79 ------------------------------------------------------------------------------
80 /*
81 ** **** PRIVATE VARIABLE - NOT FOR CUSTOMER USE ******
82 ** g_correlation     - Current correlation id.
83 ** g_queueType       - Current Queue Type.
84 ** g_deq_condition   - Dequeue Condition (9i feature)
85 ** g_dispatch_result - Result returned from dispatch_internal
86 ** **** PRIVATE VARIABLE - NOT FOR CUSTOMER USE ******
87 */
88 
89 /*
90 ** **** PUBLIC VARIABLE ******
91 ** Max nested raise gives the number of recursive raises
92 ** possible.
93 **
94 */
95 NESTED_RAISE_COUNT number  := 0;
96 MAX_NESTED_RAISES  number  := 100;
97 
98 g_correlation      varchar2(240);
99 g_queueType        varchar2(20);
100 g_deq_condition    varchar2(4000);
101 g_message_grouping varchar2(30);
102 g_msgid            raw(16); --<rwunderl:2699059>
103 g_local_system_guid raw(16); --<rwunderl:2792298>
104 
105 /*#
106  * Internally dispatch an event to one of the event's
107  * subscription.
108  * @param p_source_type The source of the evnet
109  * @param p_rule_data   indicator if the event data should be generated
110  * @param p_rule_func   the rule function of this subscription
111  * @param p_sub_guid    GUID of this subscription
112  * @param p_source_agent_guid the agent where event comes
113  * @param p_phase       the phase of this subscription
114  * @param p_priority    priority of this sub
115  * @param p_event       Event to be dispatched.
116  * @return The status of the subscription execution
117  * @rep:scope public
118  * @rep:lifecycle active
119  * @rep:displayname Test Event
120  * @rep:compatibility S
121  * @rep:ihelp FND/@evtapis#a_evtest See the related online help
122  */
123 FUNCTION dispatch_internal(p_source_type        in      varchar2,
124                            p_rule_data          in      varchar2,
125                            p_rule_func          in      varchar2,
126                            p_sub_guid           in      raw,
127                            p_source_agent_guid  in      raw,
128                            p_phase              in      number,
129                            p_priority           in      number,
130                            p_event              in out nocopy wf_event_t,
131                            p_on_error           in      varchar2)
132 return varchar2;
133 ------------------------------------------------------------------------------
134 /*
135 ** test - Verifies the specified event is enabled.  Then, tests if there
136 **        is an enabled LOCAL subscription for this event, or an enabled
137 **        subscription for an enabled group that contains this event.
138 **
139 **        Returns the most costly data requirement for active subscriptions
140 **        on the event:
141 **          NONE     no subscription or no event           (best)
142 **          KEY      subscription requiring event key only
143 **          MESSAGE  subscription requiring event message  (worst)
144 */
145 /*#
146  * Tests whether the specified event is enabled and whether there are any
147  * enabled subscriptions by the local system referencing the event, or
148  * referencing an enabled event group that contains the event. Returns
149  * NONE if no enabled local subscriptions reference the event, or the
150  * event does not exist. Returns KEY if at least one enabled local
151  * subscription references the event, but all such subscriptions require
152  * only the event key. Returns MESSAGE if at least one enabled local
153  * subscription to the event requires the complete event data.
154  * @param p_event_name Event Name
155  * @return Most Costly Data Requirement among Subscriptions
156  * @rep:scope public
157  * @rep:lifecycle active
158  * @rep:displayname Test Event
159  * @rep:compatibility S
160  * @rep:ihelp FND/@evtapis#a_evtest See the related online help
161  */
162 FUNCTION test(p_event_name in varchar2) return varchar2;
163 ------------------------------------------------------------------------------
164 /*
165 ** send - send event message to agent
166 **
167 **    The event's FROM_AGENT specifies an output agent/queue upon which
168 **    the message should be placed.  The event's TO_AGENT_LIST specifies
169 **    the message recipients for propagation.
170 **
171 **    The message will be asynchronously delivered to the
172 **    TO_AGENT by AQ propagation.  If the FROM_AGENT is not specified,
173 **    the system will automatically enqueue the message to an output agent
174 **    that matches the recipient's queue type.
175 */
176 /*#
177  * Sends an event message from one agent to another. If the event message
178  * contains both a From Agent and a To Agent, the message is placed on
179  * the outbound queue of the From Agent and then asynchronously delivered
180  * to the To Agent by AQ propagation, or whichever type of propagation is
181  * implemented for the agents' protocol. If the event message contains a
182  * To Agent but no specified From Agent, the message is sent from the
183  * default outbound agent that matches the queue type of the To Agent. If
184  * the event message contains a From Agent but no specified To Agent, the
185  * event message is placed on the From Agent's queue without a specified
186  * recipient.
187  * @param p_event Event Message to Send
188  * @rep:scope public
189  * @rep:lifecycle active
190  * @rep:displayname Send Event
191  * @rep:compatibility S
192  * @rep:ihelp FND/@evtapis#a_evsend See the related online help
193  */
194 PROCEDURE send(p_event in out nocopy wf_event_t);
195 ------------------------------------------------------------------------------
196 /*#
197  * Sets the Recipient_List when an event is sent from one agent to another
198  * This method handles both Agent and Agent Group.
199  * @param p_event Event to be sent
200  * @param p_out_agent_name Source Agent Name
201  * @param p_out_system_name Source System Name
202  * @param x_message_properties the enqueue options with recipient list generated
203  * @rep:scope public
204  * @rep:lifecycle active
205  * @rep:displayname Send Event
206  * @rep:compatibility S
207  * @rep:ihelp FND/@evtapis#a_evsend See the related online help
208  */
209 PROCEDURE Set_Recipient_List(p_event               in wf_event_t,
210                              p_out_agent_name     in varchar2,
211                              p_out_system_name    in varchar2,
212                              x_message_properties in out nocopy dbms_aq.message_properties_t);
213 /*
214 ** newAgent - Construct a wf_agent_t from a guid
215 */
216 /*#
217  * Creates a WF_AGENT_T structure for the specified agent and sets the agent's
218  * system and name into the structure.
219  * @param p_agent_guid Agent GUID
220  * @return WF_AGENT_T structure containing Agent Information
221  * @rep:scope public
222  * @rep:lifecycle active
223  * @rep:displayname New Agent
224  * @rep:compatibility S
225  * @rep:ihelp FND/@evtapis#a_evnewagt See the related online help
226  */
227 FUNCTION newAgent(p_agent_guid in raw) return wf_agent_t;
228 ------------------------------------------------------------------------------
229 /*
230 ** dispatch - (internal) run event dispatcher for an event
231 **
232 **        Main subscription execution loop.  Finds all matching
233 **        subscriptions and executes their rules.
234 **
235 **        P_SOURCE_TYPE is one of 'LOCAL', 'EXTERNAL', or 'ERROR',
236 **        indicating the general class of the event.  This will be
237 **        matched against the corresonding column in the
238 **        subscriptions table when selecting subscriptions.
239 **
240 **        P_SOURCE_AGENT_GUID is NULL if local, otherwise is set to the
241 **        GUID of the agent that sent the event.
242 **
243 **        All matching subscriptions are then queried and executed.
244 **        Subscription execution is ordered by the PHASE attribute of the
245 **        subscriptions table.  Subscription execution involves
246 */
247 /*#
248  * Creates a WF_AGENT_T structure for the specified agent and sets the agent's
249  * system and name into the structure.
250  * @param p_source_type       LOCAL, EXTERNAL or ERROR
251  * @param p_source_agent_guid where the event comes
252  * @param p_event             event to be dispatched
253  * @rep:scope public
254  * @rep:lifecycle active
255  * @rep:displayname New Agent
256  * @rep:compatibility S
257  * @rep:ihelp FND/@evtapis#a_evnewagt See the related online help
258  */
259 PROCEDURE dispatch(p_source_type        in     varchar2,
260                    p_source_agent_guid  in     raw,
261                    p_event              in out nocopy wf_event_t);
262 ------------------------------------------------------------------------------
263 /*
264 ** raise - raise a local event to the event manager
265 **        -- Below Moved to Dispatcher --
266 **        Calls TEST to determine whether a MESSAGE type subscription
267 **        exists.  If a MESSAGE is required, and none is specified by
268 **        the caller, we generate one using the GENERATE_FUNCTION
269 **        identified for the event in the WF_EVENTS table.  If no
270 **        GENERATE_FUNCTION is found, we create a default message using
271 **        the event name and event key data.
272 **        -- Above moved to Dispatcher --
273 **
274 **        Event is passed to the dispatcher.
275 **
276 **        Note: If the event is not defined, no error will be raised.
277 */
278 /*#
279  * Raises a local event to the Event Manager. Creates a WF_EVENT_T structure
280  * for this event instance and sets the specified event name, event key,
281  * event data, parameter list, and send date into the structure. The event data
282  * can be passed to the Event Manager within the call to the Raise() API, or
283  * the Event Manager can obtain the event data itself by calling the Generate
284  * function for the event, after first checking whether the event data is
285  * required by a subscription.
286  * @param p_event_name Event Name
287  * @param p_event_key Event Key
288  * @param p_event_data Event Message
289  * @param p_parameters Parameter List
290  * @param p_send_date Send Date for a Deferred Event
291  * @rep:scope public
292  * @rep:lifecycle active
293  * @rep:displayname Raise Local Event
294  * @rep:compatibility S
295  * @rep:ihelp FND/@evtapis#a_evraise See the related online help
296  */
297 PROCEDURE raise(p_event_name in varchar2,
298                 p_event_key  in varchar2,
299                 p_event_data in clob default NULL,
300                 p_parameters in wf_parameter_list_t default NULL,
301                 p_send_date  in date default NULL);
302 ------------------------------------------------------------------------------
303 /*
304 ** listen -  dequeues and dispatches all events currently enqueued
305 **           for this agent.
306 **
307 **        Uses the appropriate QUEUE_HANDLER interface package to
308 **        dequeue events into the WF_EVENT_T type structure.  Then
309 **        calls DISPATCH with the appropriate source type
310 **        (usually 'EXTERNAL' but 'ERROR' if agent name is 'WF_ERROR')
311 **
312 **        Exits after all the events have been dequeued.
313 **
314 **        The WF_SETUP package schedules LISTEN procedures for all active
318  * Monitors an agent for inbound event messages and dequeues messages
315 **        inbound agents.
316 */
317 /*#
319  * using the agent's queue handler. The standard WF_EVENT_QH queue handler
320  * sets the date and time when an event message is dequeued into the
321  * RECEIVE_DATE attribute of the event message. Custom queue handlers can
322  * also set the RECEIVE_DATE value if this functionality is included in the
323  * Dequeue API. When an event is dequeued, the Event Manager searches for and
324  * executes any active subscriptions by the local system to that event with
325  * a source type of External, and also any active subscriptions by the local
326  * system to the Any event with a source type of External. If no active
327  * subscriptions exist for the event that was received (apart from
328  * subscriptions to the Any event), then Oracle Workflow executes any active
329  * subscriptions by the local system to the Unexpected event with a source type
330  * of External.
331  * @param p_agent_name Agent Name
332  * @param p_wait Wait period in seconds
333  * @param p_correlation Correlation ID
334  * @param p_deq_condition Dequeue Condition
335  * @rep:scope public
336  * @rep:lifecycle active
337  * @rep:displayname Listen to Agent
338  * @rep:compatibility S
339  * @rep:ihelp FND/@evtapis#a_evlis See the related online help
340  */
341 PROCEDURE listen(p_agent_name  in varchar2,
342                  p_wait        in binary_integer default dbms_aq.no_wait,
343                  p_correlation in varchar2       default null,
344                  p_deq_condition in varchar2     default null);
345 ---------------------------------------------------------------------------
346 /*
347 ** listen - New API to implement GSC-alike Logic
348 **
349 ** Two more parameters are added: p_message_count and p_max_error_count
350 */
351 /*#
352  * New Listen API with Two more parameters are added: p_message_count and p_max_error_count
353  * to limit how many messages listener is going to process.
354  * @param p_agent_name Agent Name
355  * @param p_wait Wait period in seconds
356  * @param p_correlation Correlation ID
357  * @param p_deq_condition Dequeue condition as in SQL WHERE clause
358  * @param p_message_count maximum count of messages to be processed
359  * @param p_max_error_count maximum number of errors tolerated.
360  * @rep:scope public
361  * @rep:lifecycle active
362  * @rep:displayname Listen to Agent
363  * @rep:compatibility S
364  * @rep:ihelp FND/@evtapis#a_evlis See the related online help
365  */
366 PROCEDURE listen(p_agent_name  in varchar2,
367                  p_wait        in binary_integer default dbms_aq.no_wait,
368                  p_correlation in varchar2       default null,
369                  p_deq_condition in varchar2     default null,
370                  p_message_count in out nocopy number,
371                  p_max_error_count in out nocopy number);
372 ---------------------------------------------------------------------------
373 /*
374 ** listen_concurrent - This is a cover of listen() that can be used
375 **                     by the Concurrent Manager.
376 */
377 --Bug 2505487
378 --Included the AQ wait parameter for the listen_concurrent
379 
380 PROCEDURE listen_concurrent(errbuf        out nocopy varchar2,
381                             retcode       out nocopy varchar2,
382                             p_agent_name  in  varchar2,
383                             p_correlation in varchar2 default null,
384                             p_deq_condition in varchar2 default null,
385                             p_wait    in binary_integer default dbms_aq.no_wait
386                            );
387 ---------------------------------------------------------------------------
388 /*
389 ** listen_grp -  dequeues and dispatches all events currently enqueued
390 **               for this agent.
391 **
392 **        Supports message grouping to dequeue by transactions.
393 **        Uses the appropriate QUEUE_HANDLER interface package to
394 **        dequeue events into the WF_EVENT_T type structure.  Then
395 **        calls DISPATCH with the appropriate source type
396 **        (usually 'EXTERNAL' but 'ERROR' if agent name is 'WF_ERROR')
397 **
398 **        Exits after all the events have been dequeued.
399 **
400 **
401 */
402 PROCEDURE listen_grp(p_agent_name in varchar2,
403                      p_wait       in binary_integer default dbms_aq.no_wait);
404 ---------------------------------------------------------------------------
405 /*
406 ** listen__grp_concurrent - This is a cover of listen_grp() that can be used
407 **                          by the Concurrent Manager.
408 */
409 PROCEDURE listen_grp_concurrent(errbuf       out nocopy varchar2,
410                                 retcode      out nocopy varchar2,
411                                 p_agent_name in  varchar2);
412 
413 ---------------------------------------------------------------------------
414 
415 /*
416 ** dequeue - generic dequeue.
417 **
418 **        Determines the appropriate QUEUE_HANDLER interface package to
419 **        dequeue events into the WF_EVENT_T type structure.
420 */
421 /* @rep:scope public
422  * @rep:lifecycle active
423  * @rep:displayname Enqueue Event Message
424  * @rep:compatibility S
425  * @rep:ihelp FND/@evtapis#a_evenq See the related online help
426 */
427 PROCEDURE dequeue(p_agent_guid    in     raw,
428                   p_event         out nocopy    wf_event_t,
432                   p_deq_condition in     varchar2       default null);
429                   p_queue_handler in out nocopy varchar2,
430                   p_wait          in     binary_integer default dbms_aq.no_wait,
431                   p_correlation   in     varchar2       default null,
433 ---------------------------------------------------------------------------
434 /*
435 ** enqueue - generic enqueue.
436 **
437 **        Determines the appropriate QUEUE_HANDLER interface package to
438 **        enqueue events from the WF_EVENT_T type structure.
439 **
440 **        If the p_out_agent_override is specified, enqueues to that
441 **        agent instead of the one specified in p_event.From_agent.
442 */
443 /*#
444  * Enqueues an event message onto a queue associated with an outbound agent.
445  * You can optionally specify an override agent where you want to enqueue the
446  * event message. Otherwise, the event message is enqueued on the From Agent
447  * specified within the message. The message recipient is set to the To Agent
448  * specified in the event message. Enqueue() uses the queue handler for the
449  * outbound agent to place the message on the queue.
450  * @param p_event Event Message to Enqueue
451  * @param p_out_agent_override Outbound Agent
452  * @rep:scope public
453  * @rep:lifecycle active
454  * @rep:displayname Enqueue Event Message
455  * @rep:compatibility S
456  * @rep:ihelp FND/@evtapis#a_evenq See the related online help
457  */
458 PROCEDURE enqueue(p_event              in wf_event_t,
459                   p_out_agent_override in wf_agent_t default null);
460 ---------------------------------------------------------------------------
461 /*
462 ** setErrorInfo - retrieve the error information from the
463 **                stack and set into the wf_event_t.
464 **
465 **                p_type should be WARNING or ERROR
466 */
467 /*#
468  * Retrieves error information from the error stack and sets it into the event
469  * message. The error message and error stack are set into the corresponding
470  * attributes of the event message. The error name and error type are added to
471  * the PARAMETER_LIST attribute of the event message.
472  * @param p_event Event Message
473  * @param p_type Error Type ('ERROR' or 'WARNING')
474  * @rep:scope public
475  * @rep:lifecycle active
476  * @rep:displayname Set Error Information
477  * @rep:compatibility S
478  * @rep:ihelp FND/@evtapis#a_evseinf See the related online help
479  */
480 PROCEDURE setErrorInfo(p_event  in out nocopy wf_event_t,
481                        p_type   in     varchar2);
482 ---------------------------------------------------------------------------
483 /*
484 ** AddParameterToList - adds name and value to varray size 100
485 **			wf_parameter_list_t
486 **			if the varray is null, will initialize
487 **			otherwise just adds to end of list
488 */
489 /*#
490  * Adds the specified parameter name and value pair to the end of the specified
491  * parameter list varray. If the varray is null, AddParameterToList()
492  * initializes it with the new parameter.
493  * @param p_name Parameter Name
494  * @param p_value Parameter Value
495  * @param p_parameterlist Parameter List
496  * @rep:scope public
497  * @rep:lifecycle active
498  * @rep:displayname Add Parameter to List
499  * @rep:compatibility S
500  * @rep:ihelp FND/@evtapis#a_evaptl See the related online help
501  */
502 PROCEDURE AddParameterToList(p_name  in varchar2,
503                              p_value in varchar2,
504                              p_parameterlist in out nocopy wf_parameter_list_t);
508 **			   wf_parameter_list_t
505 ---------------------------------------------------------------------------
506 /*
507 ** AddParameterToListPos - adds name and value to varray size 100
509 **			   if the varray is null, will initialize
510 **                         After the value is set,
511 **                         the index will be set into the position.
512 */
513 /*#
514  * Adds the specified parameter name and value pair to the end of the specified
515  * parameter list varray. If the varray is null, AddParameterToListPos()
516  * initializes it with the new parameter. The procedure also returns the
517  * index for the position at which the parameter is stored within the varray.
518  * @param p_name Parameter Name
519  * @param p_value Parameter Value
520  * @param p_position Position at which Parameter is Added
521  * @param p_parameterlist Parameter List
522  * @rep:scope public
523  * @rep:lifecycle active
524  * @rep:displayname Add Parameter to List and Return Position
525  * @rep:compatibility S
526  * @rep:ihelp FND/@evtapis#a_evaptlp See the related online help
527  */
528 PROCEDURE AddParameterToListPos(p_name  in varchar2,
529                              p_value in varchar2,
530                              p_position out nocopy integer,
531                              p_parameterlist in out nocopy wf_parameter_list_t);
532 ---------------------------------------------------------------------------
533 /*
534 ** GetValueForParameter - Gets value for name from wf_parameter_list_t
535 */
536 /*#
537  * Retrieves the value of the specified parameter from the specified parameter
538  * list varray. GetValueForParameter() begins at the end of the parameter list
539  * and searches backwards through the list.
540  * @param p_name Parameter Name
541  * @param p_parameterlist Parameter List
542  * @return Parameter Value
543  * @rep:scope public
544  * @rep:lifecycle active
545  * @rep:displayname Get Value for Parameter
546  * @rep:compatibility S
547  * @rep:ihelp FND/@evtapis#a_evgvfp See the related online help
548  */
549 FUNCTION getValueForParameter(p_name in varchar2,
550 			      p_parameterlist in wf_parameter_list_t)
551 return varchar2;
552 ---------------------------------------------------------------------------
553 /*
554 ** GetValueForParameterPos - Gets value for position from wf_parameter_list_t
555 */
556 /*#
557  * Retrieves the value of the parameter stored at the specified position in
558  * the specified parameter list varray.
559  * @param p_position Parameter Position in the List
560  * @param p_parameterlist Parameter List
561  * @return Parameter Value
562  * @rep:scope public
563  * @rep:lifecycle active
564  * @rep:displayname Get Value for Parameter in a Position
565  * @rep:compatibility S
566  * @rep:ihelp FND/@evtapis#a_evgvfpp See the related online help
567  */
568 FUNCTION getValueForParameterPos(p_position in integer,
569 			      p_parameterlist in wf_parameter_list_t)
570 return varchar2;
571 ---------------------------------------------------------------------------
572 /*
573 ** SetDispatchMode
574 **        - Sets Phase Max Threshold to -1 or 100
575 */
576 /*#
577  * Sets the dispatch mode of the Event Manager to either deferred or
578  * synchronous subscription processing. Call SetDispatchMode() with the
579  * mode 'ASYNC' just before calling Raise() to defer all subscription
580  * processing forever for the event that you will raise. In this case, the
581  * Event Manager places the event on the WF_DEFERRED queue before
582  * executing any subscriptions for that event. The subscriptions are not
583  * executed until the agent listener runs to dequeue the event from the
587  * the subscription is executed immediately or deferred.
584  * WF_DEFERRED queue. You can call SetDispatchMode() with the mode 'SYNC' to
585  * set the dispatch mode back to normal synchronous subscription processing.
586  * In this mode, the phase number for each subscription determines whether
588  * @param p_mode Dispatch Mode
589  * @rep:scope public
590  * @rep:lifecycle active
591  * @rep:displayname Set Dispatch Mode
592  * @rep:compatibility S
593  * @rep:ihelp FND/@evtapis#a_evsdmode See the related online help
594  */
595 PROCEDURE SetDispatchMode(p_mode in varchar2);
596 ---------------------------------------------------------------------------
597 /*
598 ** InitPhaseMinThreshold
599 **        - Sets Phase Min Threshold to 0
600 */
601 PROCEDURE InitPhaseMinThreshold;
602 ---------------------------------------------------------------------------
603 /*
604 ** DeferEvent  - Saves Event to Deferred Queue
605 */
606 PROCEDURE DeferEvent(p_source_type        in     varchar2,
607                      p_event              in out nocopy wf_event_t);
608 ---------------------------------------------------------------------------
609 /*
610 ** DeferEventToJava  - Saves Event to WF_JAVA_DEFERRED Queue
611 */
612 PROCEDURE DeferEventToJava(p_source_type        in     varchar2,
613                            p_event              in out nocopy wf_event_t);
614 ---------------------------------------------------------------------------
615 /*
616 ** GetDeferEventCtx - Determines the Source Type and Start Phase
617 **                    of deferred events
618 */
619 PROCEDURE GetDeferEventCtx (p_source_type        in out nocopy     varchar2,
620                          p_agent_name         in         varchar2,
621                          p_system_name        in         varchar2,
622                          p_event              in   wf_event_t);
623 ---------------------------------------------------------------------------
624 /*
625 ** SetAccountName  - Populates Global Variable with account name
626 **                   the session is logged in under
627 */
628 PROCEDURE SetAccountName;
629 ---------------------------------------------------------------------------
630 --
631 -- Bug# 2211719 - New API raise2 for calls that do not understand
632 --                Oracle data types
633 
634 /*
635 ** Raise API for calls that donot understand Oracle types
636 */
637 
638 PROCEDURE raise2(p_event_name      in varchar2,
639                 p_event_key        in varchar2,
640                 p_event_data       in clob default NULL,
641                 p_parameter_name1  in varchar2 default NULL,
642                 p_parameter_value1 in varchar2 default NULL,
643                 p_parameter_name2  in varchar2 default NULL,
644                 p_parameter_value2 in varchar2 default NULL,
645                 p_parameter_name3  in varchar2 default NULL,
646                 p_parameter_value3 in varchar2 default NULL,
647                 p_parameter_name4  in varchar2 default NULL,
648                 p_parameter_value4 in varchar2 default NULL,
649                 p_parameter_name5  in varchar2 default NULL,
650                 p_parameter_value5 in varchar2 default NULL,
651                 p_parameter_name6  in varchar2 default NULL,
652                 p_parameter_value6 in varchar2 default NULL,
653                 p_parameter_name7  in varchar2 default NULL,
654                 p_parameter_value7 in varchar2 default NULL,
655                 p_parameter_name8  in varchar2 default NULL,
656                 p_parameter_value8 in varchar2 default NULL,
657                 p_parameter_name9  in varchar2 default NULL,
658                 p_parameter_value9 in varchar2 default NULL,
659                 p_parameter_name10  in varchar2 default NULL,
660                 p_parameter_value10 in varchar2 default NULL,
661                 p_parameter_name11  in varchar2 default NULL,
662                 p_parameter_value11 in varchar2 default NULL,
663                 p_parameter_name12  in varchar2 default NULL,
664                 p_parameter_value12 in varchar2 default NULL,
665                 p_parameter_name13  in varchar2 default NULL,
666                 p_parameter_value13 in varchar2 default NULL,
667                 p_parameter_name14  in varchar2 default NULL,
668                 p_parameter_value14 in varchar2 default NULL,
669                 p_parameter_name15  in varchar2 default NULL,
670                 p_parameter_value15 in varchar2 default NULL,
671                 p_parameter_name16  in varchar2 default NULL,
672                 p_parameter_value16 in varchar2 default NULL,
673                 p_parameter_name17  in varchar2 default NULL,
674                 p_parameter_value17 in varchar2 default NULL,
675                 p_parameter_name18  in varchar2 default NULL,
676                 p_parameter_value18 in varchar2 default NULL,
677                 p_parameter_name19  in varchar2 default NULL,
678                 p_parameter_value19 in varchar2 default NULL,
679                 p_parameter_name20  in varchar2 default NULL,
680                 p_parameter_value20 in varchar2 default NULL,
681                 p_send_date         in date default NULL);
682 ---------------------------------------------------------------------------
683 /*
684 ** CreateParamater - Creates a wf_parameter_t type object based in the
685 **                   input name and value
686 */
687 
688 FUNCTION CreateParameter (p_name        in      varchar2,
689                           p_value       in      varchar2)
690 return wf_parameter_t;
691 
695 --returns the same to the calling program
692 --------------------------------------------------------------------------
693 --Bug2375902
694 --New API that raises an event with the parameterlist and
696 -------------------------------------------------------------------------
697 /*#
698  * Raises a local event to the Event Manager and returns the parameter list for
699  * the event. Raise3() performs the same processing as the Raise() procedure,
700  * except that Raise3() passes the event parameter list back to the calling
701  * application after completing the event subsription processing.
702  * @param p_event_name Event Name
703  * @param p_event_key Event Key
704  * @param p_event_data Event Message
705  * @param p_parameter_list Parameter List
706  * @param p_send_date Send Date for a Deferred Event
707  * @rep:scope public
708  * @rep:lifecycle active
709  * @rep:displayname Raise Local Event and Return Parameter List
710  * @rep:compatibility S
711  * @rep:ihelp FND/@evtapis#a_evrsthree See the related online help
712  */
713 PROCEDURE raise3(p_event_name      in varchar2,
714                 p_event_key        in varchar2,
715                 p_event_data       in clob default NULL,
716                 p_parameter_list   in out nocopy wf_parameter_list_t,
717                 p_send_date        in date default NULL);
718 
719 ---------------------------------------------------------------------------
720 
721 
722 --------------------------------------------------------------------------------
723 -- Sets the queue correlation (g_correlation) for dequeuing.
724 --
725 -- NOTE: This has been done because we did not want to change the signature of
726 --       dequeue in the queue handler
727 --
728 -- p_correlation - the correlation
729 --------------------------------------------------------------------------------
730 PROCEDURE Set_Correlation(p_correlation in varchar2);
731 
732 ---------------------------------------------------------------------------
733 /*
734 ** PUBLIC
735 ** SetMaxNestedRaise  - Populates Global Variable : max_nested_raises
736 **                      with the value specified in the input parameter.
737 */
738 /*#
739  * Sets the maximum number of nested raises that can be performed to the
740  * specified value. A nested raise occurs when one event is raised and a Local
741  * subscription to that event is executed and raises another event. The default
742  * maximum is 100.
743  * @param maxcount Maximum Number of Nested Raises
744  * @rep:scope public
745  * @rep:lifecycle active
746  * @rep:displayname Set Maximum Nested Raise Count
747  * @rep:compatibility S
748  * @rep:ihelp FND/@evtapis#a_evsmnr See the related online help
749  */
750 PROCEDURE SetMaxNestedRaise (maxcount  in number default 100);
751 ---------------------------------------------------------------------------
752 /*
753 ** PUBLIC
754 ** SetNestedRaiseCount  - Populates Global Variable : nested_raises_count
755 **                        with the value specified in the input parameter.
756 */
757 PROCEDURE SetNestedRaiseCount (nestedcount in number default 0);
758 ---------------------------------------------------------------------------
759 /*
760 ** PUBLIC
761 ** GetMaxNestedRaise  - Get the value of the Global Variable max_nested_raises
762 */
763 /*#
764  * Returns the maximum number of nested raises that can currently be performed.
765  * A nested raise occurs when one event is raised and a Local subscription to
766  * that event is executed and raises another event.
767  * @return Maximum Number of Nested Raises
768  * @rep:scope public
769  * @rep:lifecycle active
770  * @rep:displayname Get Maximum Nested Raise Count
771  * @rep:compatibility S
772  * @rep:ihelp FND/@evtapis#a_evgmnr See the related online help
773  */
774 FUNCTION GetMaxNestedRaise return number;
775 
776 ---------------------------------------------------------------------------
777 /*
778 ** PUBLIC
779 ** GetNestedRaiseCount  - Get the value of the Global Variable
780 **                        nested_raises_count
781 */
782 
783 FUNCTION GetNestedRaiseCount return number;
784 
785 ----------------------------------------------------------------------------
786 
787 FUNCTION Get_MsgId return varchar2;
788 
789 ----------------------------------------------------------------------------
790 /*
791 ** PUBLIC
792 ** GetLocalSystemInfo - Gets the local system name, guid and status
793 */
794 
795 PROCEDURE GetLocalSystemInfo(system_guid   out nocopy raw,
796                              system_name   out nocopy varchar2,
797                              system_status out nocopy varchar2);
798 
799 ----------------------------------------------------------------------------
800 /*
801 ** PUBLIC
802 ** GetSourceAgentGUID - Gets the agent guid based on the agent name and the
803 **                      system name
804 */
805 PROCEDURE GetSourceAgentGUID(agent_name   in         varchar2,
806                              agent_system in         varchar2,
807                              agent_guid   out nocopy raw);
808 
809 ----------------------------------------------------------------------------
810 /*
811 ** PUBLIC
812 ** StartAgent - Starts the given agent (if not already running) based on
813 ** whether it is enabled for enqueue or dequeue or both
814 */
818 /*
815 procedure StartAgent(agent_name   in    varchar2);
816 
817 ----------------------------------------------------------------------------
819 ** PUBLIC
820 ** Peek_Agent - Listens on the given queue to check for messages
821 */
822 FUNCTION Peek_Agent(p_agent_name IN VARCHAR2)
823          RETURN VARCHAR2;
824 
825 ----------------------------------------------------------------------------
826 -- GetParamListFromString
827 --   Takes a space delimited NAME=VALUE pairs of Subscription Parameters
828 --   string and returns a WF_PARAMETER_LIST_T
829 -- IN
830 --   p_parameters A string with space delimited name=value pairs
831 function GetParamListFromString(p_parameters in varchar2)
832 return wf_parameter_list_t;
833 
834 end WF_EVENT;