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

Examples of org.apache.directory.shared.ldap.entry.DefaultServerAttribute


        if ( ( names == null ) || ( names.size() == 0 ) )
        {
            return;
        }
       
        EntryAttribute attr = new DefaultServerAttribute( schemaManager.lookupAttributeTypeRegistry( MetaSchemaConstants.M_NAME_AT ) );

        for ( String name:names )
        {
            attr.add( name );
        }
       
        entry.put( attr );
    }
View Full Code Here


    private EntryAttribute getResultantObjectClasses( ModificationOperation modOp, EntryAttribute changes,
        EntryAttribute existing ) throws Exception
    {
        if ( ( changes == null ) && ( existing == null ) )
        {
            return new DefaultServerAttribute( SchemaConstants.OBJECT_CLASS_AT, OBJECT_CLASS );
        }

        if ( changes == null )
        {
            return existing;
        }

        if ( ( existing == null ) && ( modOp == ModificationOperation.ADD_ATTRIBUTE ) )
        {
            return changes;
        }
        else if ( existing == null )
        {
            return new DefaultServerAttribute( SchemaConstants.OBJECT_CLASS_AT, OBJECT_CLASS );
        }

        switch ( modOp )
        {
            case ADD_ATTRIBUTE:
View Full Code Here

            {
                AttributeType type = schemaManager.lookupAttributeTypeRegistry( atav.getUpType() );

                if ( !tmpEntry.contains( type, atav.getNormValue() ) )
                {
                    tmpEntry.add( new DefaultServerAttribute( type, atav.getUpValue() ) );
                }
            }

            // Substitute the RDN and check if the new entry is correct
            tmpEntry.setDn( opContext.getNewDn() );
View Full Code Here

    private EntryAttribute createNewAttribute( EntryAttribute attribute )
    {
        AttributeType attributeType = attribute.getAttributeType();
       
        // Create the new Attribute
        EntryAttribute newAttribute = new DefaultServerAttribute( attribute.getUpId(), attributeType );

        for ( Value<?> value : attribute )
        {
            newAttribute.add( value );
        }

        return newAttribute;
    }
View Full Code Here

        {
            getObjectClasses( oc, objectClasses );

            entry.removeAttributes( SchemaConstants.OBJECT_CLASS_AT );

            EntryAttribute newOc = new DefaultServerAttribute( oc.getAttributeType() );

            for ( ObjectClass currentOC : objectClasses )
            {
                newOc.add( currentOC.getName() );
            }

            newOc.add( SchemaConstants.TOP_OC );
            entry.put( newOc );
        }
    }
View Full Code Here

        // Protect the server against a null objectClassAttr
        // It can be the case if the user forgot to add it to the entry ...
        // In this case, we create an new one, empty
        if ( objectClassAttr == null )
        {
            objectClassAttr = new DefaultServerAttribute( SchemaConstants.OBJECT_CLASS_AT, OBJECT_CLASS );
        }

        List<ObjectClass> ocs = new ArrayList<ObjectClass>();

        alterObjectClasses( objectClassAttr );
View Full Code Here

                throw new LdapSchemaViolationException( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS, message );
            }
        }
       
        // Inject the ModifiersName AT if it's not present
        EntryAttribute attribute = new DefaultServerAttribute(
            MODIFIERS_NAME_ATTRIBUTE_TYPE,
            getPrincipal().getName());

        Modification modifiersName = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );

        mods.add( modifiersName );
       
        // Inject the ModifyTimestamp AT if it's not present
        attribute = new DefaultServerAttribute(
            MODIFY_TIMESTAMP_ATTRIBUTE_TYPE,
            DateUtils.getGeneralizedTime() );
       
        Modification timestamp = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
View Full Code Here

    {
        DN dn = new DN( "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
        dn.normalize( schemaManager.getNormalizerMapping() );

        List<Modification> mods = new ArrayList<Modification>();
        EntryAttribute attrib = new DefaultServerAttribute( SchemaConstants.OU_AT, schemaManager
            .lookupAttributeTypeRegistry( SchemaConstants.OU_AT_OID ) );
        attrib.add( "Engineering" );

        Modification add = new ServerModification( ModificationOperation.ADD_ATTRIBUTE, attrib );

        mods.add( add );
View Full Code Here

    {
        DN dn = new DN( "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
        dn.normalize( schemaManager.getNormalizerMapping() );

        List<Modification> mods = new ArrayList<Modification>();
        EntryAttribute attrib = new DefaultServerAttribute( SchemaConstants.SURNAME_AT, schemaManager
            .lookupAttributeTypeRegistry( SchemaConstants.SURNAME_AT ) );

        String attribVal = "Walker";
        attrib.add( attribVal );

        Modification add = new ServerModification( ModificationOperation.ADD_ATTRIBUTE, attrib );
        mods.add( add );

        ServerEntry lookedup = store.lookup( store.getEntryId( dn.getNormName() ) );
View Full Code Here

    {
        DN dn = new DN( "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
        dn.normalize( schemaManager.getNormalizerMapping() );

        List<Modification> mods = new ArrayList<Modification>();
        EntryAttribute attrib = new DefaultServerAttribute( SchemaConstants.SN_AT, schemaManager
            .lookupAttributeTypeRegistry( SchemaConstants.SN_AT_OID ) );

        String attribVal = "Johnny";
        attrib.add( attribVal );

        Modification add = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attrib );
        mods.add( add );

        ServerEntry lookedup = store.lookup( store.getEntryId( dn.getNormName() ) );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.entry.DefaultServerAttribute

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.