Previous | Next | Contents | Index | Glossary | Library |
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 => 'REQUESTOR_DISPLAY_NAME', | |||||||
avalue => wf_directory.GetRoleDisplayName(RequestorUsername)); | |||||||
10-> | wf_engine.SetItemAttrText | (itemtype => itemtype, | |||||
itemkey => itemkey, | |||||||
aname => 'FORWARD_TO_USERNAME', | |||||||
avalue => RequestorUsername); | |||||||
11-> | wf_engine.SetItemAttrText | (itemtype => itemtype, | |||||
itemkey => itemkey, | |||||||
aname => 'FORWARD_TO_DISPLAY_NAME', | |||||||
avalue => wf_directory.GetRoleDisplayName(RequestorUsername)); | |||||||
12-> | wf_engine.SetItemAttrText | (itemtype => itemtype, | |||||
itemkey => itemkey, | |||||||
aname => 'REQUISITION_PROCESS_OWNER', | |||||||
avalue => ProcessOwner); | |||||||
13-> | wf_engine.SetItemAttrText | (itemtype => itemtype, | |||||
itemkey => itemkey, | |||||||
aname => 'MONITOR_URL', | |||||||
avalue => wf_monitor.GetUrl (wf_core.translate('WF_WEB_AGENT'), itemtype, itemkey, 'NO')); | |||||||
14-> | wf_engine.SetItemOwner | (itemtype => itemtype, | |||||
itemkey => itemkey, | |||||||
owner => ProcessOwner); | |||||||
15-> | wf_engine.StartProcess | (itemtype => itemtype, | |||||
itemkey => itemkey ); | |||||||
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 wfrundemo.sql script or to the field values entered in the Requisition Approval 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 Workflow Demonstration 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 Approval 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 wfrundemo.sql script, the selector function for the Workflow Demonstration 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 Approval 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 API's to set values for the item type attributes defined for this process. The attributes are REQUISITION_NUMBER, REQUISITION_DESCRIPTION, REQUISITION_AMOUNT, REQUESTOR_NAME, REQUESTOR_DISPLAY_NAME, FORWARD_TO_USERNAME, FORWARD_TO_DISPLAY_NAME, REQUISITION_PROCESS_OWNER, and MONITOR_URL, respectively. See: SetItemAttribute.
14-> This section calls the SetItemOwner Workflow Engine API to mark the new runtime instance of the Requisition Approval 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 Approval process for the item type and item key specified. See: StartProcess.
Previous | Next | Contents | Index | Glossary | Library |