Hello guys
Is it possible to set a process instance to 'complete' state even if it didn't reach the end event? In other words, can I explicitly stop an instance so that the instance stays in 'complete' state?
I'm trying to do this:
val processInstance = JBPMWorkflowEngine.kieSession.getProcessInstance(request.getProcessId.asInstanceOf[Long]).asInstanceOf[ProcessInstanceImpl]
if (processInstance!=null) {
processInstance.setState(JBPMProcessStatus.COMPLETED.id)
} else { //TODO: }
But I get this error:
java.lang.NullPointerException
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:305)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:334)
at pt.ptinovacao.asf.workflow.engines.jbpm.engine.JBPMWorkflowEngine.complete(JBPMWorkflowEngine.scala:589)