IAttribute attribute = entry.getAttribute( attributeDescription );
if ( attribute != null )
{
if ( attribute.getValueSize() == 0 )
{
new CreateValuesJob( attribute, newRawValue ).execute();
}
else if ( attribute.getValueSize() == 1 )
{
this.modifyValue( attribute.getValues()[0], newRawValue );
}
}
}
else
{
EventRegistry.suspendEventFireingInCurrentThread();
IAttribute attribute = new Attribute( entry, attributeDescription );
entry.addAttribute( attribute );
EventRegistry.resumeEventFireingInCurrentThread();
Object newValue;
if ( SchemaUtils.isString( entry.getBrowserConnection().getSchema().getAttributeTypeDescription(
attributeDescription ), entry.getBrowserConnection().getSchema() ) )
{
if ( newRawValue instanceof String )
{
newValue = ( String ) newRawValue;
}
else
{
newValue = LdifUtils.utf8decode( ( byte[] ) newRawValue );
}
}
else
{
if ( newRawValue instanceof String )
{
newValue = LdifUtils.utf8encode( ( String ) newRawValue );
}
else
{
newValue = ( byte[] ) newRawValue;
}
}
new CreateValuesJob( attribute, newValue ).execute();
}
}
}