Search from 700 + Posts

Jul 2, 2008

Oracle Workflow - Concept

This topic explains in short about the key features of Oracle workflow and how to create one simple workflow.

This blog is for the developer who are new to the workflow or developer who want to learn workflow. I have divided the workflow in 3 blogs.
In First part, I will talk about the Workflow and it’s components Other than Business Events.
In Second Part, I will explain the Business events in depth.
In Third Part , I will explain how to send Email Notification from workflow.

Oracle workflow is tool to automate the process with in/out of organization. It helps us to sequence the business activities of our business as per requirements/poloicies and business rules. An business activitiy inturns can be a
  1. Business event
  2. notification
  3. function or
  4. another subprocess.

It helps us to

  1. Save time in doing repetative work.
  2. Send Notification /reminder of the work to done.

Nature of workflow is that I will go as far as it can go, ie once we start a workflow it will keep executing the activities in it’s route unless it encounter a Block/Notification activity that requires Input from Human/some external process

Important Components of Workflow
Workflow Builder – It is a client tool, you can downlaod it from the http://www.oracle.com/. This is a graphical tool that helps us to create /modify the Business flow.
Workfow Engine - The Workflow Engine embedded in the Oracle Database implements process definitions at runtime. The Workflow Engine monitors workflow states and coordinates the routing of activities for a process. Changes in workflow state, such as the completion of workflow activities, are signaled to the engine via a PL/SQL API or a Java API. Based on flexibly-defined workflow rules, the engine determines which activities are eligible to run, and then runs them.

Workflow Process – A workflow process is nothing but the sequence of our business flow designed with the workflow tool. It may consists of activities in the business process, relation shipbetween the activities, subprocesses etc. An activity can be a pl/sql or Java function or a Manual function like notification that may /may not required some interventions.

A workflow business process begins with a Start activity and completes with a End activity. Between Start and end there can have a
Pl/sql function for some automated process,
A block function in case we want some external function to process the work or
A notification in case worflow want user of the workflow to complete the some activity.

Worflow supports

  1. Looping between acativities.
  2. Parallel/Sequencial flows.
  3. Timeout of activity.
  4. Subprocess.
  5. Braching of the flow based on the result of an activity..

Desiging of Workflow Process
Oracle workflow builder help us to design workflow for our business Process.Workflow builder provide us a tree like structure that consists of

  1. Attributes.
  2. Process.
  3. Notifications.
  4. Functions.
  5. Events .
  6. Messages and Lookup type etc.

Oracle workflow builder has lot of Standard activitites that we can use in our process by just draging and droping from thr Standad (built –in) workflow. These standard activities, attributes, lookuptypes are associated with Standard Workflow (wfstd.wft). Some of the standard activities are AND/OR/WAIT/BLOCK etc .We can use any of these based on our requirement.

Before we begin with the workflow in bulider, it is always good practice to design the flow on pen/paper, Plan for
All the activities, notications, functions, events in the flow.
Out come of all the above
What action need to be taken based in the outcome

In this blog I will explain Top – Down approch to design a workflow (In Top Down approch design process diagram with activities, and then design the underline code for each activity)
Following are steps

  1. Use workflow quick wizard to create Item Type and Process activity.
  2. Define Function, Notifications, relationship between activities.(Without specifying the underline code).
  3. Define Item type attributes, lookuo type/code
  4. Define Messager and message attribute.

Each of Item Type, Process, Function etc has there Internal and Display name, Description, Underlying pl/sql or Java code etc.

Important Properties

  1. Item Type [Selector OR Callback] - One of the important property of the ItemType is Selector OR Callback function. This is a PL/Sql function that workflow engine can call to Reset or Test Context information for an item type before executing an activity.An itemtype can have multiple WF processess associated with it, this Selector/Callback function help to identify the appropriate process to run.
  2. Process [Runnable] – Select the runnable check box if process is a top-level workflow process (one that can be initated and not a subprocess).

Attributes
Attribuet are just like variables.We can deine attribute at the ITEM TYPE as well at the message , notification , lookuptype.Only difference is attribute at the itemtype level act like global variables.
For different type of attribibute please refere user guide

Notification
It is an activity to communicate with human being sand it may or may not require response. (TIMEOUT – Indicate wethere nitifiucaton respopnse received by certain time).

Message
It is information that sent by notification.

Function
A function activity is usually defined by PL/Sql store procedure. Important thing here is PL/SQL procedure for function activity must follow a standard API.Any Pl/sql function called from the workflow API should have following Parameter.

procedure do_nothing
( itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
resultout in out varchar2 )

Property Page – We can define the property for activity/function/notification etc in the property page. I am explaining only few.

In detail tab of Property Page you can define an error process (Error Item Type) for the activity, to handle any unexected errors encountered during the execution of workflow. By defualt Workflow will add WFEROR, but in case you want to define your own process then you can add your error process name here. Another Important column on this tab is On Revisit, It determine how the Workflow Engine handles this
Activity when it is transitioned to more than once.
It has following Choices.
Ignore - Workflow Engine executes the activity only once, and ignores the activity for all subsequent revisits.
Reset - Workflow Engine resets the completed activities by executing each activity in CANCEL mode before executing them in RUN Mode.
Loop - Workflow Engine simply reexecutes the activities without Reseting them.

Transition
Every process must have a Start and End activity. Once activities are ready we can design the transition between activities/process.

Validation /Verification of Workflow Process
One Workflow process is complete, we can validate /verify the process for Errors.During verification workflow valiadate .

  1. Process Contain at least on start and one end.
  2. One subprocess sould not used twice.
  3. All possible activity results are modled as outgoing transitions.
  4. An End node should not have any outgoing transitions.
  5. For a notification activity, its result type should match with the lookup type defined in the underline message’s RESULT attribute.All message attribute refered in the message should exist.

For more details on this please refer the worflow user Manual or you can write to me at srgupta72@hotmail.com

No comments:

Post a Comment