}
/* no protection*/static AttributeType getCaseIgnoringAttributeNoNumbersType()
{
MutableAttributeType attributeType = new MutableAttributeType( "1.1.3.1" );
LdapSyntax syntax = new LdapSyntax( "1.1.1.1", "", true );
syntax.setSyntaxChecker( new SyntaxChecker( "1.1.2.1" )
{
public boolean isValidSyntax( Object value )
{
if ( value == null )
{
return true;
}
if ( !( value instanceof String ) )
{
return false;
}
String strval = ( String ) value;
for ( char c : strval.toCharArray() )
{
if ( Character.isDigit( c ) )
{
return false;
}
}
return true;
}
} );
MutableMatchingRule matchingRule = new MutableMatchingRule( "1.1.2.1" );
matchingRule.setSyntax( syntax );
matchingRule.setLdapComparator( new LdapComparator<String>( matchingRule.getOid() )
{
public int compare( String o1, String o2 )
{
return ( o1 == null ?
( o2 == null ? 0 : -1 ) :
( o2 == null ? 1 : o1.compareTo( o2 ) ) );
}
} );
Normalizer normalizer = new Normalizer( "1.1.1" )
{
public Value<?> normalize( Value<?> value ) throws LdapException
{
if ( value.isHumanReadable() )
{
return new StringValue( Strings.toLowerCase( value.getString() ) );
}
throw new IllegalStateException( I18n.err( I18n.ERR_04474 ) );
}
public String normalize( String value ) throws LdapException
{
return Strings.toLowerCase( value );
}
};
matchingRule.setNormalizer( normalizer );
attributeType.setEquality( matchingRule );
attributeType.setSyntax( syntax );
return attributeType;
}