in protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/controls/PagedSearchContext.java [159:269]
public boolean hasSameRequest( SearchRequest request, LdapSession session )
{
// Compares the scope
if ( request.getScope() != previousSearchRequest.getScope() )
{
return false;
}
// Compares the sizeLimit
if ( request.getSizeLimit() != previousSearchRequest.getSizeLimit() )
{
return false;
}
// Compares the timeLimit
if ( request.getTimeLimit() != previousSearchRequest.getTimeLimit() )
{
return false;
}
// Compares the TypesOnly
if ( request.getTypesOnly() != previousSearchRequest.getTypesOnly() )
{
return false;
}
// Compares the deref aliases mode
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, schemaManager );
Set<String> previousRequestSet = buildAttributeSet( previousSearchRequest, 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
{
if ( !request.getBase().isSchemaAware() )
{
request.setBase( new Dn( schemaManager, request.getBase() ) );
}
if ( !previousSearchRequest.getBase().isSchemaAware() )
{
previousSearchRequest.setBase( new Dn( schemaManager, previousSearchRequest.getBase() ) );
}
if ( !request.getBase().equals( previousSearchRequest.getBase() ) )
{
return false;
}
}
catch ( LdapException le )
{
return false;
}
// Compare the filters
// Here, we assume the user hasn't changed the filter's order or content,
// as the filter is not normalized. This is a real problem, as the normalization
// phase is done in the interceptor chain, which is a bad decision wrt what we
// do here.
return true; //request.getFilter().equals( previousSearchRequest.getFilter() );
}