@Override
  protected void ensureVariablesInitialized() {
    super.ensureVariablesInitialized();

    for (ProcessInstanceQueryImpl orQueryObject : orQueryObjects) {
      orQueryObject.ensureVariablesInitialized();
    }
  }
  public List<ProcessInstance> executeList(CommandContext commandContext, Page page) {
    checkQueryOk();
    ensureVariablesInitialized();
    List<ProcessInstance> processInstances = null;
    if (includeProcessVariables) {
      processInstances =
          commandContext
              .getExecutionEntityManager()
              .findProcessInstanceAndVariablesByQueryCriteria(this);
    } else {
      processInstances =
          commandContext.getExecutionEntityManager().findProcessInstanceByQueryCriteria(this);
    }

    for (ProcessInstance processInstance : processInstances) {
      localize(processInstance);
    }

    return processInstances;
  }
 public long executeCount(CommandContext commandContext) {
   checkQueryOk();
   ensureVariablesInitialized();
   return commandContext.getExecutionEntityManager().findProcessInstanceCountByQueryCriteria(this);
 }