Attributesàlists
the attributes for the current item type. Item type attributes
describe features of an item type. For example, if an item type is a
purchase order requisition, then an item type attribute can be the
requisition amount or the requisition ID. Type
Processeàlists the process activities or workflow process definitions for the current item type.
Notificationsàlists
the notification activities associated with the current item type. A
notification activity sends a message to a user or role. The message
may prompt for a response or may simply provide information.
Functionsàlists
the function activities associated with the current item type. A
function activity represents a PL/SQL stored procedure that the Workflow
Engine executes automatically. A function activity can also have
activity attributes associated with it.
Eventsàlists
the event activities associated with the current item type. An event
activity represents a business event that the process receives, raises,
or sends.
Messagesàlists
the messages that a notification activity associated with the current
item type can send to a user or role. A message can have message
attributes associated with it.
Lookup Typesàlists
the lookup types associated with the current item type. A lookup type
has one or more values called lookup codes associated with it. A lookup
type is a list of values that can be referenced by a message, or by a
notification, function, or process as its possible result type.
1. Choose New from the File menu to create a workspace for your new process definition.
2. Create a new item type. The item type classifies the work item to be managed by the process
3.
You can define item type attributes to fully describe your item type
and have the activities in your process refer to these attributes for
information.
5. Create new lookup types.
The
Lookup Type maps to the Result Type of an activity. A Result Type is a
list of possible results that an activity can have upon completion.
Lookup types can also be referenced by item type attributes, activity attributes, messages, or message attributes.
6. Create new messages.
If you wish to create a notification activity for your process, you
should first create the message that you want the notification activity to send.
You can drag a new message onto a notification activity in the navigator tree to assign the message to that activity.
7. Create a new process activity
The process diagram establishes the relationship of all the activities in your process.
8. Save your work by choosing Save or Save As from the File menu.
9.
In a database accessible by your Oracle Workflow server, create the
PL/SQL stored procedures called by your PL/SQL function activities. You
can do this through SQL*Plus or the Oracle Procedure Builder.
Depending
on the workflow process you wish to create, you need to define all or
some of the following types of components to make up the process:
- Item Types
- Lookup Types
- Messages
- Activities
- Attributes
- Roles
Item Types
An item type is a classification of the components that make up a workflow process.
Often it makes sense to define an item type so that it describes the item being managed by your workflow process.
An Item Type usually congregates all the items used in the Workflow process.
For example,
purchase order requisition can be an item type while a purchase order
requisition identified by a particular ID number is an item of that item
type.
Item Type Attributes
An item type attribute is a property associated with a given item type.
It
acts as a global variable that can be referenced or updated by any
activity within a process. An item type attribute often provides
information about an item that is necessary for the workflow process to
complete.
Applications as well as function activities can reference and set item type attributes using the Oracle Workflow Engine APIs.
These are also used to show any dynamic values in the notifications.
Attribute Types
There are ten attribute types, as shown below. The type determines what values are acceptable and how the attribute is used.
- Text: The attribute value is a string of text.
- Number: The attribute value is a number with the optional format mask you specify.
- Date: The attribute value is a date with the optional format mask you specify.
- Lookup: The attribute value is one of the lookup code values in a specified lookup type.
- Form: The attribute value is an Oracle Applications internal form function name and its optional form function parameters. This attribute type is not relevant for the standalone version of Oracle Workflow.
- URL: The attribute value is a Universal Resource Locator (URL) to a network location.
- Document: The attribute value is an attached document. You can specify the following types of documents in the default value field:
- PL/SQL document – A document representing data from the database as a character string, generated from a PL/SQL procedure.
- PL/SQL CLOB document – A document representing data from the database as a character large object (CLOB), generated from a PL/SQL procedure. The CLOB can contain plain text, HTML, an Adobe Acrobat Portable Document Format (PDF) document, a Microsoft Rich Text Format (RTF) document, or, if your database version is Oracle9i Database or higher, binary data encoded to base64.
- PL/SQL BLOB document – A document representing data from the database as a binary large object (BLOB), generated from a PL/SQL procedure. The BLOB can contain an image or other types of application files that are stored as binary data.
- Oracle Applications Framework region – In Oracle Applications, a JSP call to an Oracle Applications Framework region for inclusion in a notification message.
- Role: The attribute value is the internal name of a role. If a message attribute of type role is included in a notification message, the attribute automatically resolves to the role’s display name, eliminating the need for you to maintain separate attributes for the role’s internal and display names. Also when you view the notification from a web browser, the role display name is a hypertext link to the e–mail address for that role. To set a default value for the attribute, you must initially load roles from the database.
- Attribute: The attribute value is the internal name of another existing item type attribute that you want to maintain references to in a process.
- Event: The attribute value is a Business Event System event message in the standard WF_EVENT_T structure.
Activities
An activity is a unit of work that contributes toward the accomplishment of a process.
An activity can be a notification, a function, an event, or a process.
A
notification activity sends a message to a workflow user. The message
may simply provide the user with information or request the user to take
some action.
A function activity calls a PL/SQL stored procedure or some external program to perform an automated function.
An
event activity receives, raises, or sends a business event. A process
activity is a modeled workflow process, which can be included as an
activity in another process to represent a sub–process.
Notification Activity:
When
the workflow engine reaches a notification activity, it issues a Send (
) API call to the Notification System to send the message to an
assigned performer. You define the message that the notification sends.
You specify the performer of a notification activity when you include the notification activity as a node in the process.
You
can either designate the performer to be a specific role or an item
type attribute that dynamically returns the name of a role.
Function Activity:
A
function activity is defined by the PL/SQL stored procedure or external
program that it calls. Function activities are typically used to
perform fully automated steps in the process. As a PL/SQL stored
procedure, a function activity accepts standard arguments and can return
a completion result.
If
you pass a parameter for the stored procedure, you can expose that
parameter as an activity attribute. The activity attribute’s value can
be set when you define that activity as a node in your process. Note
that these activity attributes are available only to the current
activity and are not global like item type attributes.
To Validate a Process Definition
- Choose Verify from the File menu to validate all process definitions for the currently selected data store.
- The following list is an example of some of the validation that the Verify command performs:
- Checks that a process has at least one Start and one End activity.
- Verifies that a process does not contain itself as a process activity.
- Restricts the same sub process from being used twice in a process.
- Validates that all possible activity results are modeled as outgoing transitions. If an activity completes with a result that is not associated with an outgoing transition, and a <Default> transition doesn’t exist for that activity, the activity enters an ’ERROR’ state.
- Validates that activity nodes marked as END nodes do not have any outgoing transitions.
- Validates that a notification activity’s result type matches the lookup type defined for the message’s ’RESULT’ message attribute.
- Verifies that message attributes referenced in a message body for token substitution exist in the message definition.
- For processes that reference objects from another item type, verifies that the requisite item attributes associated with the referenced item type exists.
Defining Procedures and Functions for Oracle Workflow
Oracle
Workflow lets you integrate your own custom PL/SQL and Java procedures
and functions at certain points in your workflow processes and in the
Business Event System. To ensure that Oracle Workflow can properly
execute your custom code, follow these standard APIs when developing
your procedures and functions.
- Standard API for PL/SQL Procedures Called by Function Activities
- Standard API for Java Procedures Called by Function Activities
- Standard API for an Item Type Selector or Callback Function
- Standard APIs for ”PL/SQL” Document
- Standard API for an Event Data Generate Function
- Standard APIs for a Queue Handler
- Standard API for an Event Subscription Rule Function
The
standalone version of Oracle Workflow provides a web–based interface
called Launch Processes for you to test any workflow definition you
define and save to the database. Launch Processes is accessible only to
users belonging to the Workflow Administrator role.
Although
you can run the Launch Processes web page against any Oracle Workflow
database, we advise that you create a separate environment for testing
purposes. To test a workflow definition, you should set up the following
in your test environment:
- Define test users/roles. You can test against the users and roles predefined in the Oracle Workflow demonstration data model.
- If you are using the standalone version of Oracle Workflow and you plan to use the notifications web page to view notifications, you need to define your test users/roles in your web security system. Refer to your web server documentation for more information.
- If you plan to use e–mail to view notifications, you can send all notifications to a single test e–mail address by setting the Test Address configuration parameter when you configure a notification mailer. For more information, please refer to the Oracle Workflow Manager sections of the Oracle Applications Manager online help for Oracle Workflow embedded in Oracle Applications, or to the Oracle Workflow Manager sections of the Oracle Enterprise Manager online help for standalone Oracle Workflow.
To Test a Workflow Definition:
1. Use a web browser to connect to the Oracle Workflow home page.
2. Select the Launch Processes link to display the Launch Processes web page.
3.
The Launch Processes page displays all the item type definitions stored
in the database except the Oracle Workflow seeded item types: Wferror,
Wfmail, and Wfstd. The internal name and description for each item type
also appears. Select the item type that owns the workflow process
definition you wish to test.
4.
Use the Initiate Workflow web page to specify the details for the
process you wish to launch. To initiate an instance of a workflow
process, you need to specify:
- A unique item key for the process instance.
- A user–defined key that you want to use to identify the process.
- The name of the process to test.
- An optional process owner.
- Values for any item type attributes associated with the item type of the process.
Select OK. To initiate the workflow process, the Initiate Workflow web page calls the Workflow Engine CreateProcess and Startprocess APIs for the item type and item key specified. It also calls the Workflow Engine SetItemOwner and SetItemAttr APIs to set the process owner and all the item type attributes to the values specified.
5.
The Workflow Monitor Activities List for your initiated process
instance appears. The Activities List displays the status of the
activities that have been executed. You can also select the View Diagram
button to display the status of the process graphically in the Workflow
Monitor.
6.
If the process you are testing contains notifications, you can navigate
back to the Workflow Home page and select the Find Notifications link
to find the outstanding Notifications that require responses to complete
the process. Alternatively, if you prefer to test the notification
responses via e–mail, you can connect to the e–mail test account you
specified for the notification mailer to respond to the outstanding
notifications for your process.
Event Manager for Standalone Oracle Workflow
The Oracle Workflow Business Event System is an application service that leverages the Oracle Advanced Queuing (AQ)
infrastructure to communicate business events between systems. The
Business Event System consists of the Event Manager and workflow process
event activities.
The
Event Manager contains a registry of business events, systems, named
communication agents within those systems, and subscriptions indicating
that an event is significant to a particular system. Events can be
raised locally or received from an external system or the local system
through AQ. When a local event occurs, the subscribing code is executed
in the same transaction as the code that raised the event, unless the
subscriptions are deferred.
Events
A
business event is an occurrence in an internet or intranet application
or program that might be significant to other objects in a system or to
external agents.
For instance, the creation of a purchase order is an example of a
business event in a purchasing application. You can define your
significant events in the Event Manager.
When
an event occurs in an application on your local system, an event key
must be assigned to uniquely identify that particular instance of the
event. Then the event must be raised to the Event Manager.
Event Subscriptions
An
event subscription is a registration indicating that a particular event
is significant to a particular system and specifying the processing to
perform when the triggering event occurs. You can define your event
subscriptions in the Event Manager.
When
you install Oracle Workflow, several default subscriptions to
predefined Workflow events are automatically created. You can enable,
disable, or copy these subscriptions to perform the event processing
that you want.
To Create or Update an Event
1. Navigate to the Create Event page or to the Update Event page.
The
Create Event page and the Update Event page are identical, except that
the fields in the Update Event page are populated with previously
defined information for the selected event.
2.
Enter the internal name of the event in the Name field. The internal
name is case–sensitive. The suggested format is a compound structure of
identifiers separated by periods (.) as follows:
<Company>.<family>.<product>.< component>.<object>.<event>
3. Enter a display name for the event.
4. Enter an optional description for the event.
5.
Select Enabled or Disabled as the event status. If you disable an
event, its definition remains in the Event Manager for reference, but
you cannot use the event in active subscriptions.
6.
If you are defining an event that occurs on your local system, enter
the generate functions for the event. A generate function is a PL/SQL
procedure or Java API that can produce the complete event data from the
event name, event key, and an optional parameter list. You can assign
the event a PL/SQL generate function if the event has PL/SQL
subscriptions, a Java generate function if the event has Java
subscriptions, or both a PL/SQL generate function and a Java generate
function if the event has both types of subscriptions.
To
assign the event a PL/SQL Generate function; enter the PL/SQL procedure
in the Generate Function field in the following format:
<package_name>.<function_name>
• To assign the event a Java Generate function; enter the Java API in the Java Generate Function field in the following format:
<customPackage>.<customClass>
7.
Identify the program or application that owns the event by entering the
program name in the Owner Name field and the program ID in the Owner
Tag field.
8. Review the customization level for the event.
- Core – No changes can be made to the event definition. This level is used only for events seeded by Oracle Applications.
- Limit – The event status can be updated to enable or Disabled, but no other changes can be made to the event definition. This level is used only for events seeded by Oracle Applications.
- User – Any property in the event definition can be updated. This level is automatically set for events that you define.
Oracle
Workflow provides several predefined events for significant occurrences
within the Business Event System and other Oracle Workflow components.
You can define subscriptions to these events for replication,
validation, or other purposes. You can enable or disable many of the
events if necessary.
Some
predefined events are referenced by default subscriptions that are
created automatically when you install Oracle Workflow. The subscriber
for all the default subscriptions is the local system. You can enable,
disable, or copy many of these subscriptions to perform the event
processing that you want.
Some of the Predefined Workflow Events:
Event Definition Events
Event Created
Oracle Workflow raises this event whenever a new individual event or event group definition is created.
Internal Name oracle.apps.wf.event.event. create
Status Enabled
Generate Function wf_event_functions_pkg. generate
Owner Name Oracle Workflow
Owner Tag FND
Customization Level Limit
Event Updated
Oracle Workflow raises this event whenever an individual event or event group definition is updated.
Internal Name oracle.apps.wf.event.event. update
Status Enabled
Generate Function wf_event_functions_pkg. generate
Owner Name Oracle Workflow
Owner Tag FND
Customization Level Limit
Event Deleted
Oracle Workflow raises this event whenever an individual event or event group definition is deleted.
Internal Name oracle.apps.wf.event.event. delete
Status Enabled
Generate Function wf_event_functions_pkg. generate
Owner Name Oracle Workflow
Owner Tag FND
Customization Level Limit
System Definition Events
System Created
Oracle Workflow raises this event whenever a new system definition is created.
Internal Name oracle.apps.wf.event.system. create
Status Enabled
Generate Function wf_event_functions_pkg. generate
Owner Name Oracle Workflow
Owner Tag FND
Customization Level Limit
System Updated
Oracle Workflow raises this event whenever a system definition is updated.
Internal Name oracle.apps.wf.event.system. update
Status Enabled
Generate Function wf_event_functions_pkg. generate
Owner Name Oracle Workflow
Owner Tag FND
Customization Level Limit
Requisition Process and Approval Hierarchy :-
The
Requisition process is an example of a workflow process that is
initiated when you create a new requisition to purchase an item. The
Requisition process is based on two tables that store approval hierarchy
and spending authority information.
When
you submit a requisition in this demonstration, the process sends a
notification to the next manager in the approval hierarchy to approve
the requisition. If the spending limit of the approving manager is less
than the requisition amount, the process forwards the requisition to the
next higher manager in the approval hierarchy until it finds a manager
with the appropriate spending limit to approve the requisition. Each
intermediate manager must approve the requisition to move it to the next
higher manager. Once a manager with the appropriate spending limit
approves the requisition, the process ends with a result of Approve.
The process can end with a result of rejected if:
- Any manager rejects the requisition.
- The requisition amount is greater than the highest spending limit.
- The requisition’s requestor does not have a manager.
Summary of the Requisition Approval Process
To
view the properties of the Requisition Approval process, select the
process in the navigator tree, then choose Properties from the Edit
menu. The Requisition Approval process has a result type of Approval,
indicating that when the process completes, it has a result of Approve
or Reject (the lookup codes in the Approval lookup type associated with
the Standard item type). This process activity is also runnable,
indicating that it can be initiated as a top level process to run.
Oracle
Workflow provides default error handling for both workflow processes
and event subscription processing. The default handling is defined by
error processes provided in a special item type called System: Error,
and, for events, by a special subscription to the Unexpected event with a
source type of Error. You can also choose to define your own custom
error handling by creating custom error processes and subscriptions.
Error Handling for Workflow Processes
Errors
that occur during workflow execution cannot be directly returned to the
caller, since the caller generally does not know how to respond to the
error. In fact, the caller may be a background engine with no human
operator. Instead, Oracle Workflow lets you define the processing you
want to occur in case of an error by specifying an error handling
process when you create your workflow process in Oracle Workflow
Builder.
At
design time, you can assign an error handling process for a process,
function, or event activity in the activity’s Details property page. You
must specify the internal names of both the item type that owns the
error handling process and the error handling process itself.
Oracle
Workflow provides a special item type called System: Error, which
contains error processes called Default Error process and Retry–only
process that you can use for generic error handling in any of your
processes. However, you cannot modify the error processes in the System:
Error item type. If you want to incorporate functionality that is not
available in these error processes, you should create your own custom
error handling process in your own item type. An error process can
branch based on error codes, send notifications, and attempt to deal
with the error using automated rules for resetting, retrying, or
skipping the failed activity.
At
runtime, the Workflow Engine traps errors produced by function
activities by setting a save point before each function activity. If an
activity produces an unhandled exception, the engine performs a rollback
to the save point, and sets the activity to the ERROR status.
For
this reason, you should never commit within the PL/SQL procedure of a
function activity. The Workflow Engine never issues a commit as it is
the responsibility of the calling application to commit.
The
Workflow Engine then attempts to locate an error process to run by
starting with the activity which caused the error and then checking each
parent process activity until an associated error process is located.
If the Workflow Engine finds an error process, it launches that process
to handle the error. If no error process is assigned for the running
process, the Workflow Engine performs a rollback to the save point and
sets the activity to the ERROR status, but no error process can be
launched.
Unexpected Events
Oracle
Workflow also uses the Default Event Error process to handle unexpected
events. If an event is received from an external source, but the local
system does not have any subscriptions to that event, the Event Manager
automatically searches for subscriptions to the unexpected event with
the source type External. Oracle Workflow provides a predefined External
subscription to the unexpected event that sends the event message to
the Default Event Error process.
No comments:
Post a Comment