/** * @see Object#toString() */ public String toString() { return toString( "" ); } }
/** * {@inheritDoc} */ public boolean addEntryFilter( EntryFilter filter ) { for ( EntryFilteringCursor efc : list ) { efc.addEntryFilter( filter ); } // returning hard coded value, shouldn't be a problem return true; }
/** * {@inheritDoc} */ public void setClosureMonitor( ClosureMonitor monitor ) { for ( EntryFilteringCursor c : list ) { c.setClosureMonitor( monitor ); } } }
/** * {@inheritDoc} */ public void close( Exception reason ) { if ( IS_DEBUG ) { LOG_CURSOR.debug( "Closing CursorList {}", this ); } closed = true; for ( EntryFilteringCursor cursor : list ) { try { if ( reason != null ) { cursor.close( reason ); } else { cursor.close(); } } catch ( Exception e ) { LOG.warn( "Failed to close the cursor" ); } } }
/** * {@inheritDoc} */ public Entry get() throws CursorException { if ( ( index < start ) || ( index >= end ) ) { throw new CursorException( I18n.err( I18n.ERR_13109_CURSOR_NOT_POSITIONED ) ); } if ( currentCursor.available() ) { return currentCursor.get(); } throw new InvalidCursorPositionException(); }
/** * {@inheritDoc} */ public boolean next() throws LdapException, CursorException { if ( listSize > 0 ) { if ( index == -1 ) { index = start; } while ( index < end ) { currentCursor = list.get( index ); if ( currentCursor.next() ) { return true; } else { index++; } } } return false; }
/** * {@inheritDoc} */ public boolean first() throws LdapException, CursorException { if ( listSize > 0 ) { index = start; return list.get( index ).first(); } return false; }
/** * {@inheritDoc} */ public void beforeFirst() throws LdapException, CursorException { index = 0; currentCursor = list.get( index ); currentCursor.beforeFirst(); }
/** * {@inheritDoc} */ public boolean isFirst() { return ( listSize > 0 ) && ( index == start ) && list.get( index ).isFirst(); }
/** * {@inheritDoc} */ public void close() { if ( IS_DEBUG ) { LOG_CURSOR.debug( "Closing CursorList {}", this ); } close( null ); }
/** * {@inheritDoc} */ public boolean available() { if ( ( index >= 0 ) && ( index < end ) ) { return list.get( index ).available(); } return false; }
/** * {@inheritDoc} */ public boolean last() throws LdapException, CursorException { if ( listSize > 0 ) { index = end - 1; currentCursor = list.get( index ); return currentCursor.last(); } return false; }
/** * {@inheritDoc} */ public void afterLast() throws LdapException, CursorException { index = end - 1; currentCursor = list.get( index ); currentCursor.afterLast(); }
/** * {@inheritDoc} */ public boolean isLast() { return ( listSize > 0 ) && ( index == end - 1 ) && list.get( index ).isLast(); }
/** * {@inheritDoc} */ public boolean previous() throws LdapException, CursorException { while ( index > -1 ) { currentCursor = list.get( index ); if ( currentCursor.previous() ) { return true; } else { index--; } } return false; }
/** * {@inheritDoc} */ public Entry get() throws InvalidCursorPositionException { if ( available() ) { return prefetched; } throw new InvalidCursorPositionException(); }
public void close() throws NamingException { try { cursor.close(); available = false; } catch ( Exception e ) { JndiUtils.wrap( e ); } }
public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException cursor.addEntryFilter( new EntryFilter()
/** * {@inheritDoc} */ @Override public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException { EntryFilteringCursor cursor = next( searchContext ); // only add collective attributes for non-syncrepl search if ( !searchContext.isSyncreplSearch() ) { cursor.addEntryFilter( searchFilter ); } return cursor; }