后台事务自动跳转工作流节点
2012-06-16 23:37
429 查看
在facade增加方法jumpWF4PaymentOrder,然后在后台事务定义增加.
示例:流程名称为 付款单HTH 有个时间等待节点,该节点执行日期为9999年12月12日(意思是让流程永远停留在时间等待节点),当发现外部环境变化,需要跳转到时间等待节点的下一个节点时,采用如下代码-----
示例:流程名称为 付款单HTH 有个时间等待节点,该节点执行日期为9999年12月12日(意思是让流程永远停留在时间等待节点),当发现外部环境变化,需要跳转到时间等待节点的下一个节点时,采用如下代码-----
/** * 跳转 */ protected void _jumpWF4PaymentOrder(Context ctx) throws BOSException,EASBizException { IEnactmentService iService = EnactmentServiceFactory.createEnactService(ctx); String procSql = "select FPROCDEFHASH,FPROCINSTID from T_WFR_ProcInst " + "where fpprocdefname_l2 ='付款单HTH' and fstate='open.running' "; IRowSet procRs = DbUtil.executeQuery(ctx, procSql); try{ while(procRs.next()){ String procDefHash = procRs.getString("FPROCDEFHASH"); String procInstId = procRs.getString("FPROCINSTID"); String actSql = "SELECT FACTDEFNAME_l2 actDefName,FACTDEFID,FACTINSTID FROM T_WFR_ActInst WHERE FPROCINSTID='"+procInstId+"' and fstate='open.running'"; IRowSet actRs = DbUtil.executeQuery(ctx, actSql); if(actRs.next()){ String actDefName = actRs.getString("actDefName"); if(actDefName!=null && !actDefName.equals("等待")) continue; ProcessDef processDef = iService.getProcessDefByDefineHashValue(procDefHash); ActivityDef activityDef = processDef.getActivityDef(actRs.getString("FACTDEFID")); ActivityCollection actCol = activityDef.getPostActivities(); if (actCol.size() == 1){ ActivityDef scriptActDef = actCol.get(0); if (scriptActDef instanceof ScriptActivityDef){ try{ MyThread t = new MyThread(); t.procInstId = procInstId; t.scriptActDef = scriptActDef; t.ctx = ctx; if(procInstId==null)continue; if(scriptActDef==null)continue; t.start(); for(int ll = 0;ll <10;ll++) { if (t.state == true) { break; } Thread.sleep(1000); } if (t.state ==false) { //证明超时了,需要终止 t.interrupt(); } } catch (InterruptedException e) { e.printStackTrace(); } } } } } }catch (SQLException e) { e.printStackTrace(); } super._jumpWF4PaymentOrder(ctx); } class MyThread extends Thread { public boolean state = false; public Object procInstId = null; public ActivityDef scriptActDef = null; public Context ctx=null; public MyThread() { } public void run() { try { IEnactmentService iService = EnactmentServiceFactory.createEnactService(ctx); iService.jump(procInstId.toString(), scriptActDef); } catch(Exception ex) { ex.printStackTrace(); } state= true; } }
相关文章推荐
- 也谈一下Activiti工作流节点的自由跳转
- ecshop无法登录后台,密码是正确的,但会自动跳转到登录页,360浏览器的关系
- 也谈一下Activiti工作流节点的自由跳转
- 等待几秒后自动跳转(后台实现)
- 也谈一下Activiti工作流节点的自由跳转
- ecshop无法登录后台,密码是正确的,但会自动跳转到登录页,360浏览器的关系
- Activiti工作流节点的自由跳转
- 自动行政审批流程组件的审批流程节点定义【民间称为工作流组件、官方称为审批流程组件】
- Activiti工作流节点的自由跳转
- 自动行政审批流程组件的审批流程节点定义【民间称为工作流组件、官方称为审批流程组件】
- 高级工作流分支节点自动判断【经典案例】
- 自动行政审批流程组件的审批流程节点定义【民间称为工作流组件、官方称为审批流程组件】
- 自动行政审批流程组件的审批流程节点定义【民间称为工作流组件、官方称为审批流程组件】
- 自动行政审批流程组件的审批流程节点定义【民间称为工作流组件、官方称为审批流程组件】
- 【Activiti】跳转到工作流的任意节点(本例用跳转到上一节点讲解即流程回退)
- 页面自动跳转----后台传递url
- 自动行政审批流程组件的审批流程节点定义【民间称为工作流组件、官方称为审批流程组件】
- 自动行政审批流程组件的审批流程节点定义【民间称为工作流组件、官方称为审批流程组件】
- 自动行政审批流程组件的审批流程节点定义【民间称为工作流组件、官方称为审批流程组件】
- 自动行政审批流程组件的审批流程节点定义【民间称为工作流组件、官方称为审批流程组件】