Class ResultUtils


  • @ThreadSafety(level=COMPLETELY_THREADSAFE)
    public final class ResultUtils
    extends java.lang.Object
    This class provides a set of utility methods for formatting operation results.
    NOTE: This class, and other classes within the com.unboundid.ldap.sdk.unboundidds package structure, are only supported for use against Ping Identity, UnboundID, and Nokia/Alcatel-Lucent 8661 server products. These classes provide support for proprietary functionality or for external specifications that are not considered stable or mature enough to be guaranteed to work in an interoperable way with other types of LDAP servers.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void formatResponseControl​(java.util.List<java.lang.String> lines, Control c, boolean comment, int indent, int maxWidth)
      Adds a multi-line string representation of the provided result to the given list.
      static java.util.List<java.lang.String> formatResult​(LDAPException ldapException, boolean comment, int indent, int maxWidth)
      Retrieves a list of strings that comprise a formatted representation of the result encapsulated by the provided exception.
      static java.util.List<java.lang.String> formatResult​(LDAPResult result, boolean comment, int indent, int maxWidth)
      Retrieves a list of strings that comprise a formatted representation of the provided result.
      static void formatResult​(java.util.List<java.lang.String> lines, LDAPResult result, boolean comment, boolean inTxn, int indent, int maxWidth)
      Adds a multi-line string representation of the provided result to the given list.
      static void formatSearchResultEntry​(java.util.List<java.lang.String> lines, SearchResultEntry entry, int maxWidth)
      Updates the provided list with an LDIF representation of the provided search result entry to the given list, preceded by comments about any controls that may be included with the entry.
      static void formatSearchResultReference​(java.util.List<java.lang.String> lines, SearchResultReference reference, int maxWidth)
      Updates the provided with with a string representation of the provided search result reference.
      static void formatUnsolicitedNotification​(java.util.List<java.lang.String> lines, ExtendedResult notification, boolean comment, int indent, int maxWidth)
      Adds a multi-line string representation of the provided unsolicited notification to the given list.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • formatResult

        public static java.util.List<java.lang.String> formatResult​(LDAPResult result,
                                                                    boolean comment,
                                                                    int indent,
                                                                    int maxWidth)
        Retrieves a list of strings that comprise a formatted representation of the provided result.
        Parameters:
        result - The result to be formatted.
        comment - Indicates whether to prefix each line with an octothorpe to indicate that it is a comment.
        indent - The number of spaces to indent each line.
        maxWidth - The maximum length of each line in characters, including the comment prefix and indent.
        Returns:
        A list of strings that comprise a formatted representation of the provided result.
      • formatResult

        public static java.util.List<java.lang.String> formatResult​(LDAPException ldapException,
                                                                    boolean comment,
                                                                    int indent,
                                                                    int maxWidth)
        Retrieves a list of strings that comprise a formatted representation of the result encapsulated by the provided exception.
        Parameters:
        ldapException - The exception to use to obtain the result to format.
        comment - Indicates whether to prefix each line with an octothorpe to indicate that it is a comment.
        indent - The number of spaces to indent each line.
        maxWidth - The maximum length of each line in characters, including the comment prefix and indent.
        Returns:
        A list of strings that comprise a formatted representation of the result encapsulated by the provided exception.
      • formatResult

        public static void formatResult​(java.util.List<java.lang.String> lines,
                                        LDAPResult result,
                                        boolean comment,
                                        boolean inTxn,
                                        int indent,
                                        int maxWidth)
        Adds a multi-line string representation of the provided result to the given list.
        Parameters:
        lines - The list to which the lines should be added.
        result - The result to be formatted.
        comment - Indicates whether to prefix each line with an octothorpe to indicate that it is a comment.
        inTxn - Indicates whether the operation is part of an active transaction.
        indent - The number of spaces to indent each line.
        maxWidth - The maximum length of each line in characters, including the comment prefix and indent.
      • formatSearchResultEntry

        public static void formatSearchResultEntry​(java.util.List<java.lang.String> lines,
                                                   SearchResultEntry entry,
                                                   int maxWidth)
        Updates the provided list with an LDIF representation of the provided search result entry to the given list, preceded by comments about any controls that may be included with the entry.
        Parameters:
        lines - The list to which the formatted representation will be added.
        entry - The entry to be formatted.
        maxWidth - The maximum length of each line in characters, including any comment prefix and indent.
      • formatSearchResultReference

        public static void formatSearchResultReference​(java.util.List<java.lang.String> lines,
                                                       SearchResultReference reference,
                                                       int maxWidth)
        Updates the provided with with a string representation of the provided search result reference. The information will be written as LDIF comments, and will include any referral URLs contained in the reference, as well as information about any associated controls.
        Parameters:
        lines - The list to which the formatted representation will be added.
        reference - The search result reference to be formatted.
        maxWidth - The maximum length of each line in characters, including any comment prefix and indent.
      • formatUnsolicitedNotification

        public static void formatUnsolicitedNotification​(java.util.List<java.lang.String> lines,
                                                         ExtendedResult notification,
                                                         boolean comment,
                                                         int indent,
                                                         int maxWidth)
        Adds a multi-line string representation of the provided unsolicited notification to the given list.
        Parameters:
        lines - The list to which the lines should be added.
        notification - The unsolicited notification to be formatted.
        comment - Indicates whether to prefix each line with an octothorpe to indicate that it is a comment.
        indent - The number of spaces to indent each line.
        maxWidth - The maximum length of each line in characters, including the comment prefix and indent.
      • formatResponseControl

        public static void formatResponseControl​(java.util.List<java.lang.String> lines,
                                                 Control c,
                                                 boolean comment,
                                                 int indent,
                                                 int maxWidth)
        Adds a multi-line string representation of the provided result to the given list.
        Parameters:
        lines - The list to which the lines should be added.
        c - The control to be formatted.
        comment - Indicates whether to prefix each line with an octothorpe to indicate that it is a comment.
        indent - The number of spaces to indent each line.
        maxWidth - The maximum length of each line in characters, including the comment prefix and indent.