Class Converters


  • public final class Converters
    extends Object
    Common utility methods.
    • Method Detail

      • to

        public static Entry to​(Entry sdkEntry)
        Converts from OpenDJ LDAP SDK Entry to OpenDJ server Entry.
        Parameters:
        sdkEntry - SDK entry to convert
        Returns:
        the converted entry
      • to

        public static RawFilter to​(Filter filter)
        Converts from OpenDJ LDAP SDK Filter to OpenDJ server RawFilter.
        Parameters:
        filter - value to convert
        Returns:
        the converted value
      • toSearchFilter

        public static SearchFilter toSearchFilter​(Filter filter)
        Converts from OpenDJ LDAP SDK Filter to OpenDJ server RawFilter.
        Parameters:
        filter - value to convert
        Returns:
        the converted value
      • to

        public static LDAPControl to​(Control control)
        Converts from OpenDJ LDAP SDK Control to OpenDJ server LDAPControl.
        Parameters:
        control - value to convert
        Returns:
        the converted value
      • to

        public static List<Control> to​(List<Control> listOfControl)
        Converts from a List of OpenDJ LDAP SDK Control to a List of OpenDJ server Control.
        Parameters:
        listOfControl - value to convert
        Returns:
        the converted value
      • toAttribute

        public static Attribute toAttribute​(Attribute attribute)
        Converts from OpenDJ LDAP SDK Attribute to OpenDJ server Attribute.
        Parameters:
        attribute - value to convert
        Returns:
        the converted value
      • toAttributes

        public static List<Attribute> toAttributes​(Iterable<Attribute> listOfAttributes)
        Converts from an Iterable of OpenDJ LDAP SDK Attribute to a List of OpenDJ server RawAttribute.
        Parameters:
        listOfAttributes - value to convert
        Returns:
        the converted value
      • toModifications

        public static List<Modification> toModifications​(List<Modification> listOfModifications)
        Converts from a List of OpenDJ LDAP SDK Modification to a List of OpenDJ server Modification.
        Parameters:
        listOfModifications - value to convert
        Returns:
        the converted value
      • from

        public static Control from​(LDAPControl ldapControl)
        Converts from OpenDJ server LDAPControl to OpenDJ LDAP SDK Control.
        Parameters:
        ldapControl - value to convert
        Returns:
        the converted value
      • from

        public static Control from​(Control control)
        Converts from OpenDJ server Control to OpenDJ LDAP SDK Control.
        Parameters:
        control - value to convert
        Returns:
        the converted value
      • from

        public static List<Control> from​(List<Control> listOfControl)
        Converts from a List of OpenDJ server Control to a List of OpenDJ LDAP SDK Control.
        Parameters:
        listOfControl - value to convert
        Returns:
        the converted value
      • from

        public static Attribute from​(Attribute attribute)
        Converts from OpenDJ server Attribute to OpenDJ LDAP SDK Attribute.
        Parameters:
        attribute - value to convert
        Returns:
        the converted value
      • partiallyWrap

        public static Attribute partiallyWrap​(Attribute attribute)
        Converts from OpenDJ server Attribute to OpenDJ LDAP SDK Attribute. This method is an optimization of the equivalent from() method. It's only used in encoding/decoding and as such only wrap the required methods: the returned object partially wrap the incoming one.
        Parameters:
        attribute - value to convert
        Returns:
        the converted value
      • from

        public static List<Attribute> from​(Iterable<Attribute> listOfAttributes)
        Converts from an Iterable of OpenDJ server Attribute to a List of OpenDJ LDAP SDK Attribute.
        Parameters:
        listOfAttributes - value to convert
        Returns:
        the converted value
      • partiallyWrap

        public static SearchResultEntry partiallyWrap​(SearchResultEntry srvResultEntry,
                                                      int ldapVersion)
        Converts from OpenDJ server SearchResultEntry to OpenDJ LDAP SDK SearchResultEntry. This method is an optimization of the equivalent from() method. It's only used in encoding/decoding and as such only wrap the required methods: the returned object partially wrap the incoming one.
        Parameters:
        srvResultEntry - value to convert
        ldapVersion - Version of the ldap protocol
        Returns:
        the converted value
      • from

        public static Entry from​(Entry srvResultEntry)
        Converts from OpenDJ server Entry to OpenDJ LDAP SDK Entry.
        Parameters:
        srvResultEntry - value to convert
        Returns:
        the converted value
      • getResponseResult

        public static <T extends Result> T getResponseResult​(Operation operation,
                                                             T result)
                                                      throws LdapException
        Populates the result object with the operation details and return the result object if it was successful. Otherwise, it throws an LdapException.
        Type Parameters:
        T - the type of the result object
        Parameters:
        operation - used to populate the result
        result - the result object to populate from the Operation
        Returns:
        the result if successful, an LdapException is thrown otherwise
        Throws:
        LdapException - when an error occurs
      • getResponseResult

        public static Result getResponseResult​(Operation operation)
                                        throws LdapException
        Converts the OpenDJ server Operation object into an OpenDJ LDAP SDK Result object.
        Parameters:
        operation - value to convert
        Returns:
        the converted value
        Throws:
        LdapException - when an error occurs
      • getCredentials

        public static ByteString getCredentials​(byte[] authenticationValue)
        Converts from byte[] to OpenDJ server ByteString.
        Parameters:
        authenticationValue - value to convert
        Returns:
        the converted value