use of org.jbpm.services.api.ProcessInstanceNotFoundException in project jbpm by kiegroup.
the class ProcessInstanceAdminServiceImpl method triggerNode.
@Override
public void triggerNode(long processInstanceId, long nodeId) throws NodeNotFoundException, ProcessInstanceNotFoundException {
ProcessInstanceDesc pi = runtimeDataService.getProcessInstanceById(processInstanceId);
if (pi == null) {
throw new ProcessInstanceNotFoundException("Process instance with id " + processInstanceId + " not found");
}
processService.execute(pi.getDeploymentId(), ProcessInstanceIdContext.get(processInstanceId), new TriggerNodeCommand(processInstanceId, nodeId));
}
use of org.jbpm.services.api.ProcessInstanceNotFoundException in project jbpm by kiegroup.
the class ProcessInstanceAdminServiceImpl method retriggerNodeInstance.
@Override
public void retriggerNodeInstance(long processInstanceId, long nodeInstanceId) throws NodeInstanceNotFoundException, ProcessInstanceNotFoundException {
ProcessInstanceDesc pi = runtimeDataService.getProcessInstanceById(processInstanceId);
if (pi == null) {
throw new ProcessInstanceNotFoundException("Process instance with id " + processInstanceId + " not found");
}
processService.execute(pi.getDeploymentId(), ProcessInstanceIdContext.get(processInstanceId), new RetriggerNodeInstanceCommand(processInstanceId, nodeInstanceId));
}
use of org.jbpm.services.api.ProcessInstanceNotFoundException in project jbpm by kiegroup.
the class ProcessInstanceAdminServiceImpl method getTimerInstances.
@Override
public Collection<TimerInstance> getTimerInstances(long processInstanceId) throws ProcessInstanceNotFoundException {
ProcessInstanceDesc pi = runtimeDataService.getProcessInstanceById(processInstanceId);
if (pi == null) {
throw new ProcessInstanceNotFoundException("Process instance with id " + processInstanceId + " not found");
}
Collection<TimerInstance> timers = processService.execute(pi.getDeploymentId(), ProcessInstanceIdContext.get(processInstanceId), new ListTimersCommand(processInstanceId));
return timers;
}
use of org.jbpm.services.api.ProcessInstanceNotFoundException in project jbpm by kiegroup.
the class ListTimersCommand method execute.
public List<TimerInstance> execute(Context context) {
List<TimerInstance> timers = new ArrayList<TimerInstance>();
KieSession kieSession = ((RegistryContext) context).lookup(KieSession.class);
TimerManager tm = getTimerManager(kieSession);
RuleFlowProcessInstance wfp = (RuleFlowProcessInstance) kieSession.getProcessInstance(processInstanceId, true);
if (wfp == null) {
throw new ProcessInstanceNotFoundException("No process instance can be found for id " + processInstanceId);
}
processNodeInstance(tm, wfp, timers);
return timers;
}
use of org.jbpm.services.api.ProcessInstanceNotFoundException in project jbpm by kiegroup.
the class RetriggerNodeInstanceCommand method execute.
public Void execute(Context context) {
KieSession kieSession = ((RegistryContext) context).lookup(KieSession.class);
logger.debug("About to retrigger node instance with id {} on process instance {}", nodeInstanceId, processInstanceId);
RuleFlowProcessInstance wfp = (RuleFlowProcessInstance) kieSession.getProcessInstance(processInstanceId, false);
if (wfp == null) {
throw new ProcessInstanceNotFoundException("Process instance with id " + processInstanceId + " not found");
}
NodeInstance nodeInstance = wfp.getNodeInstances(true).stream().filter(ni -> ni.getId() == nodeInstanceId).findFirst().orElse(null);
if (nodeInstance == null) {
throw new NodeInstanceNotFoundException("Node instance with id " + nodeInstanceId + " not found");
}
logger.debug("Found node instance {} to be retriggered", nodeInstance);
((NodeInstanceImpl) nodeInstance).retrigger(true);
logger.debug("Node instance {} retriggered successfully", nodeInstance);
return null;
}
Aggregations