if ( request.getDerefAliases() != previousSearchRequest.getDerefAliases() )
{
return false;
}
SchemaManager schemaManager =
session.getLdapServer().getDirectoryService().getSchemaManager();
// Compares the attributes
if ( request.getAttributes() == null )
{
if ( previousSearchRequest.getAttributes() != null )
{
return false;
}
}
else
{
if ( previousSearchRequest.getAttributes() == null )
{
return false;
}
else
{
// We have to normalize the attributes in order to compare them
if ( request.getAttributes().size() != previousSearchRequest.getAttributes().size() )
{
return false;
}
// Build the set of attributeType from both requests
Set<String> requestSet = buildAttributeSet( request, session, schemaManager );
Set<String> previousRequestSet = buildAttributeSet( previousSearchRequest, session, schemaManager );
// Check that both sets have the same size again after having converted
// the attributes to OID
if ( requestSet.size() != previousRequestSet.size() )
{
return false;
}
for ( String attribute:requestSet )
{
previousRequestSet.remove( attribute );
}
// The other set must be empty
if ( !previousRequestSet.isEmpty() )
{
return false;
}
}
}
// Compare the baseDN
try
{
request.getBase().normalize( schemaManager.getNormalizerMapping() );
if ( !previousSearchRequest.getBase().isNormalized() )
{
previousSearchRequest.getBase().normalize( schemaManager.getNormalizerMapping() );
}
if ( !request.getBase().equals( previousSearchRequest.getBase() ) )
{
return false;