Interface LdaptiveEntryMapper<T>

Type Parameters:
T - the type of the domain object
All Superinterfaces:
org.ldaptive.beans.LdapEntryMapper<T>
All Known Implementing Classes:
LdaptiveEntryImmutableMapper

public interface LdaptiveEntryMapper<T> extends org.ldaptive.beans.LdapEntryMapper<T>
The ldap entry mapper.
Author:
Christian Bremer
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> void
    addAttribute(org.ldaptive.LdapEntry ldapEntry, String name, T value, boolean isBinary, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, List<org.ldaptive.AttributeModification> modifications)
    Adds the specified value to the attribute with the specified name.
    static <T> void
    addAttribute(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute, T value, List<org.ldaptive.AttributeModification> modifications)
    Add attribute.
    static <T> void
    addAttributes(org.ldaptive.LdapEntry ldapEntry, String name, Collection<T> values, boolean isBinary, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, List<org.ldaptive.AttributeModification> modifications)
    Adds the specified values to the attribute with the specified name.
    static <T> void
    addAttributes(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute, Collection<T> values, List<org.ldaptive.AttributeModification> modifications)
    Add attributes.
    static String
    createDn(String rdn, String rdnValue, String baseDn)
    Create dn string.
    static <T> T
    getAttributeValue(org.ldaptive.LdapEntry ldapEntry, String name, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, T defaultValue)
    Gets attribute value.
    static <T> T
    getAttributeValue(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute, T defaultValue)
    Gets attribute value.
    static <T> Collection<T>
    getAttributeValues(org.ldaptive.LdapEntry ldapEntry, String name, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder)
    Gets attribute values.
    static <T> Collection<T>
    getAttributeValues(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute)
    Gets attribute values.
    static <T> List<T>
    getAttributeValuesAsList(org.ldaptive.LdapEntry ldapEntry, String name, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder)
    Gets attribute values as list.
    static <T> List<T>
    getAttributeValuesAsList(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute)
    Gets attribute values as list.
    static <T> Set<T>
    getAttributeValuesAsSet(org.ldaptive.LdapEntry ldapEntry, String name, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder)
    Gets attribute values as set.
    static <T> Set<T>
    getAttributeValuesAsSet(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute)
    Gets attribute values as set.
    default String[]
    Get binary attribute names.
    default String[]
    Get mapped attribute names.
    Get object classes of the ldap entry.
    static String
    Gets rdn value (not the rdn attribute name).
    map(org.ldaptive.LdapEntry ldapEntry)
    Map a ldap entry into a domain object.
    void
    map(org.ldaptive.LdapEntry source, T destination)
     
    default void
    map(T source, org.ldaptive.LdapEntry destination)
     
    org.ldaptive.AttributeModification[]
    mapAndComputeModifications(T source, org.ldaptive.LdapEntry destination)
    Map and compute attribute modifications (see LdapEntry.computeModifications(LdapEntry, LdapEntry)**).
    default Optional<org.ldaptive.ModifyRequest>
    mapAndComputeModifyRequest(T source, org.ldaptive.LdapEntry destination)
    Map and compute modify request.
    mapDn(T domainObject)
     
    static void
    removeAttribute(org.ldaptive.LdapEntry ldapEntry, String name, List<org.ldaptive.AttributeModification> modifications)
    Removes an attribute with the specified name.
    static <T> void
    removeAttribute(org.ldaptive.LdapEntry ldapEntry, String name, T value, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, List<org.ldaptive.AttributeModification> modifications)
    Removes an attribute with the specified value.
    static <T> void
    removeAttribute(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute, T value, List<org.ldaptive.AttributeModification> modifications)
    Remove attribute.
    static <T> void
    removeAttributes(org.ldaptive.LdapEntry ldapEntry, String name, Collection<T> values, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, List<org.ldaptive.AttributeModification> modifications)
    Remove attributes with the specified values.
    static <T> void
    removeAttributes(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute, Collection<T> values, List<org.ldaptive.AttributeModification> modifications)
    Remove attributes.
    static <T> void
    setAttribute(org.ldaptive.LdapEntry ldapEntry, String name, T value, boolean isBinary, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, List<org.ldaptive.AttributeModification> modifications)
    Replaces the value of the attribute with the specified value.
    static <T> void
    setAttribute(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute, T value, List<org.ldaptive.AttributeModification> modifications)
    Sets attribute.
    static <T> void
    setAttributes(org.ldaptive.LdapEntry ldapEntry, String name, Collection<T> values, boolean isBinary, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, List<org.ldaptive.AttributeModification> modifications)
    Replaces the values of the attribute with the specified values.
    static <T> void
    setAttributes(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute, Collection<T> values, List<org.ldaptive.AttributeModification> modifications)
    Sets attributes.
  • Method Details

    • getObjectClasses

      String[] getObjectClasses()
      Get object classes of the ldap entry. The object classes are only required, if a new ldap entry should be persisted.
      Returns:
      the object classes of the ldap entry
    • getMappedAttributeNames

      default String[] getMappedAttributeNames()
      Get mapped attribute names.
      Returns:
      the mapped attribute names
    • getBinaryAttributeNames

      default String[] getBinaryAttributeNames()
      Get binary attribute names.
      Returns:
      the binary attribute names
    • mapDn

      String mapDn(T domainObject)
      Specified by:
      mapDn in interface org.ldaptive.beans.LdapEntryMapper<T>
    • map

      T map(org.ldaptive.LdapEntry ldapEntry)
      Map a ldap entry into a domain object.
      Parameters:
      ldapEntry - the ldap entry
      Returns:
      the domain object
    • map

      void map(org.ldaptive.LdapEntry source, T destination)
      Specified by:
      map in interface org.ldaptive.beans.LdapEntryMapper<T>
    • map

      default void map(T source, org.ldaptive.LdapEntry destination)
      Specified by:
      map in interface org.ldaptive.beans.LdapEntryMapper<T>
    • mapAndComputeModifications

      org.ldaptive.AttributeModification[] mapAndComputeModifications(T source, org.ldaptive.LdapEntry destination)
      Map and compute attribute modifications (see LdapEntry.computeModifications(LdapEntry, LdapEntry)**).
      Parameters:
      source - the source (domain object); required
      destination - the destination (ldap entry); required
      Returns:
      the attribute modifications
    • mapAndComputeModifyRequest

      default Optional<org.ldaptive.ModifyRequest> mapAndComputeModifyRequest(T source, org.ldaptive.LdapEntry destination)
      Map and compute modify request.
      Parameters:
      source - the source (domain object); required
      destination - the destination (ldap entry); required
      Returns:
      the modify request
    • getAttributeValue

      static <T> T getAttributeValue(org.ldaptive.LdapEntry ldapEntry, String name, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, T defaultValue)
      Gets attribute value.
      Type Parameters:
      T - the type parameter
      Parameters:
      ldapEntry - the ldap entry; required
      name - the name; required
      valueTranscoder - the value transcoder; required
      defaultValue - the default value
      Returns:
      the attribute value
    • getAttributeValue

      static <T> T getAttributeValue(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute, T defaultValue)
      Gets attribute value.
      Type Parameters:
      T - the type parameter
      Parameters:
      ldapEntry - the ldap entry
      attribute - the attribute
      defaultValue - the default value
      Returns:
      the attribute value
    • getAttributeValues

      static <T> Collection<T> getAttributeValues(org.ldaptive.LdapEntry ldapEntry, String name, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder)
      Gets attribute values.
      Type Parameters:
      T - the type parameter
      Parameters:
      ldapEntry - the ldap entry; required
      name - the name; required
      valueTranscoder - the value transcoder; required
      Returns:
      the attribute values
    • getAttributeValues

      static <T> Collection<T> getAttributeValues(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute)
      Gets attribute values.
      Type Parameters:
      T - the type parameter
      Parameters:
      ldapEntry - the ldap entry
      attribute - the attribute
      Returns:
      the attribute values
    • getAttributeValuesAsSet

      static <T> Set<T> getAttributeValuesAsSet(org.ldaptive.LdapEntry ldapEntry, String name, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder)
      Gets attribute values as set.
      Type Parameters:
      T - the type parameter
      Parameters:
      ldapEntry - the ldap entry; required
      name - the name; required
      valueTranscoder - the value transcoder; required
      Returns:
      the attribute values as set
    • getAttributeValuesAsSet

      static <T> Set<T> getAttributeValuesAsSet(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute)
      Gets attribute values as set.
      Type Parameters:
      T - the type parameter
      Parameters:
      ldapEntry - the ldap entry
      attribute - the attribute
      Returns:
      the attribute values as set
    • getAttributeValuesAsList

      static <T> List<T> getAttributeValuesAsList(org.ldaptive.LdapEntry ldapEntry, String name, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder)
      Gets attribute values as list.
      Type Parameters:
      T - the type parameter
      Parameters:
      ldapEntry - the ldap entry; required
      name - the name; required
      valueTranscoder - the value transcoder; required
      Returns:
      the attribute values as list
    • getAttributeValuesAsList

      static <T> List<T> getAttributeValuesAsList(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute)
      Gets attribute values as list.
      Type Parameters:
      T - the type parameter
      Parameters:
      ldapEntry - the ldap entry
      attribute - the attribute
      Returns:
      the attribute values as list
    • setAttribute

      static <T> void setAttribute(org.ldaptive.LdapEntry ldapEntry, String name, T value, boolean isBinary, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, List<org.ldaptive.AttributeModification> modifications)
      Replaces the value of the attribute with the specified value.
      Type Parameters:
      T - the type of the domain object
      Parameters:
      ldapEntry - the ldap entry; required
      name - the attribute name; required
      value - the attribute value; can be null
      isBinary - specifies whether the attribute value is binary or not
      valueTranscoder - the value transcoder (can be null if value is also null)
      modifications - the list of modifications; required
    • setAttribute

      static <T> void setAttribute(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute, T value, List<org.ldaptive.AttributeModification> modifications)
      Sets attribute.
      Type Parameters:
      T - the type parameter
      Parameters:
      ldapEntry - the ldap entry
      attribute - the attribute
      value - the value
      modifications - the modifications
    • setAttributes

      static <T> void setAttributes(org.ldaptive.LdapEntry ldapEntry, String name, Collection<T> values, boolean isBinary, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, List<org.ldaptive.AttributeModification> modifications)
      Replaces the values of the attribute with the specified values.
      Type Parameters:
      T - the type of the domain object
      Parameters:
      ldapEntry - the ldap entry; required
      name - the attribute name; required
      values - the values of the attribute
      isBinary - specifies whether the attribute value is binary or not
      valueTranscoder - the value transcoder (can be null if values is also null)
      modifications - the list of modifications; required
    • setAttributes

      static <T> void setAttributes(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute, Collection<T> values, List<org.ldaptive.AttributeModification> modifications)
      Sets attributes.
      Type Parameters:
      T - the type parameter
      Parameters:
      ldapEntry - the ldap entry
      attribute - the attribute
      values - the values
      modifications - the modifications
    • addAttribute

      static <T> void addAttribute(org.ldaptive.LdapEntry ldapEntry, String name, T value, boolean isBinary, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, List<org.ldaptive.AttributeModification> modifications)
      Adds the specified value to the attribute with the specified name.
      Type Parameters:
      T - the type of the domain object
      Parameters:
      ldapEntry - the ldap entry; required
      name - the attribute name; required
      value - the attribute value; can be null
      isBinary - specifies whether the attribute value is binary or not
      valueTranscoder - the value transcoder; required
      modifications - the list of modifications; required
    • addAttribute

      static <T> void addAttribute(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute, T value, List<org.ldaptive.AttributeModification> modifications)
      Add attribute.
      Type Parameters:
      T - the type parameter
      Parameters:
      ldapEntry - the ldap entry
      attribute - the attribute
      value - the value
      modifications - the modifications
    • addAttributes

      static <T> void addAttributes(org.ldaptive.LdapEntry ldapEntry, String name, Collection<T> values, boolean isBinary, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, List<org.ldaptive.AttributeModification> modifications)
      Adds the specified values to the attribute with the specified name.
      Type Parameters:
      T - the type of the domain object
      Parameters:
      ldapEntry - the ldap entry; required
      name - the attribute name; required
      values - the attribute values; can be null
      isBinary - specifies whether the attribute value is binary or not
      valueTranscoder - the value transcoder; required
      modifications - the list of modifications; required
    • addAttributes

      static <T> void addAttributes(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute, Collection<T> values, List<org.ldaptive.AttributeModification> modifications)
      Add attributes.
      Type Parameters:
      T - the type parameter
      Parameters:
      ldapEntry - the ldap entry
      attribute - the attribute
      values - the values
      modifications - the modifications
    • removeAttribute

      static void removeAttribute(org.ldaptive.LdapEntry ldapEntry, String name, List<org.ldaptive.AttributeModification> modifications)
      Removes an attribute with the specified name.
      Parameters:
      ldapEntry - the ldap entry; required
      name - the name; required
      modifications - the modifications; required
    • removeAttribute

      static <T> void removeAttribute(org.ldaptive.LdapEntry ldapEntry, String name, T value, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, List<org.ldaptive.AttributeModification> modifications)
      Removes an attribute with the specified value. If the value is null, the whole attribute will be removed.
      Type Parameters:
      T - the type of the domain object
      Parameters:
      ldapEntry - the ldap entry; required
      name - the name; required
      value - the value; can be null
      valueTranscoder - the value transcoder; required
      modifications - the modifications; required
    • removeAttribute

      static <T> void removeAttribute(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute, T value, List<org.ldaptive.AttributeModification> modifications)
      Remove attribute.
      Type Parameters:
      T - the type parameter
      Parameters:
      ldapEntry - the ldap entry
      attribute - the attribute
      value - the value
      modifications - the modifications
    • removeAttributes

      static <T> void removeAttributes(org.ldaptive.LdapEntry ldapEntry, String name, Collection<T> values, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, List<org.ldaptive.AttributeModification> modifications)
      Remove attributes with the specified values. If values are empty or null, no attributes will be removed.
      Type Parameters:
      T - the type of the domain object
      Parameters:
      ldapEntry - the ldap entry; required
      name - the name; required
      values - the values
      valueTranscoder - the value transcoder; required
      modifications - the modifications; required
    • removeAttributes

      static <T> void removeAttributes(org.ldaptive.LdapEntry ldapEntry, LdaptiveAttribute<T> attribute, Collection<T> values, List<org.ldaptive.AttributeModification> modifications)
      Remove attributes.
      Type Parameters:
      T - the type parameter
      Parameters:
      ldapEntry - the ldap entry
      attribute - the attribute
      values - the values
      modifications - the modifications
    • createDn

      static String createDn(String rdn, String rdnValue, String baseDn)
      Create dn string.
      Parameters:
      rdn - the rdn; required
      rdnValue - the rdn value; required
      baseDn - the base dn; required
      Returns:
      the string
    • getRdn

      static String getRdn(String dn)
      Gets rdn value (not the rdn attribute name).
      Parameters:
      dn - the dn
      Returns:
      the rdn