TaskQuery for tasks of several processes

This should work:

        TaskQuery taskQuery = this.taskService.createTaskQuery();
        for (String subProcessId : processIds) {
            taskQuery = taskQuery.or().processInstanceId(subProcessId).endOr();            
        }
        List<Task> tasks = taskQuery.initializeFormKeys().list();

You need to or every single processInstanceId. Otherwise only the last value applied will be used, all valued applied before are overwritten.