public ProcessInstance getProcessInstance(Long id) { JbpmContext context = Jbpm.instance().getJbpmConfiguration().createJbpmContext(); // log.debug("!!!!!!!!!!!!!!!!!!!!!!!!!: " + context); /* try { log.debug("!!!!!!!!!!!!!!!!!!!!!!!!!: " + context.getConnection().isClosed()); }catch(SQLException e) { e.printStackTrace(); } */ return context.getProcessInstance(id); }
/** Resume Process Instance */ public static void resumeProcessInstance(long processInstanceId) throws WorkflowException { log.debug("resumeProcessInstance({})", processInstanceId); JbpmContext jbpmContext = JBPMUtils.getConfig().createJbpmContext(); try { org.jbpm.graph.exe.ProcessInstance pi = jbpmContext.getProcessInstance(processInstanceId); pi.resume(); jbpmContext.getSession().flush(); } catch (JbpmException e) { throw new WorkflowException(e.getMessage(), e); } finally { jbpmContext.close(); } }
/** Delete Process Instance */ public static void deleteProcessInstanceVariable(long processInstanceId, String name) throws WorkflowException { log.debug("deleteProcessInstanceVariable({}, {})", new Object[] {processInstanceId, name}); JbpmContext jbpmContext = JBPMUtils.getConfig().createJbpmContext(); try { org.jbpm.graph.exe.ProcessInstance pi = jbpmContext.getProcessInstance(processInstanceId); pi.getContextInstance().deleteVariable(name); jbpmContext.getSession().flush(); } catch (JbpmException e) { throw new WorkflowException(e.getMessage(), e); } finally { jbpmContext.close(); } }