Oracle Workflow Developer's Guide Release 2.6.3 Part Number B10284-02 |
![]() |
![]() |
![]() |
![]() |
![]() |
||
Previous | Next | Contents | Index | Glossary |
To examine StartProcess in more detail, we divide the procedure into several sections and number each section with the notation 1-> for easy referencing. The numbers and arrows themselves are not part of the procedure.
1-> procedure StartProcess (RequisitionNumber 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
2-> ItemType varchar2(30) := nvl(item_type, 'WFDEMO');
ItemKey varchar2(30) := RequisitionNumber;
ItemUserKey varchar2(80) := RequisitionDesc;
3-> begin
wf_engine.CreateProcess (itemtype => ItemType,
itemkey => ItemKey,
process => WorkflowProcess );
4-> wf_engine.SetItemUserKey (itemtype => itemtype,
itemkey => itemkey,
userkey => ItemUserKey);
5-> wf_engine.SetItemAttrText (itemtype => itemtype,
itemkey => itemkey,
aname => 'REQUISITION_NUMBER',
avalue => RequisitionNumber);
6-> wf_engine.SetItemAttrText (itemtype => itemtype,
itemkey => itemkey,
aname => 'REQUISITION_DESCRIPTION',
avalue => ItemUserKey);
7-> wf_engine.SetItemAttrNumber (itemtype => itemtype,
itemkey => itemkey,
aname => 'REQUISITION_AMOUNT',
avalue => RequisitionAmount);
8-> wf_engine.SetItemAttrText (itemtype => itemtype,
itemkey => itemkey,
aname => 'REQUESTOR_USERNAME',
avalue => RequestorUsername);
9-> wf_engine.SetItemAttrText (itemtype => itemtype,
itemkey => itemkey,
aname => 'FORWARD_TO_USERNAME',
avalue => RequestorUsername);
10-> wf_engine.SetItemAttrText (itemtype => itemtype,
itemkey => itemkey,
aname => 'REQUISITION_PROCESS_OWNER',
avalue => ProcessOwner);
11-> wf_engine.SetItemAttrText (itemtype => itemtype,
itemkey => itemkey,
aname => 'MONITOR_URL',
avalue => wf_monitor.GetDiagramUrl
(WF_CORE.Translate('WF_WEB_AGENT'),
itemtype,itemkey,'NO'));
12-> wf_engine.SetItemAttrText (itemtype => itemtype,
itemkey => itemkey,
aname => 'REM_DOCUMENT',
avalue => 'PLSQL:wf_reqdemo.
reminder_req_document/'
||ItemType||':'||ItemKey);
13-> wf_engine.SetItemOwner (itemtype => itemtype,
itemkey => itemkey,
owner => ProcessOwner);
14-> wf_engine.StartProcess (itemtype => itemtype,
itemkey => itemkey );
15-> exception
when others then
wf_core.context('WF_REQDEMO','StartProcess',RequisitionNumber,
RequisitionAmount,RequestorUsername,ProcessOwner,
Workflowprocess);
raise;
16-> end StartProcess;
1-> This section represents the specification of the procedure, which includes the list of parameters that must be passed to StartProcess. It uses the same parameter values that you pass to the wfrund.sql script or to the field values entered in the Requisition Demonstration web page (WF_REQDEMO.Create_Req).
2-> The declarative part of the procedure body begins in this section. StartProcess consists of calls to various Workflow Engine PL/SQL APIs. See: Workflow Engine APIs, Oracle Workflow API Reference.
Since all of these APIs require an item type and item key input, we define ItemType and ItemKey as local arguments. The argument ItemType is defined as 'WFDEMO', which is the internal name for the Requisition item type. The argument ItemKey is the value of the RequisitionNumber parameter that is passed to the StartProcess procedure.
Note: The item key for a process instance can only contain single-byte characters. It cannot contain a multibyte value.
3-> The executable part of the procedure body begins here. This section calls the CreateProcess Workflow Engine API. This API creates a new runtime instance of the Requisition process, whose internal name is 'WFDEMO', and the new instance is identified by the item type and item key that are supplied. See: CreateProcess, Oracle Workflow API Reference.
Note: If you do not pass a value for <process_int_name> to the wfrund.sql script, the selector function for the Requisition item type determines what process to run.
4-> This section calls the SetItemUserKey Workflow Engine API to mark the new runtime instance of the Requisition process with an end-user key. The end-user key makes it easier for users to query and identify the process instance when it is displayed. See: SetItemUserKey, Oracle Workflow API Reference.
5, 6, 7, 8, 9, 10, 11, and 12 -> These sections call either the SetItemAttributeText or SetItemAttributeNumber Workflow Engine APIs to set values for the item type attributes defined for this process. The attributes are REQUISITION_NUMBER, REQUISITION_DESCRIPTION, REQUISITION_AMOUNT, REQUESTOR_USERNAME, FORWARD_TO_USERNAME, REQUISITION_PROCESS_OWNER, MONITOR_URL, and REM_DOCUMENT. See: SetItemAttribute, Oracle Workflow API Reference.
13-> This section calls the SetItemOwner Workflow Engine API to mark the new runtime instance of the Requisition process with a process owner user name. Users can query for process instances by process owner. See: SetItemOwner, Oracle Workflow API Reference.
14-> This section calls WF_CORE.CONTEXT( ) if an exception occurs, to include context information in the error stack to help you locate the source of an error. See: CONTEXT, Oracle Workflow API Reference.
15-> This section calls the Oracle Workflow Engine StartProcess API to invoke the Requisition process for the item type and item key specified. See: StartProcess, Oracle Workflow API Reference.
16-> This section marks the end of the procedure.
Previous | Next | Contents | Index | Glossary |