Package org.apache.directory.shared.ldap.model.entry

Examples of org.apache.directory.shared.ldap.model.entry.StringValue


     * @param upValue the user provided value of the Rdn
     * @throws LdapInvalidDnException if the Rdn is invalid
     */
    public Rdn( SchemaManager schemaManager, String upType, String upValue ) throws LdapInvalidDnException
    {
        addAVA( schemaManager, upType, upType, new StringValue( upValue ), new StringValue( upValue ) );

        upName = upType + '=' + upValue;

        if ( schemaManager != null )
        {
View Full Code Here


                    sb.append( digit.toUpperCase() );
                }
            }

            return new StringValue( sb.toString() );
        }

        val = ( ( StringValue ) value ).getString();

        for ( int i = 0; i < val.length(); i++ )
        {
            char ch = val.charAt( i );
            String replace = null;

            switch ( ch )
            {
                case '*':
                    replace = "\\2A";
                    break;

                case '(':
                    replace = "\\28";
                    break;

                case ')':
                    replace = "\\29";
                    break;

                case '\\':
                    replace = "\\5C";
                    break;

                case '\0':
                    replace = "\\00";
                    break;
            }

            if ( replace != null )
            {
                if ( sb == null )
                {
                    sb = new StringBuilder( val.length() * 2 );
                    sb.append( val.substring( 0, i ) );
                }
                sb.append( replace );
            }
            else if ( sb != null )
            {
                sb.append( ch );
            }
        }

        return ( sb == null ? value : new StringValue( sb.toString() ) );
    }
View Full Code Here

                throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, message, le );
            }

            try
            {
                createAva( schemaManager, upType, new StringValue( attributeType, upValue ) );
            }
            catch ( LdapInvalidAttributeValueException liave )
            {
                String message = I18n.err( I18n.ERR_04188 );
                LOG.error( message );
                throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, message, liave );
            }
        }
        else
        {
            createAva( upType, new StringValue( upValue ) );
        }
    }
View Full Code Here

    @Test
    public void testAddStringValueArray() throws LdapException
    {
        Entry entry = new DefaultEntry();

        Value<String> value = new StringValue( ( String ) null );

        entry.add( "cn", value );
        assertEquals( 1, entry.size() );
        Attribute attributeCN = entry.get( "cn" );
        assertEquals( 1, attributeCN.size() );
        assertNotNull( attributeCN.get() );
        assertNull( attributeCN.get().getValue() );

        Value<String> value1 = new StringValue( "test1" );
        Value<String> value2 = new StringValue( "test2" );
        Value<String> value3 = new StringValue( "test1" );

        entry.add( "sn", value1, value2, value3 );
        assertEquals( 2, entry.size() );
        Attribute attributeSN = entry.get( "sn" );
        assertEquals( 2, attributeSN.size() );
View Full Code Here

        Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2", ( String ) null );
        Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2, ( byte[] ) null );

        entry.add( attrCN, attrPWD );

        Value<String> strValue1 = new StringValue( "test1" );
        Value<String> strValue2 = new StringValue( "test2" );
        Value<String> strValue3 = new StringValue( "test3" );
        Value<String> strNullValue = new StringValue( ( String ) null );

        Value<byte[]> binValue1 = new BinaryValue( BYTES1 );
        Value<byte[]> binValue2 = new BinaryValue( BYTES2 );
        Value<byte[]> binValue3 = new BinaryValue( BYTES3 );
        Value<byte[]> binNullValue = new BinaryValue( ( byte[] ) null );
View Full Code Here

    @Test
    public void testPutStringValueArray()
    {
        Entry entry = new DefaultEntry( EXAMPLE_DN );

        Value<String> strValueTop = new StringValue( "top" );
        Value<String> strValuePerson = new StringValue( "person" );
        Value<String> strValueTop2 = new StringValue( "top" );
        Value<String> strNullValue = new StringValue( ( String ) null );

        Value<byte[]> binValue1 = new BinaryValue( BYTES1 );
        Value<byte[]> binValue2 = new BinaryValue( BYTES2 );
        Value<byte[]> binValue3 = new BinaryValue( BYTES1 );
        Value<byte[]> binNullValue = new BinaryValue( ( byte[] ) null );
View Full Code Here

        Attribute attrCN = new DefaultAttribute( "cn", "test1", "test2", ( String ) null );
        Attribute attrPWD = new DefaultAttribute( "userPassword", BYTES1, BYTES2, ( byte[] ) null );

        entry.add( attrCN, attrPWD );

        Value<String> strValue1 = new StringValue( "test1" );
        Value<String> strValue2 = new StringValue( "test2" );
        Value<String> strValue3 = new StringValue( "test3" );
        Value<String> strNullValue = new StringValue( ( String ) null );

        Value<byte[]> binValue1 = new BinaryValue( BYTES1 );
        Value<byte[]> binValue2 = new BinaryValue( BYTES2 );
        Value<byte[]> binValue3 = new BinaryValue( BYTES3 );
        Value<byte[]> binNullValue = new BinaryValue( ( byte[] ) null );
View Full Code Here

    {
        Entry entry = new DefaultEntry( EXAMPLE_DN );

        assertEquals( "Entry\n    dn: dc=example,dc=com\n", entry.toString() );

        Value<String> strValueTop = new StringValue( "top" );
        Value<String> strValuePerson = new StringValue( "person" );
        Value<String> strNullValue = new StringValue( ( String ) null );

        Value<byte[]> binValue1 = new BinaryValue( BYTES1 );
        Value<byte[]> binValue2 = new BinaryValue( BYTES2 );
        Value<byte[]> binNullValue = new BinaryValue( ( byte[] ) null );
View Full Code Here

        // Add a binary value
        assertEquals( 0, attr.add( new byte[]
            { 0x01 } ) );

        // Add a Value
        Value<?> ssv = new StringValue( at, "test2" );

        attr.add( ssv );

        assertEquals( 2, attr.size() );
View Full Code Here

        AttributeType at = TestEntryUtils.getIA5StringAttributeType();

        DefaultAttribute attr = new DefaultAttribute( at );

        // Add a null value
        attr.add( new StringValue( at, null ) );

        assertEquals( 1, attr.size() );

        assertTrue( attr.getAttributeType().getSyntax().isHumanReadable() );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.model.entry.StringValue

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.