Oracle Workflow Guide Release 2.6.2 Part Number A95265-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(30) := 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.GetUrl
(wfa_html.base_url, itemtype,
itemkey, 'NO'));
12-> wf_engine.SetItemAttrText (itemtype => itemtype,
itemkey => itemkey,
aname => 'REQ_DOCUMENT',
avalue => 'PLSQL:
wf_reqdemo.create_req_document/'
||ItemType||':'||ItemKey);
13-> wf_engine.SetItemAttrText (itemtype => itemtype,
itemkey => itemkey,
aname => 'REM_DOCUMENT',
avalue => 'PLSQL:wf_reqdemo.
reminder_req_document/'
||ItemType||':'||ItemKey);
14-> wf_engine.SetItemOwner (itemtype => itemtype,
itemkey => itemkey,
owner => ProcessOwner);
15-> wf_engine.StartProcess (itemtype => itemtype,
itemkey => itemkey );
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.
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.
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 is identified by the item type and item key that is supplied. See: CreateProcess.
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.
5, 6, 7, 8, 9, 10, 11, 12, and 13-> 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_NAME, FORWARD_TO_USERNAME, REQUISITION_PROCESS_OWNER, MONITOR_URL, REQ_DOCUMENT, and REM_DOCUMENT, respectively. See: SetItemAttribute.
14-> 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.
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.
Previous | Next | Contents | Index | Glossary |