Skip Headers

Oracle Workflow Developer's Guide
Release 2.6.3

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

To Create a Function Activity

1. Select the item type that you want to create a function for in the navigator tree, then choose New Function from the Edit menu. Define your function activity in the Activity property page that appears.
2. A function activity must have an Internal Name (all uppercase and no leading/trailing spaces) and a Display Name, which is the translatable name that appears in your process diagram. Use the description to provide an explanation about this activity.
Attention: To update the internal name for an activity once it is defined, you must use a special SQL script called wfchact.sql. You should only use this script to correct errors in an activity's internal name during design time. Do not use this script to rename activities that are involved in running instances of processes. See: Wfchact.sql, Oracle Workflow Administrator's Guide.
Caution: Do not include colons ":" or leading/trailing spaces in your internal name.
3. Enter the name of the function you want this activity to execute. In the Type field, specify whether the function is a PL/SQL function, an External function, or an External Java function.
For a PL/SQL function, set the function type to PL/SQL and specify the function as <package_name>.<procedure_name>. The function must be defined according to a standard API. See: Standard API for PL/SQL Procedures Called by Function Activities.
For an external function activity, set the function type to External. The Workflow Engine enqueues an entry in the "Outbound" queue and sets the correlation value of that entry to a value composed of the Workflow schema name and the item type in the following format:
 <schema_name><item_type>
See: Workflow Queue APIs, Oracle Workflow API Reference.
You must create your own queue handler to search for this type of record on the "Outbound" queue. The queue handler must execute the action associated with the record and seed the result of the action onto the "Inbound" queue. The background engine then takes care of messages on the inbound queue and restarts your original workflow process. See: Deferred Processing, Oracle Workflow API Reference.
For an external Java function activity, set the function type to External Java and enter the class name of your custom Java class as the function name. This functionality is currently only available for the standalone version of Oracle Workflow. If the custom class is within a package, prefix the class name with the package name in the following format:
 <customPackage>.<customClass>
The Java class must be defined according to a standard API. See: Standard API for Java Procedures Called by Function Activities.
The Workflow Engine enqueues an entry in the 'Outbound' queue. The Java Function Activity Agent dequeues messages of this type, executes your Java program, and enqueues the results onto the 'Inbound' queue. The background engine then takes care of messages on the inbound queue and restarts your original workflow process. See: Setting Up the Java Function Activity Agent, Oracle Workflow Administrator's Guide and Deferred Processing, Oracle Workflow API Reference.
Note: These 'Outbound' and 'Inbound' queues are separate from the queues used for the Business Event System. See: Workflow Queue APIs, Oracle Workflow API Reference.
Note: To execute external Java function activities, you must include your JAR files in your CLASSPATH.
4. Indicate the result type (a predefined Lookup Type) for this activity. Result types list the possible results returned by this activity. Your workflow diagram may branch depending on the value returned by your completed activity. See: To Create Lookup Types.
You can choose <None> as the result type if your activity does not return a value, or if your workflow process does not depend on the value returned.
5. Specify the cost of this function activity. See: Activity Cost.
6. Choose an icon that identifies your activity. You can use any icon, as long as the icon is stored in a .ico file, to symbolize the action of an activity. See: Adding Custom Icons to Oracle Workflow, Oracle Workflow Administrator's Guide.
Choose Browse to view the icon files listed in the workflow icons subdirectory.
You can also drag and drop icon files from the Windows Explorer or File Manager onto an activity in your navigator tree to assign that icon to the activity.
7. Choose Apply to save your changes.
8. Select the Details tab to display and modify the optional details of the activity. See: To Define Optional Activity Details.
9. Select the Roles tab page to specify the roles that have access to this function activity. (This functionality will be supported in a future release.)
10. Select the Access tab page to set the access levels allowed to modify this function. See: Allowing Access to an Object.
11. The function activity now appears beneath Functions in the navigator tree. You can review or edit the properties of this activity at any time by double-clicking on the activity in the navigator tree or by selecting the activity and choosing Properties from the Edit menu or by pressing Enter on your keyboard.
12. If your function requires input arguments, you can expose those arguments in Oracle Workflow Builder as attributes of the function activity. Function activity attributes behave as parameters whose values you can modify for each usage of the activity in a process. Function activity attributes are specific to a function activity and are not global to a process. See: To Define an Item Type or Activity Attribute.
To create a function activity attribute that references an item type attribute, select the referenced item type attribute in the navigator tree, and hold down your mouse select button as you drag the item type attribute to your function activity. The Default Value region is automatically set to Item Attribute and references the originating item attribute.
When you include a function activity as a node in a process, you can assign a value to the function activity attribute that is specific to that node. See: To Define Activity Attribute Values.

See Also

Using the Edit Button in a Property Page

To Copy an Activity


         Previous  Next          Contents  Index  Glossary


Oracle Logo
Copyright © 2003 Oracle Corporation.

All rights reserved.