Class LDIFResultFormatter

    • Method Detail

      • formatEntry

        public static String formatEntry​(com.unboundid.ldap.sdk.Entry entry)
        Formats an LDAP directory entry as an LDIF string.

        Format:

         dn: entry-DN
         attribute-name-1: value-1
         attribute-name-1: value-2
         attribute-name-1: value-n
         ...
         attribute-name-2: value-1
         ...
         
        Parameters:
        entry - The directory entry.
        Returns:
        An LDIF string representing the directory entry.
      • formatSearchResult

        public static Map<String,​ObjectformatSearchResult​(com.unboundid.ldap.sdk.SearchResult sr)
        Formats an LDAP search result as a JSON object where the matches are presented as an LDIF string. Otherwise the returned JSON object has the same top level structure as for JSON-formatted search results.

        Format:

         { 
           "matches"    : "dn: result-entry-DN-1\n
                           attribute-name-1: value-1\n
                           attribute-name-1: value-2\n
                           attribute-name-1: value-n\n
                           ...\n
                           attribute-name-2: value-1\n
                           ...\n
                           \n
                           dn: result-entry-DN-2\n
                           ...\n
                           \n
                           dn: result-entry-DN-3\n
                           ...\n",
           "referrals"  : ["url-1", "url-2", "url-3", ...],
           "page"       : { "totalEntryCount" : n,
                            "more"            : true|false,
                            "cookie"          : "..." },
           "vlv"        : { "totalEntryCount" : n,
                            "offset"          : n,
                            "cookie"          : "..." }
         }
         
        Parameters:
        sr - The search result.
        Returns:
        A JSON object containing the search result matches as LDIF, referrals and optional control data.