/** * Parse an AttributeType/AttributeValue * * @param entry The entry where to store the value * @param line The line to parse * @param lowerLine The same line, lowercased * @throws LdapLdifException If anything goes wrong */ public void parseAttributeValue( LdifEntry entry, String line, String lowerLine ) throws LdapLdifException, LdapException { int colonIndex = line.indexOf( ':' ); String attributeType = lowerLine.substring( 0, colonIndex ); // We should *not* have a DN twice if ( attributeType.equals( "dn" ) ) { LOG.error( I18n.err( I18n.ERR_12002 ) ); throw new LdapLdifException( I18n.err( I18n.ERR_12003 ) ); } Object attributeValue = parseValue( line, colonIndex ); // Update the entry entry.addAttribute( attributeType, attributeValue ); }
/** * Compute a reverse LDIF of a DeleteRequest. We have to get the previous * entry in order to restore it. * * @param dn The deleted entry DN * @param deletedEntry The entry which has been deleted * @return A reverse LDIF */ public static LdifEntry reverseDel( DN dn, Entry deletedEntry ) throws LdapException { LdifEntry entry = new LdifEntry(); entry.setDn( dn ); entry.setChangeType( ChangeType.Add ); for ( EntryAttribute attribute : deletedEntry ) { entry.addAttribute( attribute ); } return entry; }
ldifEntry.addAttribute( SchemaConstants.ENTRY_UUID_AT, entryUuid.toString() );