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

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


            Attribute attr;

            if ( value == null )
            {
                value = new StringValue( ( String ) null );
                attr = new DefaultAttribute( id, ( Value<?> ) value );
            }
            else
            {
                attr = ( Attribute ) value;
            }
View Full Code Here


     */
    public Attribute get( String attributeId )
    {
        if ( "dn".equalsIgnoreCase( attributeId ) )
        {
            return new DefaultAttribute( "dn", entry.getDn().getName() );
        }

        return entry.get( attributeId );
    }
View Full Code Here

            LOG.warn( msg );
            throw new IllegalArgumentException( msg );
        }

        byte[] bytecode = Base64.decode( byteCodeString.toCharArray() );
        Attribute attr = new DefaultAttribute( MetaSchemaConstants.M_BYTECODE_AT, bytecode );

        return attr;
    }
View Full Code Here

     *
     * @param type The attribute's name
     */
    public void addAttributeTypeAndValues( String type )
    {
        currentAttribute = new DefaultAttribute( type );

        Modification modification = new DefaultModification( currentOperation, currentAttribute );
        getDecorated().addModification( modification );
    }
View Full Code Here

            currentAttribute = entry.get( type );
            return;
        }

        // fix this to use AttributeImpl(type.getString().toLowerCase())
        currentAttribute = new DefaultAttribute( type );
        entry.put( currentAttribute );
    }
View Full Code Here

    }


    private void addModification( ModificationOperation modOp, String attributeName, byte[]... attributeValue )
    {
        Attribute attr = new DefaultAttribute( attributeName, attributeValue );
        addModification( attr, modOp );
    }
View Full Code Here

    }


    private void addModification( ModificationOperation modOp, String attributeName, String... attributeValue )
    {
        Attribute attr = new DefaultAttribute( attributeName, attributeValue );
        addModification( attr, modOp );
    }
View Full Code Here

                {
                    throw new LdapException( I18n.err( I18n.ERR_12083 ) );
                }

                // Stores the new Rdn
                Attribute newRdn = new DefaultAttribute( "newrdn", entry.getNewRdn() );
                sb.append( convertToLdif( newRdn, length ) );

                // Stores the deleteoldrdn flag
                sb.append( "deleteoldrdn: " );

                if ( entry.isDeleteOldRdn() )
                {
                    sb.append( "1" );
                }
                else
                {
                    sb.append( "0" );
                }

                sb.append( '\n' );

                // Stores the optional newSuperior
                if ( !Strings.isEmpty(entry.getNewSuperior()) )
                {
                    Attribute newSuperior = new DefaultAttribute( "newsuperior", entry.getNewSuperior() );
                    sb.append( convertToLdif( newSuperior, length ) );
                }

                break;
View Full Code Here

            Object attributeValue = parseSimpleValue( line, colonIndex );

            // Create an attribute
            if ( attributeValue instanceof String )
            {
                return new DefaultAttribute( attributeType, ( String ) attributeValue );
            }
            else
            {
                return new DefaultAttribute( attributeType, ( byte[] ) attributeValue );
            }
        }
        else
        {
            return null;
View Full Code Here

                    throw new LdapLdifException( I18n.err( I18n.ERR_12042_BAD_MODIFY_SEPARATOR_2 ) );
                }

                modified = Strings.trim( line.substring( "add:".length() ) );
                modificationType = ModificationOperation.ADD_ATTRIBUTE;
                attribute = new DefaultAttribute( modified );

                state = ATTRVAL_SPEC;
            }
            else if ( lowerLine.startsWith( "delete:" ) )
            {
                if ( ( state != MOD_SPEC ) && ( state != ATTRVAL_SPEC ) )
                {
                    LOG.error( I18n.err( I18n.ERR_12042_BAD_MODIFY_SEPARATOR_2 ) );
                    throw new LdapLdifException( I18n.err( I18n.ERR_12042_BAD_MODIFY_SEPARATOR_2 ) );
                }

                modified = Strings.trim(line.substring("delete:".length()));
                modificationType = ModificationOperation.REMOVE_ATTRIBUTE;
                attribute = new DefaultAttribute( modified );

                state = ATTRVAL_SPEC_OR_SEP;
            }
            else if ( lowerLine.startsWith( "replace:" ) )
            {
                if ( ( state != MOD_SPEC ) && ( state != ATTRVAL_SPEC ) )
                {
                    LOG.error( I18n.err( I18n.ERR_12042_BAD_MODIFY_SEPARATOR_2 ) );
                    throw new LdapLdifException( I18n.err( I18n.ERR_12042_BAD_MODIFY_SEPARATOR_2 ) );
                }

                modified = Strings.trim(line.substring("replace:".length()));
                modificationType = ModificationOperation.REPLACE_ATTRIBUTE;
                attribute = new DefaultAttribute( modified );

                state = ATTRVAL_SPEC_OR_SEP;
            }
            else
            {
View Full Code Here

TOP

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

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.