Search in sources :

Example 1 with ProcessNodeImpl

use of org.jbpm.kie.services.impl.admin.ProcessNodeImpl in project jbpm by kiegroup.

the class ListNodesCommand method execute.

public List<ProcessNode> execute(Context context) {
    List<ProcessNode> nodes = null;
    KieSession kieSession = ((RegistryContext) context).lookup(KieSession.class);
    RuleFlowProcessInstance wfp = (RuleFlowProcessInstance) kieSession.getProcessInstance(processInstanceId, true);
    if (wfp == null) {
        throw new ProcessInstanceNotFoundException("No process instance can be found for id " + processInstanceId);
    }
    String processId = wfp.getProcessId();
    nodes = wfp.getRuleFlowProcess().getNodesRecursively().stream().map(n -> new ProcessNodeImpl(n.getName(), n.getId(), n.getClass().getSimpleName(), processId)).collect(Collectors.toList());
    return nodes;
}
Also used : RuleFlowProcessInstance(org.jbpm.ruleflow.instance.RuleFlowProcessInstance) ProcessNodeImpl(org.jbpm.kie.services.impl.admin.ProcessNodeImpl) ProcessNode(org.jbpm.services.api.admin.ProcessNode) KieSession(org.kie.api.runtime.KieSession) RegistryContext(org.drools.core.command.impl.RegistryContext) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException)

Aggregations

RegistryContext (org.drools.core.command.impl.RegistryContext)1 ProcessNodeImpl (org.jbpm.kie.services.impl.admin.ProcessNodeImpl)1 RuleFlowProcessInstance (org.jbpm.ruleflow.instance.RuleFlowProcessInstance)1 ProcessInstanceNotFoundException (org.jbpm.services.api.ProcessInstanceNotFoundException)1 ProcessNode (org.jbpm.services.api.admin.ProcessNode)1 KieSession (org.kie.api.runtime.KieSession)1