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

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


        store.add( childEntry );

        DN parentDn = new DN( "ou=Sales,o=Good Times Co." );
        parentDn.normalize( schemaManager.getNormalizerMapping() );

        RDN rdn = new RDN( "cn=Ryan" );

        store.move( childDn, parentDn, rdn, true );

        // to drop the alias indices  
        childDn = new DN( "commonName=Jim Bean,ou=Apache,ou=Board of Directors,o=Good Times Co." );
View Full Code Here



    public void rename( NextInterceptor next, RenameOperationContext opContext ) throws Exception
    {
        DN oldDn = opContext.getDn();
        RDN newRdn = opContext.getNewRdn();
        boolean deleteOldRn = opContext.getDelOldDn();
        ServerEntry entry =  (ServerEntry)opContext.getEntry().getClonedEntry();

        /*
         *  Note: This is only a consistency checks, to the ensure that all
         *  mandatory attributes are available after deleting the old RDN.
         *  The real modification is done in the XdbmStore class.
         *  - TODO: this check is missing in the moveAndRename() method
         */
        if ( deleteOldRn )
        {
            ServerEntry tmpEntry = ( ServerEntry ) entry.clone();
            RDN oldRDN = oldDn.getRdn();

            // Delete the old RDN means we remove some attributes and values.
            // We must make sure that after this operation all must attributes
            // are still present in the entry.
            for ( AVA atav : oldRDN )
View Full Code Here

        if ( dn.size() < 2 )
        {
            throw new NamingException( I18n.err( I18n.ERR_276 ) );
        }
       
        RDN rdn = dn.getRdn( 1 );
        return ( String ) rdn.getNormValue();
    }
View Full Code Here

        forward.setDeleteOldRdn( opCtx.getDelOldDn() );
        forward.setNewRdn( opCtx.getNewRdn().getUpName() );
        forward.setNewSuperior( opCtx.getParent().getName() );

        List<LdifEntry> reverses = LdifRevertor.reverseMoveAndRename
            serverEntry, opCtx.getParent(), new RDN( opCtx.getNewRdn() ), false );
        opCtx.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverses ) );
    }
View Full Code Here

    {
        DN newDn = new DN();
       
        for ( int ii = 0; ii < dn.size(); ii++ )
        {
            RDN rdn = dn.getRdn( ii );
            if ( rdn.size() == 0 )
            {
                newDn.add( new RDN() );
                continue;
            }
            else if ( rdn.size() == 1 )
            {
                String name = schemaManager.lookupAttributeTypeRegistry( rdn.getNormType() ).getName();
                String value = rdn.getAtav().getNormValue().getString();
                newDn.add( new RDN( name, name, value, value ) );
                continue;
            }

            // below we only process multi-valued rdns
            StringBuffer buf = new StringBuffer();
       
            for ( Iterator<AVA> atavs = rdn.iterator(); atavs.hasNext(); /**/ )
            {
                AVA atav = atavs.next();
                String type = schemaManager.lookupAttributeTypeRegistry( rdn.getNormType() ).getName();
                buf.append( type ).append( '=' ).append( atav.getNormValue() );
               
                if ( atavs.hasNext() )
                {
                    buf.append( '+' );
                }
            }
           
            newDn.add( new RDN(buf.toString()) );
        }
       
        return newDn;
    }
View Full Code Here

        if ( newParent.size() != 3 )
        {
            throw new LdapInvalidNameException( I18n.err( I18n.ERR_370 ), 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_371 ), ResultCodeEnum.NAMING_VIOLATION );
        }

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

        if ( dn.size() < 2 )
        {
            throw new NamingException( I18n.err( I18n.ERR_276 ) );
        }
       
        RDN rdn = dn.getRdn( 1 );
        return ( String ) rdn.getNormValue();
    }
View Full Code Here

        if ( newParent.size() != 3 )
        {
            throw new LdapInvalidNameException( I18n.err( I18n.ERR_337 ), 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_338, objectType ),
                ResultCodeEnum.NAMING_VIOLATION );
        }
       
        if ( ! ( ( String ) rdn.getNormValue() ).equalsIgnoreCase( OBJECT_TYPE_TO_PATH.get( objectType ) ) )
        {
            throw new LdapInvalidNameException( I18n.err( I18n.ERR_339, objectType,  OBJECT_TYPE_TO_PATH.get( objectType ) ),
                ResultCodeEnum.NAMING_VIOLATION );
        }
    }
View Full Code Here

     */
    public ModifyDnResponse rename( String entryDn, String newRdn, boolean deleteOldRdn ) throws LdapException
    {
        try
        {
            return rename( new DN( entryDn ), new RDN( newRdn ), deleteOldRdn );
        }
        catch ( InvalidNameException e )
        {
            LOG.error( e.getMessage(), e );
            throw new LdapException( e.getMessage(), e );
View Full Code Here

        assertFalse( session.exists( oldDn ) );
       
        Entry entry = session.lookup( new DN( "cn=modifyDnWithString,ou=system" ) );
        assertNotNull( entry );
       
        RDN oldRdn = oldDn.getRdn();
        assertTrue( entry.contains( oldRdn.getUpType(), ( String ) oldRdn.getNormValue() ) );
    }
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.