Package org.apache.directory.api.ldap.model.name

Examples of org.apache.directory.api.ldap.model.name.Ava


        StringBuffer sb = new StringBuffer();

        Iterator<Ava> it = rdn.iterator();
        while ( it.hasNext() )
        {
            Ava ava = it.next();
            sb.append( getOidString( ava, schema ) );
            if ( it.hasNext() )
            {
                sb.append( '+' );
            }
View Full Code Here


    private static void applyNewRdn( Attributes attributes, Rdn oldRdn, Rdn newRdn )
    {
        // remove old Rdn attributes and values
        for ( Iterator<Ava> it = oldRdn.iterator(); it.hasNext(); )
        {
            Ava atav = it.next();
            Attribute attribute = attributes.get( atav.getType() );
            if ( attribute != null )
            {
                attribute.remove( atav.getNormValue().getString() );
                if ( attribute.size() == 0 )
                {
                    attributes.remove( atav.getType() );
                }
            }
        }

        // add new Rdn attributes and values
        for ( Iterator<Ava> it = newRdn.iterator(); it.hasNext(); )
        {
            Ava atav = it.next();
            Attribute attribute = attributes.get( atav.getType() );
            if ( attribute == null )
            {
                attribute = new BasicAttribute( atav.getType() );
                attributes.put( attribute );
            }
            if ( !attribute.contains( atav.getNormValue().getString() ) )
            {
                attribute.add( atav.getNormValue().getString() );
            }
        }
    }
View Full Code Here

            {
                int i = 0;
                Iterator<Ava> atavIterator = currentRdn.iterator();
                while ( atavIterator.hasNext() )
                {
                    Ava ava = atavIterator.next();
                    addRdnLine( rdnComposite, i );

                    removeRdnLineListeners( i );

                    rdnLineList.get( i ).rdnTypeCombo.setText( ava.getType() );
                    rdnLineList.get( i ).rdnValueText.setText( ava.getNormValue().getString() );

                    addRdnLineListeners( i );

                    if ( i == 0 )
                    {
View Full Code Here

    public boolean isRdnPart()
    {
        Iterator<Ava> atavIterator = getAttribute().getEntry().getRdn().iterator();
        while ( atavIterator.hasNext() )
        {
            Ava ava = atavIterator.next();
            if ( getAttribute().getDescription().equals( ava.getNormType() )
                && getStringValue().equals( ava.getNormValue().getString() ) )
            {
                return true;
            }
        }
        return false;
View Full Code Here

        Iterator<Ava> iterator = rdn.iterator();

        while ( iterator.hasNext() )
        {
            Ava ava = iterator.next();

            // First, get the AT name, or OID
            String normAT = ava.getNormType();
            AttributeType at = schemaManager.lookupAttributeTypeRegistry( normAT );

            String atName = at.getName();

            // Now, get the normalized value
            String normValue = ava.getNormValue().getString();

            fileName.append( atName ).append( "=" ).append( normValue );

            if ( iterator.hasNext() )
            {
View Full Code Here

            // 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( '+' );
                }
View Full Code Here

    @Test
    public void testAttributeTypeAndValueNullType() throws LdapException
    {
        try
        {
            new Ava( schemaManager, null, ( String ) null );
            fail();
        }
        catch ( LdapException ine )
        {
            assertTrue( true );
View Full Code Here

    @Test
    public void testAttributeTypeAndValueInvalidType() throws LdapException
    {
        try
        {
            new Ava( schemaManager, "  ", ( String ) null );
            fail();
        }
        catch ( LdapException ine )
        {
            assertTrue( true );
View Full Code Here

     * Test a valid type for an AttributeTypeAndValue
     */
    @Test
    public void testAttributeTypeAndValueValidType() throws LdapException
    {
        Ava ava = new Ava( schemaManager, "CN", " " );
        assertEquals( "CN=\\ ", ava.toString() );
        assertEquals( "2.5.4.3=\\ ", ava.getNormName() );
        assertEquals( "CN=\\ ", ava.getName() );

        ava = new Ava( schemaManager, "  CN  ", " " );
        assertEquals( "  CN  =\\ ", ava.toString() );
        assertEquals( "2.5.4.3=\\ ", ava.getNormName() );
        assertEquals( "  CN  =\\ ", ava.getName() );

        ava = new Ava( schemaManager, "cn", " " );
        assertEquals( "cn=\\ ", ava.toString() );
        assertEquals( "2.5.4.3=\\ ", ava.getNormName() );
        assertEquals( "cn=\\ ", ava.getName() );

        ava = new Ava( schemaManager, "  cn  ", " " );
        assertEquals( "  cn  =\\ ", ava.toString() );
        assertEquals( "2.5.4.3=\\ ", ava.getNormName() );
        assertEquals( "  cn  =\\ ", ava.getName() );
    }
View Full Code Here

    @Test
    public void testAvaEmpty()
    {
        try
        {
            new Ava( schemaManager, "", "" );
            fail( "Should not occurs ... " );
        }
        catch ( LdapException ine )
        {
            assertTrue( true );
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.name.Ava

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.