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

shark接口1分析(二)--suspend流程

阅读更多

<!----><o:p> </o:p>

Shark流程挂起过程<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) 挂起流程<o:p></o:p>

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

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

    //状态不能是已经挂起<o:p></o:p>

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

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

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

    //运行中的流程才能挂起<o:p></o:p>

      if (state(t).startsWith(SharkConstants.STATEPREFIX_OPEN_NOT_RUNNING)) {<o:p></o:p>

         throw new NotRunning("The process is not in the running state");<o:p></o:p>

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

      try {<o:p></o:p>

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

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

<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>

    //对每个活动都做同样的操作<o:p></o:p>

            if (act.state(t).startsWith(SharkConstants.STATEPREFIX_OPEN)) {<o:p></o:p>

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

            }<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