public boolean isSatisfiedBy ( LdapAttributes record ) throws NamingException { if ( record != null ) { //DN is required. LdapName dn = record . getName ( ) ; if ( dn != null ) { //objectClass definition is required. if ( record . get ( "objectClass" ) != null ) { //Naming attribute is required. Rdn rdn = dn . getRdn ( dn . size ( ) - 1 ) ; if ( record . get ( rdn . getType ( ) ) != null ) { Object object = record . get ( rdn . getType ( ) ) . get ( ) ; if ( object instanceof String ) { String value = ( String ) object ; if ( ( ( String ) rdn . getValue ( ) ) . equalsIgnoreCase ( value ) ) { return true ; } } else if ( object instanceof byte [ ] ) { String rdnValue = LdapEncoder . printBase64Binary ( ( ( String ) rdn . getValue ( ) ) . getBytes ( ) ) ; String attributeValue = LdapEncoder . printBase64Binary ( ( byte [ ] ) object ) ; if ( rdnValue . equals ( attributeValue ) ) return true ; } } } } }
Determines if the policy is satisfied by the supplied LdapAttributes object .