Interface LdaptiveEntryMapper<T>

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

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

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      static <T> void addAttribute​(@NotNull org.ldaptive.LdapEntry ldapEntry, @NotNull String name, T value, boolean isBinary, @NotNull org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, @NotNull List<org.ldaptive.AttributeModification> modifications)
      Adds the specified value to the attribute with the specified name.
      static <T> void addAttributes​(@NotNull org.ldaptive.LdapEntry ldapEntry, @NotNull String name, Collection<T> values, boolean isBinary, @NotNull org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, @NotNull List<org.ldaptive.AttributeModification> modifications)
      Adds the specified values to the attribute with the specified name.
      static String createDn​(@NotNull String rdn, @NotNull String rdnValue, @NotNull String baseDn)
      Create dn string.
      static <T> T getAttributeValue​(org.ldaptive.LdapEntry ldapEntry, @NotNull String name, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, T defaultValue)
      Gets attribute value.
      static <T> Collection<T> getAttributeValues​(org.ldaptive.LdapEntry ldapEntry, @NotNull String name, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder)
      Gets attribute values.
      static <T> List<T> getAttributeValuesAsList​(org.ldaptive.LdapEntry ldapEntry, @NotNull String name, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder)
      Gets attribute values as list.
      static <T> Set<T> getAttributeValuesAsSet​(org.ldaptive.LdapEntry ldapEntry, @NotNull String name, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder)
      Gets attribute values as set.
      String[] getObjectClasses()
      Get object classes of the ldap entry.
      static String getRdn​(String dn)
      Gets rdn.
      T 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, @NotNull org.ldaptive.LdapEntry destination)
      Map and compute attribute modifications (see LdapEntry.computeModifications(LdapEntry, LdapEntry)**).
      default org.ldaptive.ModifyRequest mapAndComputeModifyRequest​(T source, @NotNull org.ldaptive.LdapEntry destination)
      Map and compute modify request.
      String mapDn​(T domainObject)  
      static void removeAttribute​(@NotNull org.ldaptive.LdapEntry ldapEntry, @NotNull String name, @NotNull List<org.ldaptive.AttributeModification> modifications)
      Removes an attribute with the specified name.
      static <T> void removeAttribute​(@NotNull org.ldaptive.LdapEntry ldapEntry, @NotNull String name, T value, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, @NotNull List<org.ldaptive.AttributeModification> modifications)
      Removes an attribute with the specified value.
      static <T> void removeAttributes​(@NotNull org.ldaptive.LdapEntry ldapEntry, @NotNull String name, Collection<T> values, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, @NotNull List<org.ldaptive.AttributeModification> modifications)
      Remove attributes with the specified values.
      static <T> void setAttribute​(@NotNull org.ldaptive.LdapEntry ldapEntry, @NotNull String name, T value, boolean isBinary, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, @NotNull List<org.ldaptive.AttributeModification> modifications)
      Replaces the value of the attribute with the specified value.
      static <T> void setAttributes​(@NotNull org.ldaptive.LdapEntry ldapEntry, @NotNull String name, Collection<T> values, boolean isBinary, org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder, @NotNull List<org.ldaptive.AttributeModification> modifications)
      Replaces the values of the attribute with the specified values.
    • Method Detail

      • 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
      • mapDn

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

        @Nullable
        T map​(@Nullable
              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​(@NotNull
                                                                        T source,
                                                                        @NotNull
                                                                        @NotNull org.ldaptive.LdapEntry destination)
        Map and compute attribute modifications (see LdapEntry.computeModifications(LdapEntry, LdapEntry)**).
        Parameters:
        source - the source (domain object)
        destination - the destination (ldap entry)
        Returns:
        the attribute modifications
      • mapAndComputeModifyRequest

        default org.ldaptive.ModifyRequest mapAndComputeModifyRequest​(@NotNull
                                                                      T source,
                                                                      @NotNull
                                                                      @NotNull org.ldaptive.LdapEntry destination)
        Map and compute modify request.
        Parameters:
        source - the source (domain object)
        destination - the destination (ldap entry)
        Returns:
        the modify request
      • getAttributeValue

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

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

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

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

        static <T> void setAttribute​(@NotNull
                                     @NotNull org.ldaptive.LdapEntry ldapEntry,
                                     @NotNull
                                     @NotNull String name,
                                     @Nullable
                                     T value,
                                     boolean isBinary,
                                     org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder,
                                     @NotNull
                                     @NotNull 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
        name - the attribute name
        value - the attribute value
        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
      • setAttributes

        static <T> void setAttributes​(@NotNull
                                      @NotNull org.ldaptive.LdapEntry ldapEntry,
                                      @NotNull
                                      @NotNull String name,
                                      @Nullable
                                      Collection<T> values,
                                      boolean isBinary,
                                      org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder,
                                      @NotNull
                                      @NotNull 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
        name - the attribute name
        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
      • addAttribute

        static <T> void addAttribute​(@NotNull
                                     @NotNull org.ldaptive.LdapEntry ldapEntry,
                                     @NotNull
                                     @NotNull String name,
                                     @Nullable
                                     T value,
                                     boolean isBinary,
                                     @NotNull
                                     @NotNull org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder,
                                     @NotNull
                                     @NotNull 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
        name - the attribute name
        value - the attribute value
        isBinary - specifies whether the attribute value is binary or not
        valueTranscoder - the value transcoder
        modifications - the list of modifications
      • addAttributes

        static <T> void addAttributes​(@NotNull
                                      @NotNull org.ldaptive.LdapEntry ldapEntry,
                                      @NotNull
                                      @NotNull String name,
                                      @Nullable
                                      Collection<T> values,
                                      boolean isBinary,
                                      @NotNull
                                      @NotNull org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder,
                                      @NotNull
                                      @NotNull 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
        name - the attribute name
        values - the attribute values
        isBinary - specifies whether the attribute value is binary or not
        valueTranscoder - the value transcoder
        modifications - the list of modifications
      • removeAttribute

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

        static <T> void removeAttribute​(@NotNull
                                        @NotNull org.ldaptive.LdapEntry ldapEntry,
                                        @NotNull
                                        @NotNull String name,
                                        @Nullable
                                        T value,
                                        org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder,
                                        @NotNull
                                        @NotNull 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
        name - the name
        value - the value
        valueTranscoder - the value transcoder
        modifications - the modifications
      • removeAttributes

        static <T> void removeAttributes​(@NotNull
                                         @NotNull org.ldaptive.LdapEntry ldapEntry,
                                         @NotNull
                                         @NotNull String name,
                                         @Nullable
                                         Collection<T> values,
                                         org.ldaptive.transcode.ValueTranscoder<T> valueTranscoder,
                                         @NotNull
                                         @NotNull 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
        name - the name
        values - the values
        valueTranscoder - the value transcoder
        modifications - the modifications
      • createDn

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

        static String getRdn​(String dn)
        Gets rdn.
        Parameters:
        dn - the dn
        Returns:
        the rdn