使用 wf_notification.respond 来完成消息的批准,转发,拒绝等操作。
这种方法只适用于对消息节点的操作。
它的好处是会完整地按照如下funcmode 顺序重复调用审批函数:
a. VALIDATE
b. RESPOND
c. CANCEL
d. RUN
而WF_ENGINE.COMPLETEACTIVITY的funcmode 永远是 RUN .
对funcmode 做一下解释:
以下是Oracle给出的标准工作流函数的格式:
(1) procedure
(itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
resultout out varchar2) is
(2)(3) begin
if ( funcmode = 'RUN' ) then
resultout := 'COMPLETE:';
return;
end if;
(4) if ( funcmode = 'CANCEL' ) then
resultout := 'COMPLETE';
return;
end if;
(5) if ( funcmode = 'SKIP' ) then
resultout := 'COMPLETE:';
return;
end if;
(6) if ( funcmode = 'RETRY' ) then
resultout := 'COMPLETE:';
return;
end if;
(7) if ( funcmode = 'VALIDATE' ) then
resultout := 'COMPLETE';
return;
end if;
(8) if ( funcmode = 'RESPOND' ) then
resultout := 'COMPLETE';
return;
end if;
(9) if ( funcmode = 'FORWARD' ) then
resultout := 'COMPLETE';
return;
end if;
(10) if ( funcmode = 'TRANSFER' ) then
resultout := 'COMPLETE';
return;
end if;
(11) if ( funcmode = 'QUESTION' ) then
resultout := 'COMPLETE';
return;
6-4 Oracle Workflow Developer's Guide
end if;
(12) if ( funcmode = 'ANSWER' ) then
resultout := 'COMPLETE';
return;
end if;
(13) if ( funcmode = 'TIMEOUT' ) then
if () then
resultout := 'COMPLETE';
else
resultout := wf_engine.eng_timedout;
end if;
return;
end if;
(14) if ( funcmode = '' ) then
resultout := ' ';
return;
end if;
(15) exception
when others then
WF_CORE.CONTEXT ('', '',
, ,
to_char(), );
raise;
(16) end ;
可以看到,工作流函数会根据funcmode 不同做出不同的响应。
当使用WF_ENGINE.COMPLETEACTIVITY的时候,调用函数的funcmode值永远是RUN.
当使用 wf_notification.respond的时候,工作流会重复调用4次函数,funcmode 分别为 VALIDATE,RESPOND,CANCEL,RUN.以便完全执行工作流函数的每一部分。
其他funcmode是什么情况传入,还不清楚,欢迎补充。
wf_notification.respond的函数原型
procedure Respond(nid in number, --notice id,通知id
respond_comment in varchar2, --完成通知附注
responder in varchar2,--通知回复人
action_source in varchar2)--Source from where the action is performed
举例:
BEGIN
wf_notification.SetAttrText(10399,'RESULT','REJECTED'); --设置notice id 为10399的消息的审批意见为拒绝
wf_notification.respond(10399
,null
,'刘斌'
,null);
END;