// add returning attributes for children and alias detection
SearchParameter searchParameter = getSearchParameter( search );
ArrayList<ISearchResult> searchResultList = new ArrayList<ISearchResult>();
ArrayList<SearchContinuation> searchContinuationList = new ArrayList<SearchContinuation>();
StudioNamingEnumeration enumeration = null;
// search
try
{
enumeration = search( browserConnection, searchParameter, monitor );
// iterate through the search result
while ( !monitor.isCanceled() && enumeration != null && enumeration.hasMore() )
{
StudioSearchResult sr = ( StudioSearchResult ) enumeration.next();
boolean isContinuedSearchResult = sr.isContinuedSearchResult();
LdapUrl searchContinuationUrl = sr.getSearchContinuationUrl();
if ( searchContinuationUrl == null )
{
Dn dn = JNDIUtils.getDn( sr );
IEntry entry = null;
Connection resultConnection = sr.getConnection();
IBrowserConnection resultBrowserConnection = BrowserCorePlugin.getDefault()
.getConnectionManager().getBrowserConnection( resultConnection );
if ( resultBrowserConnection == null )
{
resultBrowserConnection = browserConnection;
}
// get entry from cache or create it
entry = resultBrowserConnection.getEntryFromCache( dn );
if ( entry == null )
{
entry = createAndCacheEntry( resultBrowserConnection, dn, monitor );
// If the entry is still null, we return
// See https://issues.apache.org/jira/browse/DIRSTUDIO-865
if ( entry == null )
{
return;
}
}
// initialize special flags
initFlags( entry, sr, searchParameter );
// fill the attributes
fillAttributes( entry, sr, search.getSearchParameter() );
if ( isContinuedSearchResult )
{
// the result is from a continued search
// we create a special entry that displays the URL of the entry
entry = new ContinuedSearchResultEntry( resultBrowserConnection, dn );
}
searchResultList
.add( new org.apache.directory.studio.ldapbrowser.core.model.impl.SearchResult( entry,
search ) );
}
else
{
//entry = new ContinuedSearchResultEntry( resultBrowserConnection, dn );
SearchContinuation searchContinuation = new SearchContinuation( search,
searchContinuationUrl );
searchContinuationList.add( searchContinuation );
}
monitor
.reportProgress( searchResultList.size() == 1 ? BrowserCoreMessages.model__retrieved_1_entry
: BrowserCoreMessages.bind( BrowserCoreMessages.model__retrieved_n_entries,
new String[]
{ Integer.toString( searchResultList.size() ) } ) );
}
}
catch ( Exception e )
{
int ldapStatusCode = JNDIUtils.getLdapStatusCode( e );
if ( ldapStatusCode == 3 || ldapStatusCode == 4 || ldapStatusCode == 11 )
{
search.setCountLimitExceeded( true );
}
else
{
monitor.reportError( e );
}
}
// check for response controls
try
{
if ( enumeration != null )
{
Control[] jndiControls = enumeration.getResponseControls();
if ( jndiControls != null )
{
for ( Control jndiControl : jndiControls )
{
if ( jndiControl instanceof PagedResultsResponseControl )