/** * Returns the name of this attribute. Includes options if they exist. * * @return attribute name */ public String getName() { return getName(true); }
/** * Returns the name of this attribute. Includes options if they exist. * * @return attribute name */ public String getName() { return getName(true); }
/** * Returns the name of this attribute. Includes options if they exist. * * @return attribute name */ public String getName() { return getName(true); }
@Override public String getName() { return la.getName(); }
/** * Removes an attribute from this ldap attributes. * * @param attr attribute to remove */ public void removeAttribute(final LdapAttribute... attr) { for (LdapAttribute a : attr) { entryAttributes.remove(a.getName().toLowerCase()); } }
/** * Adds an attribute to this ldap attributes. * * @param attr attribute to add */ public void addAttribute(final LdapAttribute... attr) { for (LdapAttribute a : attr) { entryAttributes.put(a.getName().toLowerCase(), a); } }
/** * Removes an attribute from this ldap attributes. * * @param attr attribute to remove */ public void removeAttribute(final LdapAttribute... attr) { for (LdapAttribute a : attr) { entryAttributes.remove(a.getName().toLowerCase()); } }
/** * Adds an attribute to this ldap attributes. * * @param attr attribute to add */ public void addAttribute(final LdapAttribute... attr) { for (LdapAttribute a : attr) { entryAttributes.put(a.getName().toLowerCase(), a); } }
/** * Adds an attribute to this ldap attributes. * * @param attr attribute to add */ public void addAttribute(final LdapAttribute... attr) { for (LdapAttribute a : attr) { entryAttributes.put(a.getName().toLowerCase(), a); } }
/** * Removes an attribute from this ldap attributes. * * @param attr attribute to remove */ public void removeAttribute(final LdapAttribute... attr) { for (LdapAttribute a : attr) { entryAttributes.remove(a.getName().toLowerCase()); } }
/** * Returns the attribute names in this entry. * * @return string array of attribute names */ public String[] getAttributeNames() { final String[] names = new String[entryAttributes.size()]; int i = 0; for (LdapAttribute la : entryAttributes.values()) { names[i++] = la.getName(); } return names; }
/** * Returns the attribute names in this entry. * * @return string array of attribute names */ public String[] getAttributeNames() { final String[] names = new String[entryAttributes.size()]; int i = 0; for (LdapAttribute la : entryAttributes.values()) { names[i++] = la.getName(); } return names; }
/** * Returns the attribute names in this entry. * * @return string array of attribute names */ public String[] getAttributeNames() { final String[] names = new String[entryAttributes.size()]; int i = 0; for (LdapAttribute la : entryAttributes.values()) { names[i++] = la.getName(); } return names; }
/** * Returns the RDN values for the attribute type with the supplied name. * * @param dn to parse * @param name of the attribute type to return values for * * @return DN attribute values */ public static Collection<String> getValues(final String dn, final String name) { final Collection<String> values = new ArrayList<>(); convertDnToAttributes(dn).stream().filter( la -> la.getName().equalsIgnoreCase(name)).forEach(la -> values.addAll(la.getStringValues())); return values; }
/** * Returns the RDN values for the attribute type with the supplied name. * * @param dn to parse * @param name of the attribute type to return values for * * @return DN attribute values */ public static Collection<String> getValues(final String dn, final String name) { final Collection<String> values = new ArrayList<>(); convertDnToAttributes(dn).stream().filter( la -> la.getName().equalsIgnoreCase(name)).forEach(la -> values.addAll(la.getStringValues())); return values; }
@Override public String toString() { return String.format( "[%s@%d::compareDn=%s, attribute=%s, controls=%s, " + "referralHandler=%s, intermediateResponseHandlers=%s]", getClass().getName(), hashCode(), compareDn, attribute != null ? "userPassword".equals(attribute.getName()) ? "<suppressed>" : attribute : null, Arrays.toString(getControls()), getReferralHandler(), Arrays.toString(getIntermediateResponseHandlers())); } }
/** * Returns the RDN values for the attribute type with the supplied name. * * @param dn to parse * @param name of the attribute type to return values for * * @return DN attribute values */ public static Collection<String> getValues(final String dn, final String name) { final Collection<String> values = new ArrayList<>(); for (LdapAttribute la : convertDnToAttributes(dn)) { if (la.getName().equalsIgnoreCase(name)) { values.addAll(la.getStringValues()); } } return values; }
protected Map<String, Object> getAttributesFromEntry(final LdapEntry entry) { final Map<String, Object> attributes = new HashMap<>(); for (final LdapAttribute attribute : entry.getAttributes()) { final String name = attribute.getName(); if (attribute.size() > 1) { attributes.put(name, attribute.getStringValues()); } else { attributes.put(name, attribute.getStringValue()); } } return attributes; }
/** * Converts an ldaptive <code>LdapEntry</code> containing result entry attributes into an attribute map as needed * by Person Directory components. * * @param entry Ldap entry. * @return Attribute map. */ private Map<String, List<Object>> convertLdapEntryToMap(final LdapEntry entry) { final Map<String, List<Object>> attributeMap = new LinkedHashMap<>(entry.size()); for (final LdapAttribute attr : entry.getAttributes()) { attributeMap.put(attr.getName(), new ArrayList<Object>(attr.getStringValues())); } logger.debug("Converted ldap DN entry [{}] to attribute map {}", entry.getDn(), attributeMap.toString()); return attributeMap; }
/** * Converts an ldaptive <code>LdapEntry</code> containing result entry attributes into an attribute map as needed * by Person Directory components. * * @param entry Ldap entry. * * @return Attribute map. */ private Map<String, List<Object>> convertLdapEntryToMap(final LdapEntry entry) { final Map<String, List<Object>> attributeMap = new LinkedHashMap<>(entry.size()); for (final LdapAttribute attr : entry.getAttributes()) { attributeMap.put(attr.getName(), new ArrayList<Object>(attr.getStringValues())); } logger.debug("Converted ldap DN entry [{}] to attribute map {}", entry.getDn(), attributeMap.toString()); return attributeMap; }