/** * {@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; }
public SearchResult next() throws NamingException { Entry entry = null; try { entry = cursor.get(); if ( cursor.next() ) { available = true; } else { available = false; cursor.close(); } } catch ( Exception e ) { JndiUtils.wrap( e ); } SearchResult result = new SearchResult( entry.getDn().getName(), null, ServerEntryUtils.toBasicAttributes( entry ) ); result.setRelative( false ); return result; }
cursor.beforeFirst(); while ( cursor.next() ) Entry entry = cursor.get(); cursor.close();
cursor.beforeFirst(); while ( cursor.next() ) Entry entry = cursor.get();
cursor.beforeFirst(); int nbEntry = 0; while ( cursor.next() && ( nbEntry < 2 ) ) cursor.close();
private void dumpLdapContents() throws Exception { EntryFilteringCursor cursor = getService().getAdminSession().search(new Dn("ou=system"), SearchScope.SUBTREE, new PresenceNode("ObjectClass"), AliasDerefMode.DEREF_ALWAYS); String st = ""; while (cursor.next()) { Entry entry = cursor.get(); String ss = LdifUtils.convertToLdif(entry); st += ss + "\n"; } System.out.println(st); cursor = getService().getAdminSession().search(new Dn("dc=example,dc=com"), SearchScope.SUBTREE, new PresenceNode("ObjectClass"), AliasDerefMode.DEREF_ALWAYS); st = ""; while (cursor.next()) { Entry entry = cursor.get(); String ss = LdifUtils.convertToLdif(entry); st += ss + "\n"; } System.out.println(st); }
/** * {@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 boolean addEntryFilter( EntryFilter filter ) { for ( EntryFilteringCursor efc : list ) { efc.addEntryFilter( filter ); } // returning hard coded value, shouldn't be a problem return true; }
if ( cursor.first() ) cursor.beforeFirst(); cursors.add( cursor );
/** * {@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(); }
cursor.beforeFirst(); while ( cursor.next() ) Entry entry = cursor.get(); cursor.close();
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; }