plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/ConnectionSchemaLoader.java [280:492]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private static void addSchemaObjectValues( SchemaObject schemaObject, String objectClassValue, Entry entry )
        throws LdapException
    {
        // ObjectClass
        addObjectClassValue( schemaObject, objectClassValue, entry );

        // OID
        addOidValue( schemaObject, entry );

        // Names
        addNamesValue( schemaObject, entry );

        // Description
        addDescriptionValue( schemaObject, entry );

        // Obsolete
        addObsoleteValue( schemaObject, entry );
    }


    /**
     * Adds the objectClass value to the entry.
     *
     * @param schemaObject the schema object
     * @param objectClassValue the value for the objectClass attribute
     * @param entry the entry
     * @throws LdapException
     */
    private static void addObjectClassValue( SchemaObject schemaObject, String objectClassValue, Entry entry )
        throws LdapException
    {
        Attribute objectClassAttribute = new DefaultAttribute( SchemaConstants.OBJECT_CLASS_AT );
        entry.add( objectClassAttribute );
        objectClassAttribute.add( SchemaConstants.TOP_OC );
        objectClassAttribute.add( SchemaConstants.META_TOP_OC );
        objectClassAttribute.add( objectClassValue );
    }


    /**
     * Adds the OID value to the entry.
     *
     * @param schemaObject the schema object
     * @param entry the entry
     * @throws LdapException
     */
    private static void addOidValue( SchemaObject schemaObject, Entry entry ) throws LdapException
    {
        String oid = schemaObject.getOid();
        
        if ( !Strings.isEmpty( oid ) )
        {
            Attribute attribute = new DefaultAttribute( M_OID, oid );
            entry.add( attribute );
        }
    }


    /**
     * Adds the names value to the entry.
     *
     * @param schemaObject the schema object
     * @param entry the entry
     * @throws LdapException
     */
    private static void addNamesValue( SchemaObject schemaObject, Entry entry ) throws LdapException
    {
        List<String> names = schemaObject.getNames();
        
        if ( ( names != null ) && !names.isEmpty() )
        {
            Attribute attribute = new DefaultAttribute( M_NAME );
            entry.add( attribute );

            for ( String name : names )
            {
                attribute.add( name );
            }
        }
    }


    /**
     * Adds the description value to the entry.
     *
     * @param schemaObject the schema object
     * @param entry the entry
     * @throws LdapException
     */
    private static void addDescriptionValue( SchemaObject schemaObject, Entry entry ) throws LdapException
    {
        String description = schemaObject.getDescription();
        
        if ( !Strings.isEmpty( description ) )
        {
            Attribute attribute = new DefaultAttribute( M_DESCRIPTION, description );
            entry.add( attribute );
        }
    }


    /**
     * Adds the obsolete value to the entry.
     *
     * @param schemaObject the schema object
     * @param entry the entry
     * @throws LdapException
     */
    private static void addObsoleteValue( SchemaObject schemaObject, Entry entry ) throws LdapException
    {
        if ( schemaObject.isObsolete() )
        {
            Attribute attribute = new DefaultAttribute( M_OBSOLETE, TRUE );
            entry.add( attribute );
        }
    }


    /**
     * Adds the superior value.
     *
     * @param attributeType the attribute type
     * @param entry the entry
     * @throws LdapException
     */
    private static void addSuperiorValue( AttributeType attributeType, Entry entry ) throws LdapException
    {
        String superior = attributeType.getSuperiorName();
        
        if ( !Strings.isEmpty( superior ) )
        {
            Attribute attribute = new DefaultAttribute( M_SUP_ATTRIBUTE_TYPE, superior );
            entry.add( attribute );
        }
    }


    /**
     * Adds the equality matching rule value.
     *
     * @param attributeType the attribute type
     * @param entry the entry
     * @throws LdapException
     */
    private static void addEqualityValue( AttributeType attributeType, Entry entry ) throws LdapException
    {
        String equality = attributeType.getEqualityName();
        
        if ( !Strings.isEmpty( equality ) )
        {
            Attribute attribute = new DefaultAttribute( M_EQUALITY, equality );
            entry.add( attribute );
        }
    }


    /**
     * Adds the ordering matching rule value.
     *
     * @param attributeType the attribute type
     * @param entry the entry
     * @throws LdapException
     */
    private static void addOrderingValue( AttributeType attributeType, Entry entry ) throws LdapException
    {
        String ordering = attributeType.getOrderingName();
        
        if ( !Strings.isEmpty( ordering ) )
        {
            Attribute attribute = new DefaultAttribute( M_ORDERING, ordering );
            entry.add( attribute );
        }
    }


    /**
     * Adds the substring matching rule value.
     *
     * @param attributeType the attribute type
     * @param entry the entry
     * @throws LdapException
     */
    private static void addSubstrValue( AttributeType attributeType, Entry entry ) throws LdapException
    {
        String substr = attributeType.getSubstringName();
        
        if ( !Strings.isEmpty( substr ) )
        {
            Attribute attribute = new DefaultAttribute( M_SUBSTR, substr );
            entry.add( attribute );
        }
    }


    /**
     * Adds the syntax value.
     *
     * @param attributeType the attribute type
     * @param entry the entry
     * @throws LdapException
     */
    private static void addSyntaxValue( AttributeType attributeType, Entry entry ) throws LdapException
    {
        String syntax = attributeType.getSyntaxName();
        
        if ( !Strings.isEmpty( syntax ) )
        {
            Attribute attribute = new DefaultAttribute( M_SYNTAX, syntax );
            entry.add( attribute );

            long syntaxLength = attributeType.getSyntaxLength();
            
            if ( syntaxLength != -1 )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemamanager/SchemaEditorSchemaLoaderUtils.java [254:478]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private static void addSchemaObjectValues( SchemaObject schemaObject, String objectClassValue, Entry entry )
        throws LdapException
    {
        // ObjectClass
        addObjectClassValue( schemaObject, objectClassValue, entry );

        // OID
        addOidValue( schemaObject, entry );

        // Names
        addNamesValue( schemaObject, entry );

        // Description
        addDescriptionValue( schemaObject, entry );

        // Obsolete
        addObsoleteValue( schemaObject, entry );
    }


    /**
     * Adds the objectClass value to the entry.
     *
     * @param schemaObject
     *      the schema object
     * @param objectClassValue
     *      the value for the objectClass attribute
     * @param entry
     *      the entry
     * @throws LdapException
     */
    private static void addObjectClassValue( SchemaObject schemaObject, String objectClassValue, Entry entry )
        throws LdapException
    {
        Attribute objectClassAttribute = new DefaultAttribute( SchemaConstants.OBJECT_CLASS_AT );
        entry.add( objectClassAttribute );
        objectClassAttribute.add( SchemaConstants.TOP_OC );
        objectClassAttribute.add( SchemaConstants.META_TOP_OC );
        objectClassAttribute.add( objectClassValue );
    }


    /**
     * Adds the OID value to the entry.
     *
     * @param schemaObject
     *      the schema object
     * @param entry
     *      the entry
     * @throws LdapException
     */
    private static void addOidValue( SchemaObject schemaObject, Entry entry ) throws LdapException
    {
        String oid = schemaObject.getOid();
        if ( !Strings.isEmpty( oid ) )
        {
            Attribute attribute = new DefaultAttribute( M_OID, oid );
            entry.add( attribute );
        }
    }


    /**
     * Adds the names value to the entry.
     *
     * @param schemaObject
     *      the schema object
     * @param entry
     *      the entry
     * @throws LdapException
     */
    private static void addNamesValue( SchemaObject schemaObject, Entry entry ) throws LdapException
    {
        List<String> names = schemaObject.getNames();
        if ( ( names != null ) && !names.isEmpty() )
        {
            Attribute attribute = new DefaultAttribute( M_NAME );
            entry.add( attribute );

            for ( String name : names )
            {
                attribute.add( name );
            }
        }
    }


    /**
     * Adds the description value to the entry.
     *
     * @param schemaObject
     *      the schema object
     * @param entry
     *      the entry
     * @throws LdapException
     */
    private static void addDescriptionValue( SchemaObject schemaObject, Entry entry ) throws LdapException
    {
        String description = schemaObject.getDescription();
        if ( !Strings.isEmpty( description ) )
        {
            Attribute attribute = new DefaultAttribute( M_DESCRIPTION, description );
            entry.add( attribute );
        }
    }


    /**
     * Adds the obsolete value to the entry.
     *
     * @param schemaObject
     *      the schema object
     * @param entry
     *      the entry
     * @throws LdapException
     */
    private static void addObsoleteValue( SchemaObject schemaObject, Entry entry ) throws LdapException
    {
        if ( schemaObject.isObsolete() )
        {
            Attribute attribute = new DefaultAttribute( M_OBSOLETE, TRUE );
            entry.add( attribute );
        }
    }


    /**
     * Adds the superior value.
     *
     * @param attributeType
     *      the attribute type
     * @param entry
     *      the entry
     * @throws LdapException
     */
    private static void addSuperiorValue( AttributeType attributeType, Entry entry ) throws LdapException
    {
        String superior = attributeType.getSuperiorName();
        if ( !Strings.isEmpty( superior ) )
        {
            Attribute attribute = new DefaultAttribute( M_SUP_ATTRIBUTE_TYPE, superior );
            entry.add( attribute );
        }
    }


    /**
     * Adds the equality matching rule value.
     *
     * @param attributeType
     *      the attribute type
     * @param entry
     *      the entry
     * @throws LdapException
     */
    private static void addEqualityValue( AttributeType attributeType, Entry entry ) throws LdapException
    {
        String equality = attributeType.getEqualityName();
        if ( !Strings.isEmpty( equality ) )
        {
            Attribute attribute = new DefaultAttribute( M_EQUALITY, equality );
            entry.add( attribute );
        }
    }


    /**
     * Adds the ordering matching rule value.
     *
     * @param attributeType
     *      the attribute type
     * @param entry
     *      the entry
     * @throws LdapException
     */
    private static void addOrderingValue( AttributeType attributeType, Entry entry ) throws LdapException
    {
        String ordering = attributeType.getOrderingName();
        if ( !Strings.isEmpty( ordering ) )
        {
            Attribute attribute = new DefaultAttribute( M_ORDERING, ordering );
            entry.add( attribute );
        }
    }


    /**
     * Adds the substring matching rule value.
     *
     * @param attributeType
     *      the attribute type
     * @param entry
     *      the entry
     * @throws LdapException
     */
    private static void addSubstrValue( AttributeType attributeType, Entry entry ) throws LdapException
    {
        String substr = attributeType.getSubstringName();
        if ( !Strings.isEmpty( substr ) )
        {
            Attribute attribute = new DefaultAttribute( M_SUBSTR, substr );
            entry.add( attribute );
        }
    }


    /**
     * Adds the syntax value.
     *
     * @param attributeType
     *      the attribute type
     * @param entry
     *      the entry
     * @throws LdapException
     */
    private static void addSyntaxValue( AttributeType attributeType, Entry entry ) throws LdapException
    {
        String syntax = attributeType.getSyntaxName();
        if ( !Strings.isEmpty( syntax ) )
        {
            Attribute attribute = new DefaultAttribute( M_SYNTAX, syntax );
            entry.add( attribute );

            long syntaxLength = attributeType.getSyntaxLength();
            if ( syntaxLength != -1 )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



