Package org.apache.directory.server.core.entry

Examples of org.apache.directory.server.core.entry.ServerAttribute


    }


    private ServerAttribute generateDitContextRules() throws NamingException
    {
        ServerAttribute attr = new DefaultServerAttribute(
            getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.DIT_CONTENT_RULES_AT ) );

        for ( DITContentRule ditContentRule : getSchemaManager().getDITContentRuleRegistry() )
        {
            attr.add( SchemaUtils.render( ditContentRule ).toString() );
        }
       
        return attr;
    }
View Full Code Here


    }


    private ServerAttribute generateDitStructureRules() throws NamingException
    {
        ServerAttribute attr = new DefaultServerAttribute(
            getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.DIT_STRUCTURE_RULES_AT ) );

        for ( DITStructureRule ditStructureRule : getSchemaManager().getDITStructureRuleRegistry() )
        {
            attr.add( SchemaUtils.render( ditStructureRule ).toString() );
        }
       
        return attr;
    }
View Full Code Here

    }


    private ServerAttribute generateNameForms() throws NamingException
    {
        ServerAttribute attr = new DefaultServerAttribute(
            getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.NAME_FORMS_AT ) );

        for ( NameForm nameForm : getSchemaManager().getNameFormRegistry() )
        {
            attr.add( SchemaUtils.render( nameForm ).toString() );
        }
       
        return attr;
    }
View Full Code Here

        // remove all the objectClass attribute values from a cloned copy and then
        // we can analyze what remains in this attribute to make sure a structural
        // objectClass is present for the entry

        ServerAttribute cloned = ( ServerAttribute ) entryObjectClasses.clone();
       
        for ( Value<?> value:attribute )
        {
            cloned.remove( value );
        }

        // check resultant set of objectClass values for a structural objectClass
        for ( Value<?> objectClass:cloned )
        {
View Full Code Here

    {
        for ( Modification mod : opContext.getModItems() )
        {
            String opAttrOid = schemaManager.getAttributeTypeRegistry().getOidByName( mod.getAttribute().getId() );
           
            ServerAttribute serverAttribute = (ServerAttribute)mod.getAttribute();

            switch ( mod.getOperation() )
            {
                case ADD_ATTRIBUTE :
                    modifyAddOperation( opContext, opAttrOid, serverAttribute, doCascadeModify );
View Full Code Here

         * non-null IndexEntry parameter.  This is to make sure the call to
         * evaluate with the attribute will set the value on the IndexEntry.
         */

        // get the attribute
        ServerAttribute attr = ( ServerAttribute ) entry.get( type );

        // if the attribute exists and has a greater than or equal value return true
        //noinspection unchecked
        if ( attr != null && evaluate( ( IndexEntry<Object, ServerEntry, ID> ) indexEntry, attr ) )
        {
View Full Code Here


    public boolean evaluateEntry( ServerEntry entry ) throws Exception
    {
        // get the attribute
        ServerAttribute attr = ( ServerAttribute ) entry.get( type );

        // if the attribute exists and has a greater than or equal value return true
        if ( attr != null && evaluate( null, attr ) )
        {
            return true;
View Full Code Here

        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
        ServerAttribute objectClassesReplaced = new DefaultServerAttribute( "objectClass", OBJECT_CLASS );
        objectClassesReplaced.add( "top" );
        objectClassesReplaced.add( "person" );
        SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager, name, mod, objectClassesReplaced );

        // this should fail since only top is left
        objectClassesReplaced = new DefaultServerAttribute( "objectClass", OBJECT_CLASS );
        objectClassesReplaced.add( "top" );
        try
        {
            SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager, name, mod, objectClassesReplaced );
            fail( "should never get here due to an LdapSchemaViolationException" );
        }
View Full Code Here

    {
        DN name = new DN( "uid=akarasulu,ou=users,dc=example,dc=com" );
        ModificationOperation mod = ModificationOperation.REMOVE_ATTRIBUTE;
        AttributeType ocAt = schemaManager.lookupAttributeTypeRegistry( "objectClass" );
       
        ServerAttribute entryObjectClasses = new DefaultServerAttribute( "objectClass", ocAt );
        entryObjectClasses.add( "top", "person", "organizationalPerson" );

        // this should pass
        SchemaChecker.preventStructuralClassRemovalOnModifyRemove(
            schemaManager,
            name,
            mod,
            new DefaultServerAttribute( "cn", schemaManager.lookupAttributeTypeRegistry( "cn" ) ),
            entryObjectClasses );

        // this should succeed since person is left and is structural
        ServerAttribute objectClassesRemoved = new DefaultServerAttribute(
            "objectClass", ocAt );
        objectClassesRemoved.add( "person" );
        SchemaChecker.preventStructuralClassRemovalOnModifyRemove( schemaManager, name, mod, objectClassesRemoved,
            entryObjectClasses );

        // this should fail since only top is left
        objectClassesRemoved = new DefaultServerAttribute( "objectClass", ocAt );
        objectClassesRemoved.add( "person", "organizationalPerson" );
       
        try
        {
            SchemaChecker.preventStructuralClassRemovalOnModifyRemove( schemaManager, name, mod, objectClassesRemoved,
                entryObjectClasses );
View Full Code Here

    private boolean addsAnyCollectiveAttributes( List<Modification> mods ) throws NamingException
    {
        for ( Modification mod:mods )
        {
            // TODO: handle http://issues.apache.org/jira/browse/DIRSERVER-1198
            ServerAttribute attr = (ServerAttribute)mod.getAttribute();
            AttributeType attrType = attr.getAttributeType();

            if ( attrType == null )
            {
                if ( !schemaManager.getAttributeTypeRegistry().contains( attr.getUpId() ) )
                {
                    throw new LdapInvalidAttributeIdentifierException();
                }
                else
                {
                    attrType = schemaManager.lookupAttributeTypeRegistry( attr.getUpId() );
                }
            }
           
           
            ModificationOperation modOp = mod.getOperation();
View Full Code Here

TOP

Related Classes of org.apache.directory.server.core.entry.ServerAttribute

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.