ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/StringAnonymizer.java [80:123]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public Attribute anonymize( Map<Value, Value> valueMap, Set<Value> valueSet, Attribute attribute )
    {
        AttributeType attributeType = attribute.getAttributeType();
        Attribute result = new DefaultAttribute( attributeType );

        for ( Value value : attribute )
        {
            if ( value.isHumanReadable() )
            {
                Value anonymized =  valueMap.get( value );
                
                if ( anonymized != null )
                {
                    try
                    {
                        result.add( anonymized );
                    }
                    catch ( LdapInvalidAttributeValueException e )
                    {
                        // TODO : handle that
                    }
                }
                else
                {
                    String strValue = value.getString();
                    String newValue = computeNewValue( strValue );
                    
                    try
                    {
                        result.add( newValue );
                        Value anonValue = new Value( attribute.getAttributeType(), newValue );
                        valueMap.put( ( Value ) value, anonValue );
                        valueSet.add( anonValue );
                    }
                    catch ( LdapInvalidAttributeValueException e )
                    {
                        throw new RuntimeException( I18n.err( I18n.ERR_13436_ERROR_ANONYMIZING_VALUE, strValue ) );
                    }
                }
            }
        }

        return result;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/anonymizer/CaseSensitiveStringAnonymizer.java [80:122]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public Attribute anonymize( Map<Value, Value> valueMap, Set<Value> valueSet, Attribute attribute )
    {
        AttributeType attributeType = attribute.getAttributeType();
        Attribute result = new DefaultAttribute( attributeType );

        for ( Value value : attribute )
        {
            if ( value.isHumanReadable() )
            {
                Value anonymized =  valueMap.get( value );
                
                if ( anonymized != null )
                {
                    try
                    {
                        result.add( anonymized );
                    }
                    catch ( LdapInvalidAttributeValueException e )
                    {
                    }
                }
                else
                {
                    String strValue = value.getString();
                    String newValue = computeNewValue( strValue );
                    
                    try
                    {
                        result.add( newValue );
                        Value anonValue = new Value( attribute.getAttributeType(), newValue );
                        valueMap.put( ( Value ) value, anonValue );
                        valueSet.add( anonValue );
                    }
                    catch ( LdapInvalidAttributeValueException e )
                    {
                        throw new RuntimeException( I18n.err( I18n.ERR_13436_ERROR_ANONYMIZING_VALUE, strValue ) );
                    }
                }
            }
        }

        return result;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



