/** * Tells if an entry has a specific ObjectClass value * * @param objectClass The ObjectClass we want to check * @return <code>true</code> if the ObjectClass value is present * in the ObjectClass attribute */ public boolean hasObjectClass( String objectClass ) { return contains( "objectclass", objectClass ); }
public List<EntryAttribute> remove( EntryAttribute... attributes ) throws LdapException { List<EntryAttribute> removedAttributes = new ArrayList<EntryAttribute>(); for ( EntryAttribute attribute:attributes ) { if ( contains( attribute.getId() ) ) { this.attributes.remove( attribute.getId() ); removedAttributes.add( attribute ); } } return removedAttributes; }
/** * Add some Attributes to the current Entry. * * @param attributes The attributes to add * @throws LdapException If we can't add any of the attributes */ public void add( EntryAttribute... attributes ) throws LdapException { // Loop on all the added attributes for ( EntryAttribute attribute:attributes ) { // If the attribute already exist, we will add the new values. if ( contains( attribute ) ) { EntryAttribute existingAttr = get( attribute.getId() ); // Loop on all the values, and add them to the existing attribute for ( Value<?> value:attribute ) { existingAttr.add( value ); } } else { // Stores the attribute into the entry this.attributes.put( attribute.getId(), attribute ); } } }