Package org.apache.directory.api.ldap.model.message.controls

Examples of org.apache.directory.api.ldap.model.message.controls.SortRequestControl


                   0x01, 0x01, 0x00
            } );
        buffer.flip();
       
        SortRequestDecorator decorator = new SortRequestDecorator( codec );
        SortRequestControl control = ( SortRequestControl ) decorator.decode( buffer.array() );
       
        assertEquals( 1, control.getSortKeys().size() );
       
        SortKey sk = control.getSortKeys().get( 0 );
        assertEquals( "cn", sk.getAttributeTypeDesc() );
        assertEquals( "oid", sk.getMatchingRuleId() );
        assertFalse( sk.isReverseOrder() );
       
        ByteBuffer encoded = ByteBuffer.allocate( buffer.capacity() );
View Full Code Here


                   0x01, 0x01, (byte)0xFF
            } );
        buffer.flip();
       
        SortRequestDecorator decorator = new SortRequestDecorator( codec );
        SortRequestControl control = ( SortRequestControl ) decorator.decode( buffer.array() );
       
        assertEquals( 2, control.getSortKeys().size() );
       
        SortKey sk = control.getSortKeys().get( 0 );
        assertEquals( "cn", sk.getAttributeTypeDesc() );
        assertEquals( "oid", sk.getMatchingRuleId() );
        assertFalse( sk.isReverseOrder() );
       
        sk = control.getSortKeys().get( 1 );
        assertEquals( "sn", sk.getAttributeTypeDesc() );
        assertEquals( "iod", sk.getMatchingRuleId() );
        assertTrue( sk.isReverseOrder() );
       
        ByteBuffer encoded = ByteBuffer.allocate( buffer.capacity() );
View Full Code Here

                   0x01, 0x01, 0x00
            } );
        buffer.flip();
       
        SortRequestDecorator decorator = new SortRequestDecorator( codec );
        SortRequestControl control = ( SortRequestControl ) decorator.decode( buffer.array() );
       
        assertEquals( 1, control.getSortKeys().size() );
       
        SortKey sk = control.getSortKeys().get( 0 );
        assertEquals( "cn", sk.getAttributeTypeDesc() );
        assertNull( sk.getMatchingRuleId() );
        assertFalse( sk.isReverseOrder() );
       
        ByteBuffer encoded = ByteBuffer.allocate( buffer.capacity() );
View Full Code Here

        searchContext.setSyncreplSearch( searchRequest.getControls().containsKey( SyncRequestValue.OID ) );

        OperationManager operationManager = directoryService.getOperationManager();

        // Check if we received serverside sort Control
        SortRequestControl sortControl = ( SortRequestControl ) searchRequest.getControls().get( SortRequestControl.OID );
       
        SortResponseControl sortRespCtrl = null;
       
        SearchResultDone done = searchRequest.getResultResponse();
       
        LdapResult ldapResult = done.getLdapResult();
       
        if( sortControl != null )
        {
            sortRespCtrl = canSort( sortControl, ldapResult, getDirectoryService().getSchemaManager() );
           
            if ( sortControl.isCritical() && ( sortRespCtrl.getSortResult() != SortResultCode.SUCCESS ) )
            {
                ldapResult.setResultCode( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION );
                done.addControl( sortRespCtrl );
               
                return new EmptyCursor<Entry>();
View Full Code Here

     */
    private void doInitialRefresh( LdapSession session, SearchRequest request ) throws Exception
    {
        PROVIDER_LOG.debug( "Starting an initial refresh" );

        SortRequestControl ctrl = ( SortRequestControl ) request.getControl( SortRequestControl.OID );

        if( ctrl != null )
        {
            PROVIDER_LOG.warn( "Removing the received sort control from the syncrepl search request during initial refresh" );
            request.removeControl( ctrl );
        }

        PROVIDER_LOG.debug( "Adding sort control to sort the entries by entryDn attribute to preserve order of insertion" );
        SortKey sk = new SortKey( SchemaConstants.ENTRY_DN_AT );
        // matchingrule for "entryDn"
        sk.setMatchingRuleId( "2.5.13.1" );
        sk.setReverseOrder( true );

        ctrl = new SortRequestControlImpl();
        ctrl.addSortKey( sk );

        request.addControl( ctrl );

        String originalFilter = request.getFilter().toString();
        InetSocketAddress address = ( InetSocketAddress ) session.getIoSession().getRemoteAddress();
View Full Code Here

        req.setDerefAliases( AliasDerefMode.NEVER_DEREF_ALIASES );
        // the ENTRY_DN_AT must be in the attribute list, otherwise sorting fails
        req.addAttributes( SchemaConstants.ENTRY_DN_AT );

        SortKey sk = new SortKey( SchemaConstants.ENTRY_DN_AT, "2.5.13.1" );
        SortRequestControl ctrl = new SortRequestControlImpl();
        ctrl.addSortKey( sk );
        req.addControl( ctrl );

        OperationManager operationManager = directoryService.getOperationManager();

        Cursor<Entry> cursor = session.search( req );
View Full Code Here

            // the ENTRY_DN_AT must be in the attribute list, otherwise sorting fails
            req.addAttributes( SchemaConstants.ENTRY_DN_AT );

            SortKey sk = new SortKey( SchemaConstants.ENTRY_DN_AT, "2.5.13.1" );

            SortRequestControl ctrl = new SortRequestControlImpl();
            ctrl.addSortKey( sk );
            req.addControl( ctrl );

            cursor = session.search( req );
            cursor.beforeFirst();
           
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.message.controls.SortRequestControl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.