Package org.apache.directory.shared.ldap.name

Examples of org.apache.directory.shared.ldap.name.Rdn


    public void testMoveAndRenameSuperiorHasReferralAncestorCoreAPIWithManageDsaIT() throws Exception
    {
        CoreSession coreSession = service.getAdminSession();
        DN dn = new DN( "cn=Emmanuel Lecharny,ou=apache,ou=Roles,o=MNN,c=WW,ou=system" );
        DN newParent = new DN( "o=PNN,c=WW,ou=system" );
        RDN newRdn = new RDN( "cn=Alex" );
       
        try
        {
            coreSession.moveAndRename( dn, newParent, newRdn, false, true );
            fail();
View Full Code Here


    public void testMoveAndRenameIsReferralCoreAPIWithoutManageDsaIT() throws Exception
    {
        CoreSession coreSession = service.getAdminSession();
        DN dn = new DN( "cn=Emmanuel Lecharny,ou=Roles,o=MNN,c=WW,ou=system" );
        DN newParent = new DN( "o=PNN,c=WW,ou=system" );
        RDN newRdn = new RDN( "cn=Alex" );
       
        try
        {
            coreSession.moveAndRename( dn, newParent, newRdn, false, false );
            fail();
View Full Code Here

    public void testMoveAndRenameIsReferralCoreAPIWithManageDsaIT() throws Exception
    {
        CoreSession coreSession = service.getAdminSession();
        DN dn = new DN( "cn=Emmanuel Lecharny,ou=apache,ou=Roles,o=MNN,c=WW,ou=system" );
        DN newParent = new DN( "o=PNN,c=WW,ou=system" );
        RDN newRdn = new RDN( "cn=Alex" );
       
        try
        {
            coreSession.moveAndRename( dn, newParent, newRdn, false, true );
            fail();
View Full Code Here

        {
            throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION,
                I18n.err( I18n.ERR_361 ) );
        }

        RDN rdn = newParent.getRdn();
       
        if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals(
            SchemaConstants.OU_AT_OID ) )
        {
            throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION,
                I18n.err( I18n.ERR_362 ) );
        }

        if ( !( ( String ) rdn.getNormValue() ).equalsIgnoreCase( SchemaConstants.MATCHING_RULES_AT ) )
        {
            throw new LdapInvalidDnException( ResultCodeEnum.NAMING_VIOLATION,
                I18n.err( I18n.ERR_363 ) );
        }
    }
View Full Code Here

        Entry entry = new DefaultClientEntry( new DN( "ou=users,ou=groups,ou=system" ) );
        entry.add( SchemaConstants.OBJECT_CLASS_AT, "OrganizationalUnit" );
        entry.add( SchemaConstants.OU_AT, "users" );
       
        connection.add( entry );
        ModifyDnResponse resp = connection.rename( entry.getDn(), new RDN( "ou=users" ) );
        assertEquals( ResultCodeEnum.ENTRY_ALREADY_EXISTS, resp.getLdapResult().getResultCode() );

        Entry userzEntry = new DefaultClientEntry( new DN( "ou=userz,ou=groups,ou=system" ) );
        userzEntry.add( SchemaConstants.OBJECT_CLASS_AT, "OrganizationalUnit" );
        userzEntry.add( SchemaConstants.OU_AT, "userz" );
View Full Code Here

                session.delete( dn );
                break;
               
            case( ChangeType.MODDN_ORDINAL ):
            case( ChangeType.MODRDN_ORDINAL ):
                RDN newRdn = new RDN( entry.getNewRdn() );
           
                if ( entry.getNewSuperior() != null )
                {
                    // It's a move. The superior have changed
                    // Let's see if it's a rename too
                    RDN oldRdn = dn.getRdn();
                    DN newSuperior = new DN( entry.getNewSuperior() );
                   
                    if ( dn.size() == 0 )
                    {
                        throw new IllegalStateException( I18n.err( I18n.ERR_475 ) );
                    }
                    else if ( oldRdn.equals( newRdn ) )
                    {
                        // Same rdn : it's a move
                        session.move( dn, newSuperior );
                    }
                    else
View Full Code Here

        oldBase.remove( oldDn.size() - 1 );
        DN newBase = ( DN ) newDn.clone();
        newBase.remove( newDn.size() - 1 );

        // Compute the RDN for each of the DN
        RDN newRdn = newDn.getRdn( newDn.size() - 1 );
        RDN oldRdn = oldDn.getRdn( oldDn.size() - 1 );

        /*
         * We need to determine if this rename operation corresponds to a simple
         * RDN name change or a move operation.  If the two names are the same
         * except for the RDN then it is a simple modifyRdn operation.  If the
         * names differ in size or have a different baseDN then the operation is
         * a move operation.  Furthermore if the RDN in the move operation
         * changes it is both an RDN change and a move operation.
         */
        if ( ( oldDn.size() == newDn.size() ) && oldBase.equals( newBase ) )
        {
            adminSession.rename( oldDn, newRdn, delOldRdn );
        }
        else
        {
            DN target = ( DN ) newDn.clone();
            target.remove( newDn.size() - 1 );

            if ( newRdn.equals( oldRdn ) )
            {
                adminSession.move( oldDn, target );
            }
            else
            {
                adminSession.moveAndRename( oldDn, target, new RDN( newRdn ), delOldRdn );
            }
        }
    }
View Full Code Here

     */
    protected void doMoveAndRenameOperation( DN oldDn, DN parent, RDN newRdn, boolean delOldDn )
        throws Exception
    {
        // setup the op context and populate with request controls
        MoveAndRenameOperationContext opCtx = new MoveAndRenameOperationContext( session, oldDn, parent, new RDN(
            newRdn ), delOldDn );
        opCtx.addRequestControls( JndiUtils.fromJndiControls( requestControls ) );

        // Inject the referral handling into the operation context
        injectReferralControl( opCtx );
View Full Code Here

        {
            throw new SchemaViolationException( I18n.err( I18n.ERR_491, name) );
        }

        // Now add the CN attribute, which is mandatory
        RDN rdn = target.getRdn();

        if ( rdn != null )
        {
            if ( SchemaConstants.CN_AT.equals( rdn.getNormType() ) )
            {
                serverEntry.put( rdn.getUpType(), ( String ) rdn.getUpValue() );
            }
            else
            {
                // No CN in the rdn, this is an error
                throw new SchemaViolationException( I18n.err( I18n.ERR_491, name) );
View Full Code Here


    private void injectRdnAttributeValues( DN target, ServerEntry serverEntry ) throws NamingException
    {
        // Add all the RDN attributes and their values to this entry
        RDN rdn = target.getRdn( target.size() - 1 );

        if ( rdn.size() == 1 )
        {
            serverEntry.put( rdn.getUpType(), ( String ) rdn.getNormValue() );
        }
        else
        {
            for ( AVA atav : rdn )
            {
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.name.Rdn

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.