Examples of ModificationOperation


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

     * operations remove RDN attributes.
     */
    @Test
    public void testPreventRdnChangeOnModifyRemove() throws Exception
    {
        ModificationOperation mod = ModificationOperation.REMOVE_ATTRIBUTE;
        DN name = new DN( "ou=user,dc=example,dc=com" );
        ServerEntry attributes = new DefaultServerEntry( schemaManager, name );
        attributes.put( "cn", "does not matter" );

        // postive test which should pass
View Full Code Here

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

     * operations replace RDN attributes.
     */
    @Test
    public void testPreventRdnChangeOnModifyReplace() throws Exception
    {
        ModificationOperation mod = ModificationOperation.REPLACE_ATTRIBUTE;
        DN name = new DN( "ou=user,dc=example,dc=com" );
        ServerEntry attributes = new DefaultServerEntry( schemaManager, name );
        attributes.put( "cn", "does not matter" );

        // postive test which should pass
View Full Code Here

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

        AttributeType OBJECT_CLASS = schemaManager.lookupAttributeTypeRegistry( "objectClass" );
        AttributeType CN_AT = schemaManager.lookupAttributeTypeRegistry( "cn" );

        // this should pass
        DN name = new DN( "uid=akarasulu,ou=users,dc=example,dc=com" );
        ModificationOperation mod = ModificationOperation.REPLACE_ATTRIBUTE;
        SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager, name, mod, new DefaultServerAttribute( "cn", CN_AT ) );

        // this should succeed since person is still in replaced set and is structural
        EntryAttribute objectClassesReplaced = new DefaultServerAttribute( "objectClass", OBJECT_CLASS );
        objectClassesReplaced.add( "top" );
View Full Code Here

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

     */
    @Test
    public void testPreventStructuralClassRemovalOnModifyRemoveAttribute() throws Exception
    {
        DN name = new DN( "uid=akarasulu,ou=users,dc=example,dc=com" );
        ModificationOperation mod = ModificationOperation.REMOVE_ATTRIBUTE;
        AttributeType ocAt = schemaManager.lookupAttributeTypeRegistry( "objectClass" );
       
        EntryAttribute entryObjectClasses = new DefaultServerAttribute( "objectClass", ocAt );
        entryObjectClasses.add( "top", "person", "organizationalPerson" );

View Full Code Here

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

     */
    @Test
    public void testPreventRdnChangeOnModifyRemoveAttribute() throws Exception
    {
        Map<String, OidNormalizer> oidNormalizers = schemaManager.getAttributeTypeRegistry().getNormalizerMapping();
        ModificationOperation mod = ModificationOperation.REMOVE_ATTRIBUTE;
        DN name = new DN( "ou=user,dc=example,dc=com" ).normalize( oidNormalizers );
        AttributeType cnAt = schemaManager.lookupAttributeTypeRegistry( "cn" );
        AttributeType ouAt = schemaManager.lookupAttributeTypeRegistry( "ou" );
        AttributeType snAt = schemaManager.lookupAttributeTypeRegistry( "sn" );

View Full Code Here

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

            // need to remove references to the subentry
            if ( isOldNameSelected && !isNewNameSelected )
            {
                for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
                {
                    ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE;
                    EntryAttribute opAttr = entry.get( aSUBENTRY_OPATTRS );

                    if ( opAttr != null )
                    {
                        opAttr = opAttr.clone();
                        opAttr.remove( subentryDn );

                        if ( opAttr.size() < 1 )
                        {
                            op = ModificationOperation.REMOVE_ATTRIBUTE;
                        }

                        modList.add( new ServerModification( op, opAttr ) );
                    }
                }
            }
            // need to add references to the subentry
            else if ( isNewNameSelected && !isOldNameSelected )
            {
                for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
                {
                    ModificationOperation op = ModificationOperation.ADD_ATTRIBUTE;
                    EntryAttribute opAttr = new DefaultServerAttribute( aSUBENTRY_OPATTRS, schemaManager
                        .lookupAttributeTypeRegistry( aSUBENTRY_OPATTRS ) );
                    opAttr.add( subentryDn );
                    modList.add( new ServerModification( op, opAttr ) );
                }
View Full Code Here

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

    {
        List<Modification> modList = new ArrayList<Modification>();

        for ( AttributeType attributeType : operational.getAttributeTypes() )
        {
            ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE;
            EntryAttribute result = new DefaultServerAttribute( attributeType );
            EntryAttribute opAttrAdditions = operational.get( attributeType );
            EntryAttribute opAttrInEntry = entry.get( attributeType );

            for ( Value<?> value : opAttrAdditions )
View Full Code Here

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

            // need to remove references to the subentry
            if ( isOldEntrySelected && !isNewEntrySelected )
            {
                for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
                {
                    ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE;
                    EntryAttribute opAttr = oldEntry.get( aSUBENTRY_OPATTRS );

                    if ( opAttr != null )
                    {
                        opAttr = opAttr.clone();
                        opAttr.remove( subentryDn );

                        if ( opAttr.size() < 1 )
                        {
                            op = ModificationOperation.REMOVE_ATTRIBUTE;
                        }

                        modList.add( new ServerModification( op, opAttr ) );
                    }
                }
            }
            // need to add references to the subentry
            else if ( isNewEntrySelected && !isOldEntrySelected )
            {
                for ( String attribute : SUBENTRY_OPATTRS )
                {
                    ModificationOperation op = ModificationOperation.ADD_ATTRIBUTE;
                    AttributeType type = schemaManager.lookupAttributeTypeRegistry( attribute );
                    EntryAttribute opAttr = new DefaultServerAttribute( attribute, type );
                    opAttr.add( subentryDn );
                    modList.add( new ServerModification( op, opAttr ) );
                }
View Full Code Here

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

     * @throws LdapException if there are problems accessing attributes
     */
    public static ServerEntry getTargetEntry( Modification mod, ServerEntry entry, SchemaManager schemaManager ) throws LdapException
    {
        ServerEntry targetEntry = ( ServerEntry ) entry.clone();
        ModificationOperation modOp = mod.getOperation();
        String id = mod.getAttribute().getId();
        AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( id );
       
        switch ( modOp )
        {
View Full Code Here

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

     * @param attributeType the associated attributeType
     * @return a instance of a ServerModification object
     */
    private static Modification toServerModification( ModificationItem modificationImpl, AttributeType attributeType )
    {
        ModificationOperation operation;
       
        switch ( modificationImpl.getModificationOp() )
        {
            case DirContext.REMOVE_ATTRIBUTE :
                operation = ModificationOperation.REMOVE_ATTRIBUTE;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.