/** * Retrieves the base name for this attribute, which is the name or OID of the * attribute type, without any attribute options. For an attribute without * any options, the value returned by this method will be identical the value * returned by the {@link #getName} method. * * @return The base name for this attribute. */ public String getBaseName() { return getBaseName(name); }
@Override public String getBaseName() { return attribute.getBaseName(); }
/** * Retrieves the base name for this attribute, without any options. * * @return The base name for this attribute. */ public String getBaseName() { return attribute.getBaseName(); }
/** * Retrieves the base name for the attribute with the provided name. * * @param attrName The attribute name for which to retrieve the base name. * * @return The base name for the attribute with the provided name. */ public static String getBaseName(final String attrName) { return Attribute.getBaseName(attrName); }
/** * Retrieves the base name for this attribute, which is the name or OID of the * attribute type, without any attribute options. For an attribute without * any options, the value returned by this method will be identical the value * returned by the {@code getName} method. * * @return The base name for this attribute. */ public String getBaseName() { return getBaseName(name); }
@Override public String getBaseName() { return attribute.getBaseName(); }
/** * Indicates whether the provided attribute name should be considered a * sensitive attribute for the purposes of {@code toCode} methods. If an * attribute is considered sensitive, then its values will be redacted in the * output of the {@code toCode} methods. * * @param name The name for which to make the determination. It may or may * not include attribute options. It must not be {@code null}. * * @return {@code true} if the specified attribute is one that should be * considered sensitive for the */ public static boolean isSensitiveToCodeAttribute(final String name) { final String lowerBaseName = Attribute.getBaseName(name).toLowerCase(); return TO_CODE_SENSITIVE_ATTRIBUTE_NAMES.contains(lowerBaseName); }
/** * Indicates whether the provided attribute name should be considered a * sensitive attribute for the purposes of {@code toCode} methods. If an * attribute is considered sensitive, then its values will be redacted in the * output of the {@code toCode} methods. * * @param name The name for which to make the determination. It may or may * not include attribute options. It must not be {@code null}. * * @return {@code true} if the specified attribute is one that should be * considered sensitive for the */ public static boolean isSensitiveToCodeAttribute(final String name) { final String lowerBaseName = Attribute.getBaseName(name).toLowerCase(); return TO_CODE_SENSITIVE_ATTRIBUTE_NAMES.contains(lowerBaseName); }
/** * Specifies the names of any attributes that should be considered sensitive * for the purposes of the {@code toCode} methods. * * @param names The names of any attributes that should be considered * sensitive for the purposes of the {@code toCode} methods. * It may be {@code null} or empty if no attributes should be * considered sensitive. */ public static void setSensitiveToCodeAttributes( final Collection<String> names) { if ((names == null) || names.isEmpty()) { TO_CODE_SENSITIVE_ATTRIBUTE_NAMES = Collections.emptySet(); } else { final LinkedHashSet<String> nameSet = new LinkedHashSet<String>(names.size()); for (final String s : names) { nameSet.add(Attribute.getBaseName(s).toLowerCase()); } TO_CODE_SENSITIVE_ATTRIBUTE_NAMES = Collections.unmodifiableSet(nameSet); } }
/** * Specifies the names of any attributes that should be considered sensitive * for the purposes of the {@code toCode} methods. * * @param names The names of any attributes that should be considered * sensitive for the purposes of the {@code toCode} methods. * It may be {@code null} or empty if no attributes should be * considered sensitive. */ public static void setSensitiveToCodeAttributes( final Collection<String> names) { if ((names == null) || names.isEmpty()) { TO_CODE_SENSITIVE_ATTRIBUTE_NAMES = Collections.emptySet(); } else { final LinkedHashSet<String> nameSet = new LinkedHashSet<String>(names.size()); for (final String s : names) { nameSet.add(Attribute.getBaseName(s).toLowerCase()); } TO_CODE_SENSITIVE_ATTRIBUTE_NAMES = Collections.unmodifiableSet(nameSet); } }
if (a.getBaseName().equalsIgnoreCase(baseName))
if (a.getBaseName().equalsIgnoreCase(baseName))
for (final Attribute a : originalAttributes) if (attributes.contains(StaticUtils.toLowerCase(a.getBaseName()))) for (final Attribute a : originalAttributes) if (! attributes.contains(StaticUtils.toLowerCase(a.getBaseName())))
/** * Composes an LDAP modify request for the specified entry. * * @param entry The entry. Must not be {@code null}. * * @return The modify request. */ public ModifyRequest composeModifyRequest(final Entry entry) { List<Modification> mods = new LinkedList<>(); // Compose list of attribute updates List<String> updatedAttributes = new LinkedList<>(); for (com.unboundid.ldap.sdk.Attribute attr: entry.getAttributes()) { if (! getModifiableAttributes().contains(attr.getBaseName())) { continue; // skip, attribute not modifiable } // Flag attribute for replace, set new value(s) mods.add(new Modification(ModificationType.REPLACE, attr.getName(), attr.getValues())); updatedAttributes.add(attr.getBaseName()); // trim any lang-tags } // Compose list of attribute deletions for (String supAttr: getModifiableAttributes()) { if (! updatedAttributes.contains(supAttr)) { // Flag for delete via replace mods.add(new Modification(ModificationType.REPLACE, supAttr)); } } return new ModifyRequest(entry.getDN(), mods); }
/** * Composes an LDAP modify request for the specified entry. * * @param entry The entry. Must not be {@code null}. * * @return The modify request. */ public ModifyRequest composeModifyRequest(final Entry entry) { List<Modification> mods = new LinkedList<>(); // Compose list of attribute updates List<String> updatedAttributes = new LinkedList<>(); for (com.unboundid.ldap.sdk.Attribute attr: entry.getAttributes()) { if (! getModifiableAttributes().contains(attr.getBaseName())) { continue; // skip, attribute not modifiable } // Flag attribute for replace, set new value(s) mods.add(new Modification(ModificationType.REPLACE, attr.getName(), attr.getValues())); updatedAttributes.add(attr.getBaseName()); // trim any lang-tags } // Compose list of attribute deletions for (String supAttr: getModifiableAttributes()) { if (! updatedAttributes.contains(supAttr)) { // Flag for delete via replace mods.add(new Modification(ModificationType.REPLACE, supAttr)); } } return new ModifyRequest(entry.getDN(), mods); }
String name = a.getBaseName();
for (final Attribute a : originalAttributes) if (attributes.containsKey(StaticUtils.toLowerCase(a.getBaseName()))) attributes.get(StaticUtils.toLowerCase(a.getBaseName())); if (replacement == null)
/** * {@inheritDoc} */ @Override() public void validateArgumentValue(final Argument argument, final String valueString) throws ArgumentException { final StringBuilder errorMessage = new StringBuilder(); if (! PersistUtils.isValidLDAPName(valueString, allowOptions, errorMessage)) { throw new ArgumentException(ERR_ATTR_NAME_VALIDATOR_INVALID_VALUE.get( valueString, argument.getIdentifierString(), String.valueOf(errorMessage))); } if (schema != null) { final String baseName = Attribute.getBaseName(valueString); if (schema.getAttributeType(baseName) == null) { throw new ArgumentException( ERR_ATTR_NAME_VALIDATOR_TYPE_NOT_DEFINED.get(valueString, argument.getIdentifierString(), baseName)); } } }
StaticUtils.toLowerCase(Attribute.getBaseName(s)); if (attributes.containsKey(lowerBaseName))
for (final Attribute a : attributes) final String baseName = StaticUtils.toLowerCase(a.getBaseName()); attrMap.put(baseName, a);