private void connectProcessInstanceToRuntimeAndProcess ( ProcessInstance processInstance , Object streamContext ) { ProcessInstanceImpl processInstanceImpl = ( ProcessInstanceImpl ) processInstance ; InternalKnowledgeRuntime kruntime = processInstanceImpl . getKnowledgeRuntime ( ) ; // Attach the kruntime if not present if ( kruntime == null ) { kruntime = retrieveKnowledgeRuntime ( streamContext ) ; processInstanceImpl . setKnowledgeRuntime ( kruntime ) ; } // Attach the process if not present if ( processInstance . getProcess ( ) == null ) { String processId = processInstance . getProcessId ( ) ; if ( processId != null ) { Process process = kruntime . getKieBase ( ) . getProcess ( processId ) ; if ( process != null ) { processInstanceImpl . setProcess ( process ) ; } } } }
Fill the process instance . kruntime and . process fields with the appropriate values .