@GET
    public List<ExternalRecordType> getRecords(
            @QueryParam("contains") List<String> requiredContents,
            @QueryParam("order") List<APISortPredicate> sortPredicates)
            throws GuacamoleException {

        // Apply search/sort criteria
        applyCriteria(requiredContents, sortPredicates);
        
        // Convert record set to collection of API records
        List<ExternalRecordType> apiRecords = new ArrayList<>();
        for (InternalRecordType record : history.asCollection())
            apiRecords.add(toExternalRecord(record));

        // Return the converted history
        return apiRecords;

    }
Retrieves the list of activity records stored within the underlying
ActivityRecordSet which match the given, arbitrary criteria. If
specified, the returned records will also be sorted according to the
given sort predicates.

@param requiredContents
    The set of strings that each must occur somewhere within the
    returned records, whether within the associated username,
    the name of some associated object (such as a connection), or any
    associated date. If non-empty, any record not matching each of the
    strings within the collection will be excluded from the results.

@param sortPredicates
    A list of predicates to apply while sorting the resulting records,
    describing the properties involved and the sort order for those
    properties.

@return
    The list of records which match the provided criteria, optionally
    sorted as specified.

@throws GuacamoleException
    If an error occurs while applying the given filter criteria or
    sort predicates.
guacamole/src/main/java/org/apache/guacamole/rest/history/ActivityRecordSetResource.java