Shark流程resume过程
1) 得到执行管理器接口
ExecutionAdministration ea= Shark.getInstance().getAdminInterface()..getExecutionAdministration();
2) 连接工作流服务器
ea.connect(username, password, enginename, scope);
3) 用流程实例号获取流程
WfProcess wfp = ea.getProcess(processInsKey);
4) resume流程
wfp.resume();
下面是resume操作的具体分析
//没有挂起的流程不能resume
if (!state(t).equals(SharkConstants.STATE_OPEN_NOT_RUNNING_SUSPENDED)) {
throw new NotSuspended("The process is not suspended");
}
//源代码中的说明: if this is a subflow process of suspended activity, and it is executed as SYNCHRONOUS, do not allow process to resume
WfRequesterInternal requester=getRequester(t);
if (requester!=null && (requester instanceof WfActivityInternal)) {
WfActivityInternal waImpl=(WfActivityInternal)requester;
if (waImpl.state(t).equals(SharkConstants.STATE_OPEN_NOT_RUNNING_SUSPENDED)) {
// Determine subflow type
if (XPDLUtilities.isSubflowSynchronous(SharkUtilities.getActivityDefinition(t,waImpl,getProcessDefinition(t)))) {
SharkEngineManager.getInstance().getCallbackUtilities().error("Process"+toString()+" - Cannot resume because the requester activity is suspended");
throw new CannotResume("Cannot resume - The requester activity is suspended");
}
}
}
//改变状态
change_state(t, SharkConstants.STATE_OPEN_RUNNING);
//把所有的活动都resume
Iterator it=getActiveActivities(t).iterator();
while (it.hasNext()) {
WfActivityInternal act=(WfActivityInternal)it.next();
if (act.state(t).equals(SharkConstants.STATE_OPEN_NOT_RUNNING_SUSPENDED)) {
act.resume(t);
}
}
5) 断开连接
ea.disconnect();