/** * @return Returns the currentAttribute type. */ public String getCurrentAttributeType() { return currentAttribute.getId(); }
/** * Return the current attribute's type */ public String getCurrentAttributeType() { return currentAttribute.getId(); }
/** * @return Returns the currentAttributeValue. */ public String getCurrentAttributeValueType() { return currentAttributeValue.getId(); } }
/** * <p> * Creates a new instance of DefaultClientEntry, with a * DN and a list of EntryAttributes. * </p> * * @param dn The DN for this serverEntry. Can be null * @param attributes The list of attributes to create */ public DefaultClientEntry( DN dn, EntryAttribute... attributes ) { this.dn = dn; for ( EntryAttribute attribute:attributes ) { if ( attribute == null ) { continue; } // Store a new ClientAttribute this.attributes.put( attribute.getId(), attribute ); } }
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; }
/** * @see Externalizable#readExternal(ObjectInput) */ public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException { // Read the DN dn = (DN)in.readObject(); // Read the number of attributes int nbAttributes = in.readInt(); // Read the attributes for ( int i = 0; i < nbAttributes; i++ ) { // Read each attribute EntryAttribute attribute = (DefaultClientAttribute)in.readObject(); attributes.put( attribute.getId(), attribute ); } }
/** * Add a modification item (used by modify operations) * * @param modification The modification to be added */ public void addModificationItem( Modification modification ) { if ( changeType == ChangeType.Modify ) { modificationList.add( modification ); modificationItems.put( modification.getAttribute().getId(), modification ); } }
if ( !this.attributes.containsKey( attribute.getId() ) )
/** * @return A string that represent the atributes list */ private String buildAttributes() { StringBuffer sb = new StringBuffer(); if ( attributes != null ) { boolean isFirst = true; if ( ( attributes != null ) && ( attributes.size() != 0 ) ) { // encode each attribute for ( EntryAttribute attribute:attributes ) { if ( isFirst ) { isFirst = false; } else { sb.append( ", " ); } sb.append( attribute != null ? attribute.getId() : "<no ID>" ); } } } return sb.toString(); }
/** * Add a modification item (used by modify operations) * * @param modOp The operation. One of : * - ModificationOperation.ADD_ATTRIBUTE * - ModificationOperation.REMOVE_ATTRIBUTE * - ModificationOperation.REPLACE_ATTRIBUTE * * @param attr The attribute to be added */ public void addModificationItem( ModificationOperation modOp, EntryAttribute attr ) { if ( changeType == ChangeType.Modify ) { Modification item = new ClientModification( modOp, attr ); modificationList.add( item ); modificationItems.put( attr.getId(), item ); } }
if ( !attribute.getId().equals( "objectclass" ) )
String id = attribute.getId();
/** * 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 ); } } }
sb.append( " ").append( attribute.getId() ).append( ":\n" );
clone.attributes.put( attribute.getId(), attribute.clone() );
/** * Converts an {@link EntryAttribute} to an {@link Attribute}. * * @param entryAttribute * the {@link EntryAttribute} to convert * @return * the equivalent {@link Attribute} */ public static Attribute toAttribute( EntryAttribute entryAttribute ) { if ( entryAttribute != null ) { Attribute attribute = new BasicAttribute( entryAttribute.getId() ); // Looping on values for ( Iterator<Value<?>> valueIterator = entryAttribute.iterator(); valueIterator.hasNext(); ) { Value<?> value = valueIterator.next(); attribute.add( value.get() ); } return attribute; } return null; }
public ServerModification( SchemaManager schemaManager, Modification modification ) { operation = modification.getOperation(); EntryAttribute modAttribute = modification.getAttribute(); try { AttributeType at = null; if ( modAttribute instanceof DefaultServerAttribute ) { at = ((EntryAttribute)modAttribute).getAttributeType(); } else { at = schemaManager.lookupAttributeTypeRegistry( modAttribute.getId() ); } attribute = new DefaultServerAttribute( at, modAttribute ); } catch ( LdapException ne ) { // The attributeType is incorrect. Log, but do nothing otherwise. LOG.error( I18n.err( I18n.ERR_04472, modAttribute.getId() ) ); } }
/** * Verifies that an entry exists in the directory with the * specified attributes. * * @param entry the entry to verify * @throws NamingException if there are problems accessing the entry */ protected void verify( LdifEntry entry ) throws Exception { Entry readEntry = rootDSE.lookup( entry.getDn() ); for ( EntryAttribute readAttribute:readEntry ) { String id = readAttribute.getId(); EntryAttribute origAttribute = entry.getEntry().get( id ); for ( Value<?> value:origAttribute ) { if ( ! readAttribute.contains( value ) ) { LOG.error( "Failed to verify entry addition of {}. {} attribute in original " + "entry missing from read entry.", entry.getDn(), id ); throw new AssertionFailedError( "Failed to verify entry addition of " + entry.getDn() ); } } } }
/** * Verifies that an entry exists in the directory with the specified attributes. * * @param entry the entry to verify * @throws NamingException if there are problems accessing the entry */ protected void verify( LdifEntry entry ) throws Exception { Entry readEntry = rootDSE.lookup( entry.getDn() ); for ( EntryAttribute readAttribute : readEntry ) { String id = readAttribute.getId(); EntryAttribute origAttribute = entry.getEntry().get( id ); for ( Value<?> value : origAttribute ) { if ( !readAttribute.contains( value ) ) { logger.error( "Failed to verify entry addition of " + entry.getDn() + ". " + id + " attribute in original " + "entry missing from read entry." ); throw new AssertionFailedError( "Failed to verify entry addition of " + entry.getDn() ); } } } }