Class ServerSideSortRequestControl


  • public class ServerSideSortRequestControl
    extends Control
    This class implements the server-side sort request control as defined in RFC 2891 section 1.1. The subclass ServerSideSortRequestControl.ClientRequest should be used when encoding this control from a sort order string. This is suitable for client tools that want to encode this control without a SortOrder object. The ASN.1 description for the control value is:

     SortKeyList ::= SEQUENCE OF SEQUENCE {
                attributeType   AttributeDescription,
                orderingRule    [0] MatchingRuleId OPTIONAL,
                reverseOrder    [1] BOOLEAN DEFAULT FALSE }
     
    • Constructor Detail

      • ServerSideSortRequestControl

        public ServerSideSortRequestControl​(String sortOrderString)
                                     throws LDAPException
        Creates a new server-side sort request control based on the definition in the provided sort order string.
        Parameters:
        sortOrderString - The string representation of the sort order to use for the control.
        Throws:
        LDAPException - If the provided sort order string could not be decoded.
      • ServerSideSortRequestControl

        public ServerSideSortRequestControl​(boolean isCritical,
                                            String sortOrderString)
                                     throws LDAPException
        Creates a new server-side sort request control based on the definition in the provided sort order string.
        Parameters:
        isCritical - Indicates whether support for this control should be considered a critical part of the server processing.
        sortOrderString - The string representation of the sort order to use for the control.
        Throws:
        LDAPException - If the provided sort order string could not be decoded.
      • ServerSideSortRequestControl

        public ServerSideSortRequestControl​(List<SortKey> sortKeys)
        Creates a new server-side sort request control based on the provided sort order.
        Parameters:
        sortKeys - The sort order to use for this control.
      • ServerSideSortRequestControl

        public ServerSideSortRequestControl​(boolean isCritical,
                                            List<SortKey> sortKeys)
        Creates a new server-side sort request control with the provided information.
        Parameters:
        isCritical - Indicates whether support for this control should be considered a critical part of the server processing.
        sortKeys - sort order associated with this server-side sort control.
    • Method Detail

      • getSortKeys

        public List<SortKey> getSortKeys()
                                  throws DirectoryException
        Retrieves the sort order for this server-side sort request control.
        Returns:
        The sort order for this server-side sort request control.
        Throws:
        DirectoryException - if an error occurs while retrieving the sort order.
      • containsSortKeys

        public boolean containsSortKeys()
                                 throws DirectoryException
        Indicates whether the sort control contains Sort keys.

        A Sort control may not contain sort keys if the attribute type is not recognized by the server

        Returns:
        true if the control contains sort keys or false if it does not.
        Throws:
        DirectoryException - If a problem occurs while trying to make the determination.
      • writeValue

        protected void writeValue​(ASN1Writer writer)
                           throws IOException
        Writes this control's value to an ASN.1 writer. The value (if any) must be written as an ASN1OctetString.
        Specified by:
        writeValue in class Control
        Parameters:
        writer - The ASN.1 writer to use.
        Throws:
        IOException - If a problem occurs while writing to the stream.
      • toString

        public void toString​(StringBuilder buffer)
        Appends a string representation of this server-side sort request control to the provided buffer.
        Overrides:
        toString in class Control
        Parameters:
        buffer - The buffer to which the information should be appended.