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

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


    public void testRenameExistingReferralCoreAPIWithManageDsaIt() throws Exception
    {
        CoreSession session = service.getAdminSession();
        DN dnRoles = new DN( "ou=Roles,o=MNN,c=WW,ou=system" );
        DN dnGroups = new DN( "ou=Groups,o=MNN,c=WW,ou=system" );
        RDN newRdn = new RDN( "ou=Groups" );

        // First check that the object exists
        ServerEntry renamed = session.lookup( dnRoles );
        assertNotNull( renamed );
View Full Code Here


    @Test
    public void testRenameRdnExistIsReferralCoreAPIWithoutManageDsaIt() throws Exception
    {
        CoreSession session = service.getAdminSession();
        DN dn = new DN( "ou=Roles,o=MNN,c=WW,ou=system" );
        RDN newRdn = new RDN( "ou=People" );

        try
        {
            session.rename( dn, newRdn, false, false );
            fail();
View Full Code Here

    @Test
    public void testRenameRdnExistIsReferralCoreAPIWithManageDsaIt() throws Exception
    {
        CoreSession session = service.getAdminSession();
        DN dn = new DN( "ou=Roles,o=MNN,c=WW,ou=system" );
        RDN newRdn = new RDN( "ou=People" );

        try
        {
            session.rename( dn, newRdn, false, true );
            fail();
View Full Code Here

         * new RDN.
         */

        if ( deleteOldRdn )
        {
            RDN oldRdn = updn.getRdn();
            for ( AVA oldAtav : oldRdn )
            {
                // check if the new ATAV is part of the old RDN
                // if that is the case we do not remove the ATAV
                boolean mustRemove = true;
View Full Code Here

        {
            throw new LdapInvalidNameException( I18n.err( I18n.ERR_396 ),
                ResultCodeEnum.NAMING_VIOLATION );
        }

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

        if ( !( ( String ) rdn.getNormValue() ).equalsIgnoreCase( SchemaConstants.SYNTAX_CHECKERS_AT ) )
        {
            throw new LdapInvalidNameException( I18n.err( I18n.ERR_372 ),
                ResultCodeEnum.NAMING_VIOLATION );
        }
    }
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

            throw new LdapInvalidNameException(
                "The parent dn of a objectClass should be at most 3 name components in length.",
                ResultCodeEnum.NAMING_VIOLATION );
        }

        RDN rdn = newParent.getRdn();

        if ( !schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals(
            SchemaConstants.OU_AT_OID ) )
        {
            throw new LdapInvalidNameException( I18n.err( I18n.ERR_376 ),
                ResultCodeEnum.NAMING_VIOLATION );
        }

        if ( !( ( String ) rdn.getNormValue() ).equalsIgnoreCase( SchemaConstants.OBJECT_CLASSES_AT ) )
        {
            throw new LdapInvalidNameException( I18n.err( I18n.ERR_377 ),
                ResultCodeEnum.NAMING_VIOLATION );
        }
    }
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

        if ( dn == null )
        {
            return null;
        }

        RDN rdn = dn.getRdn( 1 );
       
        if ( !rdn.getNormType().equalsIgnoreCase( CN_OID ) )
        {
            throw new NamingException( I18n.err( I18n.ERR_434, dn.toNormName(), CN_OID, rdn.getNormType() ) );
        }

        return ( String ) rdn.getNormValue();
    }
View Full Code Here

        entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
        entry.add( "entryUUID", UUID.randomUUID().toString() );

        store.add( entry );

        RDN rdn = new RDN( "sn=James" );

        store.rename( dn, rdn, true );
    }
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.