Class JSONResultFormatter

    • Method Detail

      • formatEntry

        public static Map<String,​ObjectformatEntry​(com.unboundid.ldap.sdk.Entry entry,
                                                           Set<String> binary,
                                                           boolean omitDN,
                                                           boolean normalize)
        Formats an LDAP directory entry as a JSON object.

        Format:

         {
           "DN"               : "uid=user001,ou=people,dc=example,dc=com",
           "attribute-name-1" : [value-1, value-2, value-3, ...],
           "attribute-name-2" : [value-1, value-2, ...],
           "attribute-name-3" : [value-1, ...],
           ...
         }
         
        Parameters:
        entry - The directory entry. Must not be null.
        binary - The name of the attributes to Base64 encode. Must not be null.
        omitDN - If true the DN will be omitted from the returned map.
        normalize - If true attribute names will be converted to lower case.
        Returns:
        A JSON object representing the directory entry.
      • formatEntry

        public static Map<String,​ObjectformatEntry​(com.unboundid.ldap.sdk.Entry entry,
                                                           Set<String> binary,
                                                           boolean normalize)
        Formats an LDAP directory entry as a JSON object.

        Format:

         {
           "DN"               : "uid=user001,ou=people,dc=example,dc=com",
           "attribute-name-1" : [value-1, value-2, value-3, ...],
           "attribute-name-2" : [value-1, value-2, ...],
           "attribute-name-3" : [value-1, ...],
           ...
         }
         
        Parameters:
        entry - The directory entry. Must not be null.
        binary - The name of the attributes to Base64 encode. Must not be null.
        normalize - If true attribute names will be converted to lower case.
        Returns:
        A JSON object representing the directory entry.
      • formatSearchResult

        public static Map<String,​ObjectformatSearchResult​(com.unboundid.ldap.sdk.SearchResult sr,
                                                                  Set<String> binary,
                                                                  boolean normalize)
        Formats a LDAP search result as a JSON object containing matches and referrals.

        Format:

         { 
           "matches"    : [ { entry-1 }, { entry-2 }, { entry-3 }, ...],
           "referrals"  : [ "url-1", "url-2", "url-3", ...],
           "page"       : { "totalEntryCount" : n,
                            "more"            : true|false,
                            "cookie"          : "..." },
           "vlv"        : { "totalEntryCount" : n,
                            "offset"          : n,
                            "cookie"          : "..." }
         }
         
        where entry-n are formatted by the formatEntry(com.unboundid.ldap.sdk.Entry, java.util.Set<java.lang.String>, boolean, boolean) method.
        Parameters:
        sr - The search result. Must not be null.
        binary - The name of the attributes to Base64 encode. Must not be null.
        normalize - If true attribute names will be converted to lower case.
        Returns:
        A JSON object containing the search result matches, referrals and optional control data.
      • formatObjectClass

        public static Map<String,​ObjectformatObjectClass​(com.unboundid.ldap.sdk.schema.ObjectClassDefinition def)
        Formats an object class defintion.
        Parameters:
        def - The object class definition. Must not be null.
        Returns:
        The object class properties as JSON object.
      • formatAttributeType

        public static Map<String,​ObjectformatAttributeType​(com.unboundid.ldap.sdk.schema.AttributeTypeDefinition def)
        Formats an attribute type defintion.
        Parameters:
        def - The attribute type definition. Must not be null.
        Returns:
        The attribute type properties as JSON object.
      • formatMatchingRule

        public static Map<String,​ObjectformatMatchingRule​(com.unboundid.ldap.sdk.schema.MatchingRuleDefinition def)
        Formats a matching rule defintion.
        Parameters:
        def - The matching rule definition. Must not be null.
        Returns:
        The matching rule properties as JSON object.
      • formatMatchingRuleUse

        public static Map<String,​ObjectformatMatchingRuleUse​(com.unboundid.ldap.sdk.schema.MatchingRuleUseDefinition def)
        Formats a matching rule use defintion.
        Parameters:
        def - The matching rule use definition. Must not be null.
        Returns:
        The matching rule use properties as JSON object.
      • formatSyntax

        public static Map<String,​ObjectformatSyntax​(com.unboundid.ldap.sdk.schema.AttributeSyntaxDefinition def)
        Formats an attribute syntax defintion.
        Parameters:
        def - The attribute syntax definition. Must not be null.
        Returns:
        The syntax properties as JSON object.