@Override
    public Collection<InternalType> retrieveObjects(ModeledAuthenticatedUser user,
            Collection<String> identifiers) throws GuacamoleException {

        // Ignore invalid identifiers
        List<String> filteredIdentifiers = filterIdentifiers(identifiers);

        // Do not query if no identifiers given
        if (filteredIdentifiers.isEmpty())
            return Collections.<InternalType>emptyList();

        int batchSize = environment.getBatchSize();

        boolean userIsPrivileged = user.isPrivileged();
        
        CaseSensitivity caseSensitivity = getCaseSensitivity();

        // Process the filteredIdentifiers in batches using Lists.partition() and flatMap
        Collection<ModelType> allObjects = Lists.partition(filteredIdentifiers, batchSize).stream()
                .flatMap(chunk -> {
                    Collection<ModelType> objects;

                    // Bypass permission checks if the user is privileged
                    if (userIsPrivileged)
                        objects = getObjectMapper().select(chunk, caseSensitivity);

                    // Otherwise only return explicitly readable identifiers
                    else
                        objects = getObjectMapper().selectReadable(user.getUser().getModel(),
                                chunk, user.getEffectiveUserGroups(), caseSensitivity);

                    return objects.stream();
                })
                .collect(Collectors.toList());

        // Return collection of requested objects
        return getObjectInstances(user, allObjects);
    }
Filters the given collection of strings, returning a new collection
containing only those strings which are valid identifiers. If no strings
within the collection are valid identifiers, the returned collection will
simply be empty.

@param identifiers
    The collection of strings to filter.

@return
    A new collection containing only the strings within the provided
    collection which are valid identifiers.
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/base/ModeledDirectoryObjectService.java