Applying Workflow Engine APIs to Function Activities

Applying Workflow Engine APIs to Function Activities

Function activities are stored in PL/SQL procedures. There is a standard API format for all stored procedures called by function activities. When the Workflow Engine executes the function activity, the Workflow Engine passes four input variables and, if a result type is set up for the activity, expects one output variable in return. Output variables are:
· Itemtype A category of items that share the same set of attributes (e.g.,
purchase order).
· Itemkey A unique identifier within the same item type for the specific item
passing through the workflow process.
· Actid The unique identifier of the activity that calls this stored procedure.
· Funcmode The execution mode of the function activity. It can be run, cancel,
or timeout. The timeout mode is used for an expired notification that was
intended to solicit a response. Each notification has a time-out value. If a
notification has received no response after the time-out value has been
exceeded, the Workflow Engine will execute the dependent activities with an
execution mode of TIMEOUT.
· Result The result of the stored procedure. Results can be:
o COMPLETE: result_code Stored procedure completed. The result code
is specified in the type of the function activity.
o DEFERRED: date The stored procedure is deferred, to be processed in
the background or at a specified date (optional).
o ERROR: error_code The stored procedure erred. You can, if you wish,
provide the error code.
o NOTIFIED: notification_ID: user The stored procedure sent out a
notification to a user. You may return the unique identifier for the
notification, the notification ID, and the user who sent the notification.
o WAITING The stored procedure has been completed, but there is a
waiting period before the function activity is marked as Complete. The
background Workflow Engine will mark the function activity Complete
after the waiting period has expired.

The stored procedure declaration will be in the following format:
PROCEDURE your_procedure_name (
itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
result out varchar2) IS

Once the procedure declaration is completed, you will then have the stored procedure
body. A pair of BEGIN and END markers encloses the stored procedure body. In the
procedure body, you must check the Funcmode variable to execute codes that correspond to the RUN, CANCEL, and TIMEOUT modes.

Review Questions
1. What does the input variable Itemkey represent?
2. What does the input variable Actid represent?
3. What three function activity execution modes are in a stored procedure?
4. What are the possible results of a stored procedure in a function activity?


1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17
*/

No comments:

Post a Comment