shark接口1分析(三)--resume流程

Shark流程resume过程<o:p></o:p>

1) 得到执行管理器接口<o:p></o:p>

ExecutionAdministration ea= Shark.getInstance().getAdminInterface()..getExecutionAdministration();<o:p></o:p>

2) 连接工作流服务器<o:p></o:p>

 ea.connect(username, password, enginename, scope);<o:p></o:p>

3) 用流程实例号获取流程<o:p></o:p>

 WfProcess wfp = ea.getProcess(processInsKey);<o:p></o:p>

4) resume流程<o:p></o:p>

 wfp.resume();<o:p></o:p>

 下面是resume操作的具体分析<o:p></o:p>

 //没有挂起的流程不能resume<o:p></o:p>

 if (!state(t).equals(SharkConstants.STATE_OPEN_NOT_RUNNING_SUSPENDED)) {<o:p></o:p>

 throw new NotSuspended("The process is not suspended");<o:p></o:p>

 }<o:p></o:p>

 //源代码中的说明: if this is a subflow process of suspended activity, and it is executed as SYNCHRONOUS, do not allow process to resume<o:p></o:p>

 WfRequesterInternal requester=getRequester(t);<o:p></o:p>

 if (requester!=null && (requester instanceof WfActivityInternal)) {<o:p></o:p>

 WfActivityInternal waImpl=(WfActivityInternal)requester;<o:p></o:p>

 if (waImpl.state(t).equals(SharkConstants.STATE_OPEN_NOT_RUNNING_SUSPENDED)) {<o:p></o:p>

 // Determine subflow type<o:p></o:p>

 if (XPDLUtilities.isSubflowSynchronous(SharkUtilities.getActivityDefinition(t,waImpl,getProcessDefinition(t)))) {<o:p></o:p>

 SharkEngineManager.getInstance().getCallbackUtilities().error("Process"+toString()+" - Cannot resume because the requester activity is suspended");<o:p></o:p>

 throw new CannotResume("Cannot resume - The requester activity is suspended");<o:p></o:p>

 }<o:p></o:p>

 }<o:p></o:p>

 }<o:p></o:p>

 //改变状态<o:p></o:p>

 change_state(t, SharkConstants.STATE_OPEN_RUNNING);<o:p></o:p>

 //把所有的活动都resume<o:p></o:p>

 Iterator it=getActiveActivities(t).iterator();<o:p></o:p>

 while (it.hasNext()) {<o:p></o:p>

 WfActivityInternal act=(WfActivityInternal)it.next();<o:p></o:p>

if (act.state(t).equals(SharkConstants.STATE_OPEN_NOT_RUNNING_SUSPENDED)) {<o:p></o:p>

 act.resume(t);<o:p></o:p>

 }<o:p></o:p>

 }<o:p></o:p>

5) 断开连接<o:p></o:p>

 ea.disconnect();<o:p></o:p>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值