}
public static void addDynamicSubProcess(
DynamicNodeInstance dynamicContext, KnowledgeRuntime ksession,
String processId, Map<String, Object> parameters) {
WorkflowProcessInstance processInstance = dynamicContext.getProcessInstance();
SubProcessNodeInstance subProcessNodeInstance = new SubProcessNodeInstance();
subProcessNodeInstance.setNodeInstanceContainer(dynamicContext);
subProcessNodeInstance.setProcessInstance(processInstance);
Process process = ksession.getKnowledgeBase().getProcess(processId);
if (process == null) {
System.err.println("Could not find process " + processId);
System.err.println("Aborting process");
processInstance.setState(ProcessInstance.STATE_ABORTED);
} else {
ProcessEventSupport eventSupport = ((InternalProcessRuntime)
((InternalKnowledgeRuntime) ksession).getProcessRuntime()).getProcessEventSupport();
eventSupport.fireBeforeNodeTriggered(subProcessNodeInstance, ksession);
ProcessInstance subProcessInstance = (ProcessInstance)