`
hongsoft
  • 浏览: 292749 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

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>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics