Skip Headers

Oracle Workflow API Reference
Release 2.6.3

Part Number B10286-02
Previous Next       Contents Index Glossary
         Previous  Next          Contents  Index  Glossary

Custom Callback Function

A default callback function can be called at various points by the actions of the WF_NOTIFICATION APIs. You may provide your own custom callback function, but it must follow standard specifications.

If you do not need to handle attributes of type event through your callback function, the procedure must use the following standard API:

procedure <name in callback argument>
(command in varchar2,
context in varchar2,
attr_name in varchar2,
attr_type in varchar2,
text_value in out varchar2,
number_value in out number,
date_value in out date);

If the callback function does need to handle attributes of type event, you can overload the procedure name with a second implementation that includes an additional argument for the event value. In this case you should also retain the original implementation for backward compatibility. However, it is recommended that you do not overload the procedure unless you have a requirement to handle event attributes.

The implementation of the procedure for event values must use the following standard API:

procedure <name in callback argument>
(command in varchar2,
context in varchar2,
attr_name in varchar2,
attr_type in varchar2,
text_value in out varchar2,
number_value in out number,
date_value in out date
event_value in out nocopy wf_event_t);

For ease of maintenance, you can define the procedure that does not include the event_value argument to call the procedure that does include that argument, so that you only need to maintain one version of your code. The following example shows one way to implement such a call:

procedure your_callback
(command in varchar2,
context in varchar2,
attr_name in varchar2,
attr_type in varchar2,
text_value in out varchar2,
number_value in out number,
date_value in out date)
is
event_value wf_event_t;
begin
your_package.your_callback(command, context, attr_name,
attr_type, text_value,
number_value, date_value,
event_value);
exception
when others then
Wf_Core.Context('your_package', 'your_callback',
command, context, attr_name, attr_type,
':'||text_value||':'||to_char(number_value)
||':'||to_char(date_value)||':');
raise;
end your_callback;

Arguments (input)

command Specify GET, SET, COMPLETE, ERROR, TESTCTX, FORWARD, TRANSFER, or RESPOND as the action requested. Use GET to get the value of an attribute, SET to set the value of an attribute, COMPLETE to indicate that the response is complete, ERROR to set the associated notification activity to a status of 'ERROR', TESTCTX to test the current context by calling the item type's Selector/Callback function, FORWARD to execute the post-notification function in FORWARD mode, TRANSFER to execute the post-notification function in TRANSFER mode, and RESPOND to execute the post-notification function in RESPOND mode.
context The context passed to SEND( ) or SendGroup( ). The format is <itemtype>:<itemkey>:<activityid>.
attr_name An attribute name to set/get if command is GET or SET.
attr_type An attribute type if command is SET or GET.
text_value Value of a text attribute if command is SET or value of text attribute returned if command is GET.
number_value Value of a number attribute if command is SET or value of a number attribute returned if command is GET.
date_value Value of a date attribute if command is SET or value of a date attribute returned if command GET.
event_value Value of an event attribute if command is SET or value of an event attribute returned if command is GET. Required only if the procedure name is overloaded with a second implementation that handles event attributes.
Note: The arguments text_value, number_value, and date_value, as well as event_value if you are using this argument, are mutually exclusive. That is, you should use only one of these arguments, depending on the value of the attr_type argument.

When a notification is sent, the system calls the specified callback function once for each SEND attribute (to get the attribute value).

Example 1

For each SEND attribute, call:

 your_callback('GET', context, 'BUGNO', 'NUMBER', textval, numval, dateval);

Example 2

When the user responds to the notification, the callback is called again, once for each RESPOND attribute.

 your_callback('SET', context, 'STATUS', 'TEXT', 'COMPLETE', numval, dateval);

Example 3

Then finally the Notification System calls the 'COMPLETE' command to indicate the response is complete.

 your_callback('COMPLETE', context, attrname, attrtype, textval, numval, dateval);

Example 4

For a SEND attribute of type event, call the implementation that includes the event_value argument.

 your_callback('GET', context, 'RECEIVE_EVENT', 'EVENT', textval, numval, dateval, eventval);

         Previous  Next          Contents  Index  Glossary


Oracle Logo
Copyright © 2003 Oracle Corporation.

All rights reserved.