Exemplo n.º 1
0
 public void interruptNotJudge(WorkflowContext context) {
   try {
     InstanceModel instance = getRuntimeService().getInstanceById(context.getInstanceId());
     if (instance.getStatus().longValue() == -9L) {
       return;
     }
     instance.setStatus(Long.valueOf("-9"));
     context.setExeTime(WFUtil.getSysTime());
     instance.setEndTime(context.getExeTime());
     getRuntimeService().updateInstance(instance);
     createActionHistory(instance.getInstanceId(), context);
   } catch (Exception ex) {
     logger.error(ex);
     throw new WorkflowException(ex);
   }
 }
Exemplo n.º 2
0
 private void _interrupt(WorkflowContext context) throws WorkflowException {
   try {
     InstanceModel instance = getRuntimeService().getInstanceById(context.getInstanceId());
     if (instance.getStatus().longValue() == -9L) {
       return;
     }
     if (instance.getStatus().longValue() == 9L) {
       throw new Exception("工作流实例已经结束,不能中止。");
     }
     instance.setStatus(Long.valueOf("-9"));
     instance.setEndTime(context.getExeTime());
     getRuntimeService().updateInstance(instance);
     createActionHistory(instance.getInstanceId(), context);
   } catch (Exception ex) {
     logger.error(ex);
     throw new WorkflowException(ex);
   }
 }