/** * Retrieves an attribute that is equivalent to this compact attribute. * * @return An attribute that is equivalent to this compact attribute. */ Attribute toAttribute() { return new Attribute(name, values); } }
/** * Creates a new LDAP attribute with the specified name and value. * * @param attrName The name for this attribute. * @param attrBytes The value for this attribute. */ public LDAPAttribute(final String attrName, final byte[] attrBytes) { attribute = new Attribute(attrName, attrBytes); }
/** * Creates a new LDAP attribute with the specified name and values. * * @param attrName The name for this attribute. * @param attrStrings The values for this attribute. */ public LDAPAttribute(final String attrName, final String[] attrStrings) { attribute = new Attribute(attrName, attrStrings); }
/** * Creates a new LDAP attribute with the specified name and no values. * * @param attrName The name for this attribute. */ public LDAPAttribute(final String attrName) { attribute = new Attribute(attrName); }
/** * Retrieves an attribute that is equivalent to this compact attribute. * * @return An attribute that is equivalent to this compact attribute. */ Attribute toAttribute() { return new Attribute(name, values); } }
/** * Creates a new LDAP attribute with the specified name and value. * * @param attrName The name for this attribute. * @param attrString The value for this attribute. */ public LDAPAttribute(final String attrName, final String attrString) { attribute = new Attribute(attrName, attrString); }
/** * {@inheritDoc} */ @Override() protected List<Attribute> getAdditionalAttributes() { return Arrays.asList(new Attribute(ATTR_BACKEND_ID, backendID)); }
/** * {@inheritDoc} */ @Override() protected List<Attribute> getAdditionalAttributes() { return Arrays.asList(new Attribute(ATTR_SCHEMA_FILE, schemaFileNames)); }
/** * Converts this LDIF attribute to an SDK attribute. * * @return An SDK attribute with the name and values of this LDIF attribute. */ Attribute toAttribute() { final ASN1OctetString[] valueArray = new ASN1OctetString[values.size()]; values.toArray(valueArray); return new Attribute(name, matchingRule, valueArray); } }
/** * {@inheritDoc} */ @Override() protected List<Attribute> getAdditionalAttributes() { final ArrayList<Attribute> attrs = new ArrayList<Attribute>(1); if(reason != null) { attrs.add(new Attribute(ATTR_LEAVE_LOCKDOWN_REASON, reason)); } return attrs; }
/** * Converts this LDIF attribute to an SDK attribute. * * @return An SDK attribute with the name and values of this LDIF attribute. */ Attribute toAttribute() { final ASN1OctetString[] valueArray = new ASN1OctetString[values.size()]; values.toArray(valueArray); return new Attribute(name, matchingRule, valueArray); } }
/** * Retrieves the attribute for this modification. * * @return The attribute for this modification. */ public Attribute getAttribute() { return new Attribute(attributeName, CaseIgnoreStringMatchingRule.getInstance(), values); }
/** * Retrieves the attribute for this modification. * * @return The attribute for this modification. */ public Attribute getAttribute() { return new Attribute(attributeName, CaseIgnoreStringMatchingRule.getInstance(), values); }
/** * Adds the provided value to the set of values for this attribute. * * @param attrString The value to add to this attribute. */ public void addValue(final String attrString) { attribute = Attribute.mergeAttributes(attribute, new Attribute(attribute.getName(), attrString)); }
/** * Adds the provided value to the set of values for this attribute. * * @param attrBytes The value to add to this attribute. */ public void addValue(final byte[] attrBytes) { attribute = Attribute.mergeAttributes(attribute, new Attribute(attribute.getName(), attrBytes)); }
/** * Adds the provided attribute to the entry to add. * * @param name The name of the attribute to add. It must not be * {@code null}. * @param values The set of values for the attribute to add. It must not be * {@code null}. */ public void addAttribute(final String name, final String... values) { ensureNotNull(name, values); addAttribute(new Attribute(name, values)); }
/** * Removes the provided value from this attribute. * * @param attrValue The value to remove. */ public void removeValue(final String attrValue) { attribute = Attribute.removeValues(attribute, new Attribute(attribute.getName(), attrValue)); }
/** * Removes the provided value from this attribute. * * @param attrValue The value to remove. */ public void removeValue(final byte[] attrValue) { attribute = Attribute.removeValues(attribute, new Attribute(attribute.getName(), attrValue)); }
/** * Adds the provided attribute to the entry to add. * * @param name The name of the attribute to add. It must not be * {@code null}. * @param values The set of values for the attribute to add. It must not be * {@code null}. */ public void addAttribute(final String name, final byte[]... values) { ensureNotNull(name, values); addAttribute(new Attribute(name, values)); }
private LDAPInterface someLdapInterfaceReturning(String... roles) throws LDAPSearchException { final LDAPInterface ldap = mock(LDAPInterface.class); final List<SearchResultEntry> entries = singletonList( new SearchResultEntry("", singleton(new Attribute("cn", roles)))); final SearchResult searchResult = new SearchResult(0, null, null, null, null, entries, emptyList(), 1, 0, null); when(ldap.search(any(SearchRequest.class))).thenReturn(searchResult); return ldap; } }