Java Code Examples for org.apache.directory.api.ldap.model.schema.AttributeType#getSubstring()

The following examples show how to use org.apache.directory.api.ldap.model.schema.AttributeType#getSubstring() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Registries.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Add the SchemaObjectReferences. This method does nothing, it's just
 * a catch all. The other methods will be called for each specific
 * schemaObject
 *
public void addCrossReferences( SchemaObject schemaObject )
{
    // Do nothing : it's a catch all method.
}


/**
 * Delete the AT references (using and usedBy) :
 * AT -> MR (for EQUALITY, ORDERING and SUBSTR)
 * AT -> S
 * AT -> AT
 * 
 * @param attributeType The AttributeType to remove
 */
public void delCrossReferences( AttributeType attributeType )
{
    if ( attributeType.getEquality() != null )
    {
        delReference( attributeType, attributeType.getEquality() );
    }

    if ( attributeType.getOrdering() != null )
    {
        delReference( attributeType, attributeType.getOrdering() );
    }

    if ( attributeType.getSubstring() != null )
    {
        delReference( attributeType, attributeType.getSubstring() );
    }

    if ( attributeType.getSyntax() != null )
    {
        delReference( attributeType, attributeType.getSyntax() );
    }

    if ( attributeType.getSuperior() != null )
    {
        delReference( attributeType, attributeType.getSuperior() );
    }
}
 
Example 2
Source File: AttributeTypeHelper.java    From directory-ldap-api with Apache License 2.0 4 votes vote down vote up
/**
 * Inject the AttributeType into the Registries, updating the references to
 * other SchemaObject
 *
 * If one of the referenced SchemaObject does not exist (SUP, EQUALITY, ORDERING, SUBSTR, SYNTAX),
 * an exception is thrown.
 * 
 * @param attributeType The AttributeType to add to the Registries
 * @param errorHandler Error handler
 * @param registries The Registries
 * @throws LdapException If the AttributeType is not valid
 */
public static void addToRegistries( AttributeType attributeType, SchemaErrorHandler errorHandler, Registries registries ) throws LdapException
{
    if ( registries != null )
    {
        try
        {
            attributeType.unlock();
            AttributeTypeRegistry attributeTypeRegistry = registries.getAttributeTypeRegistry();

            // The superior
            if ( !buildSuperior( attributeType, errorHandler, registries ) )
            {
                // We have had errors, let's stop here as we need a correct superior to continue
                return;
            }

            // The Syntax
            buildSyntax( attributeType, errorHandler, registries );

            // The EQUALITY matching rule
            buildEquality( attributeType, errorHandler, registries );

            // The ORDERING matching rule
            buildOrdering( attributeType, errorHandler, registries );

            // The SUBSTR matching rule
            buildSubstring( attributeType, errorHandler, registries );

            // Check the USAGE
            checkUsage( attributeType, errorHandler );

            // Check the COLLECTIVE element
            checkCollective( attributeType, errorHandler );

            // Inject the attributeType into the oid/normalizer map
            attributeTypeRegistry.addMappingFor( attributeType );

            // Register this AttributeType into the Descendant map
            attributeTypeRegistry.registerDescendants( attributeType, attributeType.getSuperior() );

            /**
             * Add the AT references (using and usedBy) :
             * AT -> MR (for EQUALITY, ORDERING and SUBSTR)
             * AT -> S
             * AT -> AT
             */
            if ( attributeType.getEquality() != null )
            {
                registries.addReference( attributeType, attributeType.getEquality() );
            }

            if ( attributeType.getOrdering() != null )
            {
                registries.addReference( attributeType, attributeType.getOrdering() );
            }

            if ( attributeType.getSubstring() != null )
            {
                registries.addReference( attributeType, attributeType.getSubstring() );
            }

            if ( attributeType.getSyntax() != null )
            {
                registries.addReference( attributeType, attributeType.getSyntax() );
            }

            if ( attributeType.getSuperior() != null )
            {
                registries.addReference( attributeType, attributeType.getSuperior() );
            }
        }
        finally
        {
            attributeType.lock();
        }
    }
}
 
Example 3
Source File: AttributeTypeHelper.java    From directory-ldap-api with Apache License 2.0 4 votes vote down vote up
/**
 * Remove the AttributeType from the registries, updating the references to
 * other SchemaObject.
 *
 * If one of the referenced SchemaObject does not exist (SUP, EQUALITY, ORDERING, SUBSTR, SYNTAX),
 * an exception is thrown.
 * 
 * @param attributeType The AttributeType to remove from the Registries
 * @param errorHandler Error handler
 * @param registries The Registries
 * @throws LdapException If the AttributeType is not valid
 */
public static void removeFromRegistries( AttributeType attributeType, SchemaErrorHandler errorHandler, Registries registries ) throws LdapException
{
    if ( registries != null )
    {
        AttributeTypeRegistry attributeTypeRegistry = registries.getAttributeTypeRegistry();

        // Remove the attributeType from the oid/normalizer map
        attributeTypeRegistry.removeMappingFor( attributeType );

        // Unregister this AttributeType into the Descendant map
        attributeTypeRegistry.unregisterDescendants( attributeType, attributeType.getSuperior() );

        /**
         * Remove the AT references (using and usedBy) :
         * AT -> MR (for EQUALITY, ORDERING and SUBSTR)
         * AT -> S
         * AT -> AT
         */
        if ( attributeType.getEquality() != null )
        {
            registries.delReference( attributeType, attributeType.getEquality() );
        }

        if ( attributeType.getOrdering() != null )
        {
            registries.delReference( attributeType, attributeType.getOrdering() );
        }

        if ( attributeType.getSubstring() != null )
        {
            registries.delReference( attributeType, attributeType.getSubstring() );
        }

        if ( attributeType.getSyntax() != null )
        {
            registries.delReference( attributeType, attributeType.getSyntax() );
        }

        if ( attributeType.getSuperior() != null )
        {
            registries.delReference( attributeType, attributeType.getSuperior() );
        }
    }
}