code: public ProcessInstance getProcessInstance() {
      Execution execution = getExecution();
      if(execution != null && !(execution.getProcessInstanceId().equals(execution.getId()))){
        return processEngine
              .getRuntimeService()
              .createProcessInstanceQuery()
              .processInstanceId(execution.getProcessInstanceId())
              .singleResult();
      }
      return (ProcessInstance) execution;
    }
docs: Returns the {@link ProcessInstance} currently associated or 'null'
  
  @throws ProcessEngineCdiException
  if no {@link Execution} is associated. Use
  {@link #isAssociated()} to check whether an association exists.