Sie sind auf Seite 1von 9

Parameters for a PL/SQL in Workflow

API
Parameters for a PL/SQL:
When the Workflow Engine calls a stored procedure for a unction activity, it
passes four parameters to the procedure and may expect a result when the
procedure completes.
Itemtype (IN) : Internal name of the item
Itemkey (IN) : A string to uniquely identify the item type instance
Actid (IN) : ID of the activity from where this procedure is called.
Funcmode (IN) : Execution mode of the activity
Resultout (OUT) : Result Type of the activity
FUNCMODE : For functions, it can be RUN or CANCEL For notifications, it can
be RESPOND, FORWARD, TRANSFER or TIMEOUT
RESULTOUT : COMPLETE:: Activity successful.
WAITING : Pending for some other activity
DEFERRED: Activity deferred till
NOTIFIED: Activity notified to with a . Externally, must be completed using
WF_ENGINE.CompleteActivity.
ERROR: Activity encounters an error
PL/SQL Coding Standards
Procedure
( itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
resultout out varchar2 )

is
;
Begin
if ( funcmode = RUN ) then
resultout := COMPLETE:;
return;
end if;
if ( funcmode = CANCEL ) then
resultout := COMPLETE;
return;
end if;
if ( funcmode = RESPOND ) then
resultout := COMPLETE;
return;
end if;
if ( funcmode = FORWARD ) then
resultout := COMPLETE;
return;
end if;
if ( funcmode = TIMEOUT ) then
resultout := COMPLETE;
return;
end if;
if ( funcmode = TRANSFER ) then
resultout := COMPLETE;
return;
end if;
Exception
When others then
WF_CORE.CONTEXT (, , , , to_char(),
);

raise;
End ;
==========================================================================

Example for Custom Requisition WF :


PROCEDURE Req_App_Process(Requisitionid IN VARCHAR2,
RequisitionDesc IN VARCHAR2,
RequisitionAmount IN NUMBER,
RequestorUsername IN VARCHAR2,
ProcessOwner IN VARCHAR2,
Workflowprocess IN VARCHAR2 DEFAULT NULL,
item_type IN VARCHAR2 DEFAULT NULL ) IS
-ItemType VARCHAR2(30) := NVL(item_type,'WFDEMO');
ItemKey VARCHAR2(30) := RequisitionNumber;
ItemUserKey VARCHAR2(80) := RequisitionDesc;
-BEGIN
--- Start Process :
-- If workflowprocess is passed, it will be run.
-- If workflowprocess is NOT passed, the selector function
-- defined in the item type will determine which process to run.
-Wf_Engine.CreateProcess( ItemType => ItemType,
ItemKey => ItemKey,
process => WorkflowProcess );
Wf_Engine.SetItemUserKey (ItemType => ItemType,
ItemKey => ItemKey,

UserKey => ItemUserKey);


--- Initialize workflow item attributes
-Wf_Engine.SetItemAttrText (itemtype => itemtype,
itemkey => itemkey,
aname => 'REQUISITION_NUMBER',
avalue => RequisitionNumber);
-Wf_Engine.SetItemAttrText (itemtype => itemtype,
itemkey => itemkey,
aname => 'REQUISITION_DESCRIPTION',
avalue => ItemUserKey);
Wf_Engine.SetItemAttrNumber( itemtype => itemtype,
itemkey => itemkey,
aname => 'REQUISITION_AMOUNT',
avalue => RequisitionAmount );
-Wf_Engine.SetItemAttrText (itemtype => itemtype,
itemkey => itemkey,
aname => 'REQUESTOR_USERNAME',
avalue => RequestorUsername);
Wf_Engine.SetItemOwner ( itemtype => itemtype,
itemkey => itemkey,
owner => ProcessOwner );
-Wf_Engine.StartProcess( itemtype => itemtype,
itemkey => itemkey );
EXCEPTION
WHEN OTHERS THEN
--

Wf_Core.context
('WF_REQDEMO','StartProcess',RequisitionNumber,RequisitionAmount,
RequestorUsername,ProcessOwner,Workflowprocess);
RAISE;
-END Req_App_Process;
========================================================================

Various PL/SQL APIs exist for the working of Oracle


Workflow:

WF_ENGINE
WF_CORE
WF_PURGE
WF_MONITOR
WF_QUEUE
WF_NOTIFICATIONS

WF_ENGINE : The state of a workflow item is defined by the various states of all activities that are part of the process for that item. The
engine changes activity states in response to an API call to update the activity family of calls.The Workflow Engine APIs can be called by an
application program or a workflow function in the runtime phase to communicate with the engine and to change the status of each of the
activities. These APIs are defined in a PL/SQL package called WF_ENGINE.
These APIs are defined in a PL/SQL package called WF_ENGINE :
* SetItemAttrText, SetItemAttrNumber, SetItemAttrDate
Used for setting a text/number/Date attribute value of a workflow instance.
* GetItemAttrText => Used for getting a text attributr value of a workflow instance.
* CreateProcess => Create a new runtime process for an application item.
* SetitemUserKey
* GetItemUserKey
* Background => Runs a background engine for processing deferred and/or timed out activities using the parameters specified.
* SetItemOwner
* StartProcess
* LaunchProcess.
WF_CORE :
PL/SQL procedures called by function activities can use a set of core Oracle Workflow APIs to raise and catch errors.When a PL/SQL
procedure called by a function activity either raises an unhandled exception, or returns a result beginning with 'ERROR:, the Workflow
Engine sets the function activitys status to ERROR and sets the columns ERROR_NAME, ERROR_MESSAGE, and ERROR_STACK in the
table WF_ITEM_ACTIVITY_STATUSES to reflect the error.The columns ERROR_NAME and ERROR_MESSAGE get set to either the
values returned by a call to WF_CORE.RAISE( ), or to the SQL error name and message if no call to RAISE( ) is found. The column
ERROR_STACK gets set to the contents set by a call to WF_CORE.CONTEXT( ), regardless of the error source.
WF_CORE Procedures :
CLEAR
GET_ERROR
TOKEN
RAISE
CONTEXT
TRANSLATE
WF_PURGE : WF_PURGE can be used to purge obsolete runtime data for completed items and processes, and to purge information for
obsolete activity versions that are no longer in use. One may want to periodically purge this obsolete data from your system to increase
performance.
WF_PURGE Procedures :

Items
Activities
Notifications
Total
TotalPERM
The WF_USER_ROLES view is an intersection of the users and roles in WF_USERS and WF_ROLES:
User_Name
User_Orig_System
User_Orig_System_id
Role_Name
Role_Orig_System
Role_Orig_System_id
WF_ITEM_TYPES : It stores all the Item_type definitions
NAME
PROTECT_LEVEL
CUSTOM_LEVEL
PERSISTENCE_TYPE
PERSISTENCE_DAYS
WF_SELECTOR
WF_ITEM_ATTRIBUTES : The WF_ITEM_ATTRIBUTES table stores definitions of attributes associated with a process. Each row includes
the sequence in which the attribute is used as well as the format of the attribute data.
ITEM_TYPE
NAME
SEQUENCE
TYPE
PROTECT_LEVEL
CUSTOM_LEVEL
SUBTYPE
FORMAT
WF_ITEMS : WF_ITEMS is the runtime table for workflow processes. Each row defines one work item within the system.
ITEM_TYPE
ITEM_KEY
ROOT_ACTIVITY
OWNER_ROLE
PARENT_ITEM_TYPE
PARENT_ITEM_KEY
BEGIN_DATE
END_DATE
USER_KEY
WF_PROCESS_ACTIVITIES : WF_PROCESS_ACTIVITIES stores the data for an activity within a specific process. A process activity is a
Modeled workflow process, which can be included as an activity in other processes to represent a subprocess
PROCESS_ITEM_TYPE
PROCESS_NAME
PROCESS_VERSION
ACTIVITY_ITEM_TYPE
ACTIVITY_NAME
WF_ACTIVITIES : WF_ACTIVITIES table stores the definition of an activity.
ITEM_TYPE , NAME , VERSION , TYPE , RERUN , EXPAND_ROLE,
PROTECT_LEVEL , CUSTOM_LEVEL , BEGIN_DATE , END_DATE
WF_ITEM_TYPES : It stores all the Item_type definitions
NAME
PROTECT_LEVEL
CUSTOM_LEVEL
PERSISTENCE_TYPE
PERSISTENCE_DAYS
WF_SELECTOR
WF_LOOKUPS -Workflow Lookups.
WF_LOOKUP_TYPES -Workflow lookup types.
WF_MESSAGES - Messages which r sent as notifications
WF_MESSAGE_ATRIBUTES : Message attributes(additional info to be sent to or received from an individual via notifications)
WF_NOTIFICATIONS , WF_NOTIFICATIONS_ATTRIBUTES.
Views Used in Workflow : Workflow uses views for effective querying of data. These views are de-normalized so as to provide a faster

access to data over networks.Some of the important views are:


WF_ITEMS_V
WF_ITEM_ACTIVITY_STATUSES_V : WorkFlow Process activity results & error information.
WF_NOTIFICATIONS_VIEWS
WF_ROLES : Contains information on the roles of which users can be members like Role Name,Description,Language and territory.
WF_USERS : Contains Information on the user names, display names for the users, their notification preference and their e-mail addresses.
WF_USER_ROLES : Contains information on the association of the users to the roles.
Posted by Nilesh P at 2:25 PM No comments: Links to this post
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: Oracle WorkFlow

WHAT DOES ORACLE WORKFLOW COMPRISE OF?


WHAT DOES ORACLE WORKFLOW COMPRISE OF?
Processes (Item Types)
Item Type: A grouping of workflow components. All components of a workflow process must be associated with a specific item type. A set of
rules which determine how the business methodology is to be routed.
Item Type : A grouping of all items of a category that share the same set of attributes For e.g.: PO Requisition is an Item Type used to group
all PO requisitions created. It is like say Class in Java
Item : A specific process or transaction managed by WF process. Like instance of a class is Object.A specific run of Leave request Process
will be reffered to as Item.
Attributes : These are the various input or output variables that are needed by the business process.Text,Attribute ,Date
,URL,Number,Lookup,Form are some of the attribute types.Lookup
Type: List of values that can be referenced by any component.
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. These are the actions performed during the business process
Function Activity: Automated unit of work defined as a PL/SQL stored procedure.
Notification Activity: Activity that sends a message to a performer.
Node : An instance of an activity in a process diagram.
Notification : An instance of a message delivered to a user.
Message: The message may request the performer, the role receiving the message, to do some work or may simply provide information.
Each notification carries a message with it which is the actual text of the notification.
Performer : A user/role assigned to perform a particular (human) activity. Generally, assigned to a notification.
Role : One or more users grouped by a common responsibility or position.
Lookup type :A predefined list of values used to interact with users or define the results of an
activity.
Lookup Code : An internal name of a value defined in lookup type.
Result Type :The name of the lookup type that contains an activitys possible result values.
Timeout : The amount of time during which a notification activity must be performed before the WF engine transitions to an alternate activity
(if defined) or error process.
Transition:The relationship between completion of one activity and initialization of another activity. (Arrows)
Access Level : A numeric value ranging from 0 1000 defining at which level the user operates and whether user can modify the workflow
definition.
Protection Level :A numeric value ranging from 0 1000 that represents who the workflow definition is protected from for modification
Access levels and Protection levels work in collaboration to decide who can modify what in an Oracle Workflow.
Process Activity : A Process activity represents a collection of activities in relationship. When a Process Activity is contained in another
process it is called a sub-process.In other words, activities in a process can also be process themselves.
PERSISTENCE TYPE : Permanent , Temporary and Synchronous
When you define an item type, you must also specify its persistence type.The persistence type controls how long a status audit trail is
maintained for each instance of the item type.
If you set Persistence to Permanent, the runtime status information indifinitely until you specifically purge the information by calling the
procedure WF_PURGE.TotalPerm().
If you set an item type's Persistence to Temporary, you must also specify the number of days of persistence.The status audit trail for each
instance of a temporary item type is maintained for at least 'n' days of persistence after its completion date.After the 'n' days of persistence,

you can then use any of the WF_PURGE API's to purge the item type's runtime status information.
EVENTS : A business event is an occurrence in an internet or intranet application or program thay might be 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.
The Workflow Engine traps errors produced by function activities by setting a savepoint before each function .If an activity produces an
unhandled exception, the engine performs a rollback to the savepoint, and sets the activity to the ERROR status.The Workflow Engine never
issues a commit as it is the responsibility of the calling application to commit.
Posted by Nilesh P at 2:18 PM No comments: Links to this post
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: Oracle WorkFlow

What are Components of Oracle Workflow :


Components of Oracle Workflow :
Workflow Builder
Workflow Engine
Workflow Definitions Loader
Notification Systems
Workflow Monitor
Notification systems
Business Event System's
Workflow XML Loader
Directory Service's.
Workflow Builder :Work Flow builder is a Graphical interface to create and modify a business process with simple drag and drop
operations.
It has two components * Navigator Window
* Process Window
A workflow builder would be used by a person to design and modify a workflow. It is more of a designers tool rather than an end-users tool.
Workflow Engine : The Workflow Engine embedded in the Oracle8 server 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 flexiblydefined workflow rules, the engine determines which activities are eligible to run, and then runs them. The Workflow
Engine supports sophisticated workflow rules, including looping, branching,parallel flows, and sub-flows.
Workflow Definitions Loader :The Workflow Definitions Loader is a utility program that moves workflow definitions between database and
corresponding flat file representations.It allows opening and saving workflow definitions in both a database and file.
Notification System : Each notification includes a message that contains all the information a user needs to make a decision.
Workflow Monitor : The Workflow Monitor displays an annotated view of the process diagram for a particular instance of a workflow
process.Users can get a graphical depiction of their work item status. It also displays a separate status summary for the work item, the
process, and each activity in the process.
Posted by Nilesh P at 2:15 PM No comments: Links to this post
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: Oracle WorkFlow

What is Workflow :
Training in Oracle WorkFlow :
Processes that involve multiple users and the routing of data between the users are termed as 'WORKFLOW'.
What are Workflow Components: Workflow typically consist of 4 Rs
Rules : Rules are your company's business practices captured in software. Rules determine what activities are required to process your
business data.
Roles : Roles describe how people fit into the workflow. A role is a class of users who perform the same type of work, such as clerks or
managers. Your business rules typically specify what user role needs to do a specific activity. Roles allow work to be directed to Types of
people than individuals hence allow flexible and easier to manitain Workflows.
Routings : Routings connect the activities in the workflow. They are the system's means of moving information from one place to another,
from one step to the next. Routings specify where the information goes and what form it takesbased on results at decision point or
responses to email message or completion of activity. Routings bring the flow into workflow. They get the right information to the right people
at the right time, enabling users to work together to accomplish the company's goals.
Real Time : Real Time means Workflow should be able escalate an activity to next level action or role in case a certain activity is not
executed in specific time, for example if the Department Manager doesnt approve or reject the leave request within 48 hrs then it should be
escalated to VP-HR.
WHAT CAN WORKFLOW DO : Routes information to various users based on certain rules. Tracks the responses from the users and

takes actions accordingly. Enables people to receive E-Mail notifications Allows incorporation of custom packages and procedures E-Mail
integration of choice. Internet enabled workflow allows you to view Workflow notifications through any Internet browser. One can also
monitor the processes through a browser.

Das könnte Ihnen auch gefallen