@Override public String[] getValuesAsStringArray() { return attribute.getValues(); }
@Override public String[] getValuesAsStringArray() { return attribute.getValues(); }
/** * Retrieves an array of the values for this attribute. * * @return An array of the values for this attribute. */ public String[] getStringValueArray() { return attribute.getValues(); }
@Override // often there are multiple attributes with the same name - perfectly valid! public List<ILdapDn> getValuesAsDn() { if (dnListCache == null) { dnListCache = new ArrayList<>(attribute.getValues().length); for (String value : attribute.getValues()) { try { dnListCache.add(new DefaultLdapDn(value)); } catch (LDAPException e) { throw new IllegalArgumentException(e); } } } return dnListCache; }
@Override // often there are multiple attributes with the same name - perfectly valid! public List<ILdapDn> getValuesAsDn() { if (dnListCache == null) { dnListCache = new ArrayList<>(attribute.getValues().length); for (String value : attribute.getValues()) { try { dnListCache.add(new DefaultLdapDn(value)); } catch (LDAPException e) { throw new IllegalArgumentException(e); } } } return dnListCache; }
/** * Retrieves an enumeration over the string values for this attribute. * * @return An enumeration over the string values for this attribute. */ public Enumeration<String> getStringValues() { return new IterableEnumeration<String>( Arrays.asList(attribute.getValues())); }
/** * Retrieves the set of values for the specified attribute, if available. * * @param attributeName The name of the attribute for which to retrieve the * values. It must not be {@code null}. * * @return The set of values for the specified attribute, or {@code null} if * that attribute is not available. */ public String[] getAttributeValues(final String attributeName) { ensureNotNull(attributeName); final Attribute a = attributes.get(toLowerCase(attributeName)); if (a == null) { return null; } else { return a.getValues(); } }
/** * Retrieves the set of values for the specified attribute, if available. * * @param attributeName The name of the attribute for which to retrieve the * values. It must not be {@code null}. * * @return The set of values for the specified attribute, or {@code null} if * that attribute is not available. */ public String[] getAttributeValues(final String attributeName) { ensureNotNull(attributeName); final Attribute a = attributes.get(toLowerCase(attributeName)); if (a == null) { return null; } else { return a.getValues(); } }
EnumSet.noneOf(AttributeRight.class); for (final String value : a.getValues())
for (final Attribute a : attrList) for (final String value : a.getValues())
/** * {@inheritDoc} */ @Override() public Map<String,MonitorAttribute> getMonitorAttributes() { final LinkedHashMap<String,MonitorAttribute> attrs = new LinkedHashMap<String,MonitorAttribute>(); final Attribute traceAttr = getEntry().getAttribute(ATTR_JVM_STACK_TRACE); if (traceAttr != null) { addMonitorAttribute(attrs, ATTR_JVM_STACK_TRACE, INFO_STACK_TRACE_DISPNAME_TRACE.get(), INFO_STACK_TRACE_DESC_TRACE.get(), Collections.unmodifiableList(Arrays.asList(traceAttr.getValues()))); } return Collections.unmodifiableMap(attrs); } }
/** * Retrieves the set of parsed monitor attributes for this monitor entry, * mapped from a unique identifier (in all lowercase characters) to the * corresponding monitor attribute. * * @return The set of parsed monitor attributes for this monitor entry. */ public Map<String,MonitorAttribute> getMonitorAttributes() { // Retrieve a map of all attributes in the entry except cn and objectClass. final LinkedHashMap<String,MonitorAttribute> attrs = new LinkedHashMap<String,MonitorAttribute>(); for (final Attribute a : entry.getAttributes()) { final String lowerName = toLowerCase(a.getName()); if (lowerName.equals("cn") || lowerName.equals("objectclass")) { continue; } attrs.put(lowerName, new MonitorAttribute(lowerName, a.getName(), "", a.getValues())); } return Collections.unmodifiableMap(attrs); }
Collections.addAll(values, a.getValues());
/** * Converts the provided LDAP SDK attribute to a JNDI attribute. * * @param a The attribute to be converted. * * @return The JNDI attribute that corresponds to the provided LDAP SDK * attribute. */ public static javax.naming.directory.Attribute convertAttribute( final Attribute a) { if (a == null) { return null; } final BasicAttribute attr = new BasicAttribute(a.getName(), true); for (final String v : a.getValues()) { attr.add(v); } return attr; }
/** * 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); }
/** * {@inheritDoc} */ public Entry transformEntry(final Entry e) { if (e == null) { return null; } // Iterate through the attributes in the entry and make any appropriate DN // replacements final Collection<Attribute> originalAttributes = e.getAttributes(); final ArrayList<Attribute> newAttributes = new ArrayList<Attribute>(originalAttributes.size()); for (final Attribute a : originalAttributes) { final String[] originalValues = a.getValues(); final String[] newValues = new String[originalValues.length]; for (int i=0; i < originalValues.length; i++) { newValues[i] = processString(originalValues[i]); } newAttributes.add(new Attribute(a.getName(), newValues)); } return new Entry(processString(e.getDN()), newAttributes); }
attributeName, StaticUtils.concatenateStrings("{", " '", ",", "'", " }", a.getValues()), StaticUtils.concatenateStrings("{", " '", ",", "'", " }", missingValues)));
buffer.append("\">"); buffer.append(eol); for (final String value : attribute.getValues()) { buffer.append("\t\t\t\t<dsml:value>"); buffer.append(value);
/** * {@inheritDoc} */ @Override() public void formatSearchResultEntry(final SearchResultEntry entry) { jsonBuffer.clear(); jsonBuffer.beginObject(); jsonBuffer.appendString("result-type", "entry"); jsonBuffer.appendString("dn", entry.getDN()); jsonBuffer.beginArray("attributes"); for (final Attribute a : entry.getAttributes()) { jsonBuffer.beginObject(); jsonBuffer.appendString("name", a.getName()); jsonBuffer.beginArray("values"); for (final String value : a.getValues()) { jsonBuffer.appendString(value); } jsonBuffer.endArray(); jsonBuffer.endObject(); } jsonBuffer.endArray(); handleControls(entry.getControls()); jsonBuffer.endObject(); ldapSearch.writeOut(jsonBuffer.toString()); }