EntryIDSetSorter.java revision f0a048d41a13eca4cba405da9403c2469ca3d1ea
2556N/A * The contents of this file are subject to the terms of the 5218N/A * Common Development and Distribution License, Version 1.0 only 5250N/A * (the "License"). You may not use this file except in compliance 5218N/A * See the License for the specific language governing permissions 6280N/A * and limitations under the License. 2556N/A * When distributing Covered Code, include this CDDL HEADER in each 5218N/A * If applicable, add the following below this CDDL HEADER, with the 2556N/A * fields enclosed by brackets "[]" replaced with your own identifying 2556N/A * Portions Copyright [yyyy] [name of copyright owner] 5218N/A * Copyright 2008 Sun Microsystems, Inc. 5218N/A * Portions Copyright 2011-2015 ForgeRock AS * This class provides a mechanism for sorting the contents of an entry ID set * based on a given sort order. * Creates a new entry ID set which is a sorted representation of the provided * set using the given sort order. * @param suffixContainer The suffix container with which the ID list is associated. * @param entryIDSet The entry ID set to be sorted. * @param searchOperation The search operation being processed. * @param sortOrder The sort order to use for the entry ID set. * @param vlvRequest The VLV request control included in the search * request, or {@code null} if there was none. * @return A new entry ID set which is a sorted representation of the * provided set using the given sort order. * @throws DirectoryException If an error occurs while performing the sort. // See if there is a VLV request to further pare down the set of results, // and if there is where it should be processed by offset or assertion value. // The client specified a negative target offset. This should never be allowed. // This is an easy mistake to make, since VLV offsets start at 1 // instead of 0. We'll assume the client meant to use 1. // This can happen if beforeCount >= offset, and in this case we'll // just adjust the start position to ignore the range of beforeCount // The start position is beyond the end of the list. In this case, // we'll assume that the start position was one greater than the // size of the list and will only return the beforeCount entries. // We don't have enough entries in the set to meet the requested // page size, so we'll need to shorten the array. // No entry was found to be greater than or equal to the sort key, so // the target offset will be one greater than the content count.