DBA Data[Home] [Help]

PACKAGE: APPS.WF_RULE

Source


1 package WF_RULE as
2 /* $Header: wfrules.pls 120.3 2006/04/27 03:09:47 nravindr ship $ */
3 /*#
4  * Provides standard rule functions that you can assign to event
5  * subscriptions. A rule function specifies the processing that Oracle
6  * Workflow performs when the subscription's triggering event occurs.
7  * @rep:scope public
8  * @rep:product OWF
9  * @rep:displayname Workflow Event Subscription Rule Function
10  * @rep:lifecycle active
11  * @rep:compatibility S
12  * @rep:category BUSINESS_ENTITY WF_EVENT
13  * @rep:ihelp FND/@evrulapis See the related online help
14  */
15 --------------------------------------------------------------------------
16 /*
17 ** log - logs the contents of the specified event.  Returns SUCCESS.
18 */
19 /*#
20  * Logs the contents of the specified event message using
21  * DBMS_OUTPUT.put_line and returns the status code SUCCESS. Use this
22  * function to output the contents of an event message to a SQL*Plus
23  * session for testing and debugging purposes.
24  * @param p_subscription_guid Subscription GUID
25  * @param p_event Event Message
26  * @return Status as ERROR, SUCCESS, WARNING
27  * @rep:scope public
28  * @rep:lifecycle active
29  * @rep:displayname Log Rule Function
30  * @rep:compatibility S
31  * @rep:ihelp FND/@evrulapis#a_evrullog See the related online help
32  */
33 FUNCTION log(p_subscription_guid in     raw,
34              p_event             in out nocopy wf_event_t) return varchar2;
35 ---------------------------------------------------------------------------
36 /*
37 ** error - no-op.  Returns ERROR.
38 */
39 /*#
40  * Returns the status code ERROR. Additionally, when you assign this
41  * function as the rule function for a subscription, you must enter a text
42  * string representing the internal name of an error message in the
43  * Parameters field for the subscription. When the subscription is
44  * executed, Error() will set that error message into the event.
45  * @param p_subscription_guid Subscription GUID
46  * @param p_event Event Message
47  * @return Status as ERROR
48  * @rep:scope public
49  * @rep:lifecycle active
50  * @rep:displayname Error Rule Function
51  * @rep:compatibility S
52  * @rep:ihelp FND/@evrulapis#a_evrullog See the related online help
53  */
54 FUNCTION error(p_subscription_guid in     raw,
55                p_event             in out nocopy wf_event_t) return varchar2;
56 ---------------------------------------------------------------------------
57 /*
58 ** warning - no-op.  Returns WARNING.
59 */
60 /*#
61  * Returns the status code WARNING. Additionally, when you assign this
62  * function as the rule function for a subscription, you must enter a text
63  * string representing the internal name of an error message in the
64  * Parameters field for the subscription. When the subscription is
65  * executed, Warning() will set that error message into the event message.
66  * @param p_subscription_guid Subscription GUID
67  * @param p_event Event Message
68  * @return Status as WARNING
69  * @rep:scope public
70  * @rep:lifecycle active
71  * @rep:displayname Warning Rule Function
72  * @rep:compatibility S
73  * @rep:ihelp FND/@evrulapis#a_evrulwar See the related online help
74  */
75 FUNCTION warning(p_subscription_guid in     raw,
76                  p_event             in out nocopy wf_event_t) return varchar2;
77 ---------------------------------------------------------------------------
78 /*
79 ** success - no-op.  Returns SUCCESS.
80 */
81 /*#
82  * Returns the status code SUCCESS. This function removes the event
83  * message from the queue but executes no other code except returning
84  * the SUCCESS status code to the calling subscription.
85  * @param p_subscription_guid Subscription GUID
86  * @param p_event Event Message
87  * @return Status as SUCCESS
88  * @rep:scope public
89  * @rep:lifecycle active
90  * @rep:displayname Success Rule Function
91  * @rep:compatibility S
92  * @rep:ihelp FND/@evrulapis#a_evrulsuc See the related online help
93  */
94 FUNCTION success(p_subscription_guid in     raw,
95                  p_event             in out nocopy wf_event_t) return varchar2;
96 ---------------------------------------------------------------------------
97 /*
98 ** default_rule - default dispatch functionality for subscription processing
99 **
100 **    When a rule function is not supplied for a subscription, we
101 **    provide default subscription processing logic.  This procedure
102 **    implements that logic.  Users may also call this procedure to
103 **    add the default processing logic to their rule function.
104 **
105 **        1) Send the event message to a Workflow process, if specified
106 **        2) Send the event message to an agent, if specified
107 **
108 **    Returns ERROR and message if either the Workflow or
109 **    Send operation raises an exception.  Otherwise returns SUCCESS.
110 */
111 /*#
112  * Performs default subscription processing, including sending the event
113  * message to a workflow process or to an agent, if specified in the
114  * subscription definition. If either of these operations raises an
115  * exception, Default_Rule() traps the exception, stores the error
116  * information in the event message, and returns the status code
117  * ERROR. Otherwise, Default_Rule() returns the status code SUCCESS.
118  * @param p_subscription_guid Subscription GUID
119  * @param p_event Event Message
120  * @return Status as ERROR, SUCCESS, WARNING
121  * @rep:scope public
122  * @rep:lifecycle active
123  * @rep:displayname Default Rule Function
124  * @rep:compatibility S
125  * @rep:ihelp FND/@evrulapis#a_evruldef See the related online help
126  */
127 FUNCTION default_rule(p_subscription_guid in     raw,
128                       p_event             in out nocopy wf_event_t) return varchar2;
129 
130 ---------------------------------------------------------------------------
131 /*
132 ** default_rule2 - Executes default_rule only if the subscription contains
133 **                 parameters that are in the event parameter list.
134 **    Returns ERROR and message if either the Workflow or
135 **    Send operation raises an exception.  Otherwise returns SUCCESS.
136 */
137 /*#
138  * Performs the default subscription processing only if the event message
139  * includes parameters that match all the subscription parameters. The
140  * default subscription processing includes sending the event message to
141  * a workflow process or to an agent, if specified in the subscription
142  * definition. If either of these operations raises an exception,
143  * Default_Rule2() traps the exception, stores the error information in
144  * the event message, and returns the status code ERROR. Otherwise,
145  * Default_Rule2() returns the status code SUCCESS.
146  * @param p_subscription_guid Subscription GUID
147  * @param p_event Event Message
148  * @return Status as ERROR, SUCCESS, WARNING
149  * @rep:scope public
150  * @rep:lifecycle active
151  * @rep:displayname Default Rule Function When Parameters Match
152  * @rep:compatibility S
153  * @rep:ihelp FND/@evrulapis#a_evruldeftw See the related online help
154  */
155 FUNCTION default_rule2(p_subscription_guid in     raw,
156                       p_event             in out nocopy wf_event_t)
157 
158 return varchar2;
159 ---------------------------------------------------------------------------
160 /*
161 ** workflow_protocol - uses workflow to perform the send, instead of default
162 **
163 **    Subscription processing logic which will use a workflow process to
164 **    send messages.  Depending on values in the parameters field, the
165 **    workflow may wait on a receive for an acknowledgement.
166 **
167 **    Returns ERROR if the Workflow raises an exception.
168 **    Otherwise returns SUCCESS.
169 */
170 /*#
171  * Sends the event message to the workflow process specified in the
172  * subscription, which will in turn send the event message to the inbound
173  * agent specified in the subscription. This function does not itself
174  * send the event message to the inbound agent. The function only sends
175  * the event message to the workflow process, where you can model the
176  * processing that you want to send the event message on to the specified
177  * agent.
178  * @param p_subscription_guid Subscription GUID
179  * @param p_event Event Message
180  * @return Status as ERROR, SUCCESS, WARNING
181  * @rep:scope public
182  * @rep:lifecycle active
183  * @rep:displayname Workflow Protocol
184  * @rep:compatibility S
185  * @rep:ihelp FND/@evrulapis#a_evrulwfp See the related online help
186  */
187 FUNCTION workflow_protocol(p_subscription_guid in     raw,
188                            p_event          in out nocopy wf_event_t) return varchar2;
189 ----------------------------------------------------------------------------
190 /*
191 ** error_rule - dispatch functionality for error subscription processing
192 **
193 **   Identical to default_rule, but if an exception is caught we raise it
194 **   up to cause a rollback.  We don't want messages processed off the
195 **   error queue to be continually recycled back on to the error queue.
196 **
197 **   Returns SUCCESS or raises an exception
198 **
199 */
200 /*#
201  * Performs the default subscription processing, but reraises any
202  * exception. The default subscription processing includes sending the
203  * event message to a workflow process or to an agent, if specified in
204  * the subscription definition. If either of these operations encounters
205  * an exception, Error_Rule() reraises the exception instead of returning
206  * a WARNING or ERROR status code, so that the event is not placed back
207  * onto the WF_ERROR queue. Otherwise, Error_Rule() returns the status
208  * code SUCCESS.
209  * @param p_subscription_guid Subscription GUID
210  * @param p_event Event Message
211  * @return Status as SUCCESS
212  * @rep:scope public
213  * @rep:lifecycle active
214  * @rep:displayname Default Error Rule Function
215  * @rep:compatibility S
216  * @rep:ihelp FND/@evrulapis#a_evrulerul See the related online help
217  */
218 FUNCTION error_rule(p_subscription_guid in     raw,
219                            p_event          in out nocopy wf_event_t) return varchar2;
220 ----------------------------------------------------------------------------
221 /*
222 ** setParametersIntoParameterList - Set Subscription Parameters into Parameter List
223 **
224 **    Returns ERROR if the Workflow raises an exception.
225 **    Otherwise returns SUCCESS.
226 **
227 */
228 /*#
229  * Sets the parameter name and value pairs from the subscription parameters
230  * into the PARAMETER_LIST attribute of the event message, except for any
231  * parameter named ITEMKEY or CORRELATION_ID. For a parameter with one of
232  * these names, the function sets the CORRELATION_ID attribute of the event
233  * message to the parameter value.
234  * @param p_subscription_guid Subscription GUID
235  * @param p_event Event Message
236  * @return Status as ERROR, SUCCESS, WARNING
237  * @rep:scope public
238  * @rep:lifecycle active
239  * @rep:displayname Set Parameters into Parameter List
240  * @rep:compatibility S
241  * @rep:ihelp FND/@evrulapis#a_evrulspipl See the related online help
242  */
243 FUNCTION setParametersIntoParameterList(p_subscription_guid in     raw,
244                            p_event          in out nocopy wf_event_t) return varchar2;
245 ----------------------------------------------------------------------------
246 --Bug 2193561
247 /*
248 **
249 This rule function can be used to send notifications .
250 This will make it trivial for the worklist to be accessed by
251 applications which do not want to build workflows, and still be able
252 to have certain actions performed based on the response processing
253 **
254 */
255 /*#
256  * Sends a notification as specified by the event parameter list. Use
257  * this rule function to send notifications outside of a workflow
258  * process.
259  * @param p_subscription_guid Subscription GUID
260  * @param p_event Event Message
261  * @return Status as ERROR, SUCCESS, WARNING
262  * @rep:scope public
263  * @rep:lifecycle active
264  * @rep:displayname Send Notification Rule Function
265  * @rep:compatibility S
266  * @rep:ihelp FND/@evrulapis#a_evrulsntf See the related online help
267  */
268 FUNCTION SendNotification (p_subscription_guid in    raw,
269                            p_event          in out nocopy wf_event_t)
270 return varchar2;
271 
272 -----------------------------------------------------------------------------
273 --Bug 2786192
274 /*
275 **
276 This rule function sets the parameterlist for the
277 the event from the subscription parameter list and subsequently
278 calls the default rule to execute the default processing
279 **
280 */
281 /*#
282  * Sets the subscription parameters into the event parameter list, and
283  * then performs the default subscription processing with the modified
284  * event message. The default subscription processing includes sending
285  * the event message to a workflow process or to an agent, if specified
286  * in the subscription definition. If either of these operations raises
287  * an exception, Default_Rule3() traps the exception, stores the error
288  * information in the event message, and returns the status code
289  * ERROR. Otherwise, Default_Rule3() returns the status code SUCCESS.
290  * @param p_subscription_guid Subscription GUID
291  * @param p_event Event Message
292  * @return Status as ERROR, SUCCESS, WARNING
293  * @rep:scope public
294  * @rep:lifecycle active
295  * @rep:displayname Default Rule Function Adding Parameters
296  * @rep:compatibility S
297  * @rep:ihelp FND/@evrulapis#a_evruldefth See the related online help
298  */
299 FUNCTION default_rule3(p_subscription_guid in     raw,
300                       p_event             in out nocopy wf_event_t)
301 return varchar2;
302 
303 /* Bug 2472743
304 This rule function can be used to restart multiple Workflow process waiting
305 for this event (or a null event) where the event activity has item attribute
306 named #BUSINESS_KEY which has the specified value.
307 */
308 /*#
309  * Sends the event to all existing workflow process instances that have
310  * eligible event activities waiting to receive it, identified by a
311  * business key attribute that matches the event key.
312  * @param p_subscription_guid Subscription GUID
313  * @param p_event Event Message
314  * @return Status as ERROR, SUCCESS, WARNING
315  * @rep:scope public
316  * @rep:lifecycle active
317  * @rep:displayname Send when Business Key Matches
318  * @rep:compatibility S
319  * @rep:ihelp FND/@evrulapis#a_evrulidr See the related online help
320  */
321 FUNCTION instance_default_rule(p_subscription_guid in    raw,
322                                p_event     in out nocopy wf_event_t)
323 return varchar2;
324 
325 ----------------------------------------------------------------------------
326 
327 /*
328 ** default_rule_or - Executes default_rule only if the subscription contains
329 **                 parameters that are in the event parameter list.
330 **    Returns ERROR and message if either the Workflow or
331 **    Send operation raises an exception.  Otherwise returns SUCCESS.
332 */
333 /*#
334  * Performs default subscription processing by calling Default_Rule only when
335  * the subscription parameter list contains a parameter that exists in the
336  * event parameter list.
337  * The default processing either sends the event message to a workflow process,
338  * if specified in the subscription definition or sends the event message
339  * to an agent, if specified in the subscription definition. If either of
340  * these operations raises an exception, Default_Rule() traps the exception,
341  * stores the error information in the event message, and returns the
342  * status code ERROR. Otherwise, Default_Rule() returns the status code
343  * SUCCESS.
344  * @param p_subscription_guid Subscription GUID
345  * @param p_event Event Message
346  * @return Status as ERROR, SUCCESS, WARNING
347  * @rep:scope public
348  * @rep:lifecycle active
349  * @rep:displayname Default Rule Function
350  * @rep:compatibility S
351  * @rep:ihelp FND/@evrulapis#a_evruldeftw See the related online help
352  */
353 FUNCTION default_rule_or(p_subscription_guid in     raw,
354                       p_event             in out nocopy wf_event_t)
355 
356 return varchar2;
357 
358 /*
359 ** Default_Generate - This function is a generic event generation function
360 **                    that will generate an XML document based on the
361 **                    p_event_name, p_event_key and the p_parameter_list.
362 */
363 /*#
364  * Generates a simple set of event data from the specified event
365  * name, event key, and parameter list. You can assign this
366  * standard generate function to events for demonstration and
367  * testing purposes. Default_Generate() generates the event data
368  * as an XML document in the following structure:
369  * <BUSINESSEVENT event-name="" key="">
370  *    <GENERATETIME mask="" >
371  *    <PARAMETERS count="">
372  *       <PARAMETER parameter-name="">
373  * @param p_event_name The event name
374  * @param p_event_key The event key
375  * @param p_parameter_list The list of parameter name and value pairs
376  * @rep:scope public
377  * @rep:lifecycle active
378  * @rep:displayname Standard Generate Function
379  * @rep:compatibility S
380  * @rep:ihelp FND/@a_evruldfgn See the related online help
381  */
382 function Default_Generate(p_event_name in varchar2,
383                   p_event_key in varchar2,
384                   p_parameter_list in wf_parameter_list_t)
385    return clob;
386 
387 end WF_RULE;