Package org.apache.directory.studio.schemaeditor.model

Examples of org.apache.directory.studio.schemaeditor.model.MatchingRuleImpl


        // Equality matching rule
        String equality = at.getEqualityName();
        if ( ( equality != null ) && ( !"".equals( equality ) ) )
        {
            MatchingRuleImpl equalityMR = schemaHandler.getMatchingRule( equality );
            if ( equalityMR == null )
            {
                SchemaError error = new NonExistingMatchingRuleError( at, equality,
                    NonExistingMatchingRuleErrorEnum.EQUALITY );
                errorsList.add( error );
                errorsMap.put( at, error );
                dependenciesMap.put( equality, at );
                dependsOnMap.put( at, equality );
            }
            else
            {
                dependenciesMap.put( equalityMR, at );
                dependsOnMap.put( at, equalityMR );
            }
        }

        // Ordering matching rule
        String ordering = at.getOrderingName();
        if ( ( ordering != null ) && ( !"".equals( ordering ) ) )
        {
            MatchingRuleImpl orderingMR = schemaHandler.getMatchingRule( ordering );
            if ( orderingMR == null )
            {
                SchemaError error = new NonExistingMatchingRuleError( at, ordering,
                    NonExistingMatchingRuleErrorEnum.ORDERING );
                errorsList.add( error );
                errorsMap.put( at, error );
                dependenciesMap.put( ordering, at );
                dependsOnMap.put( at, ordering );
            }
            else
            {
                dependenciesMap.put( orderingMR, at );
                dependsOnMap.put( at, orderingMR );
            }
        }

        // Substring matching rule
        String substring = at.getSubstrName();
        if ( ( substring != null ) && ( !"".equals( substring ) ) )
        {
            MatchingRuleImpl substringMR = schemaHandler.getMatchingRule( substring );
            if ( substringMR == null )
            {
                SchemaError error = new NonExistingMatchingRuleError( at, substring,
                    NonExistingMatchingRuleErrorEnum.SUBSTRING );
                errorsList.add( error );
View Full Code Here


            equalityComboViewer.setSelection( new StructuredSelection( new NonExistingMatchingRule(
                NonExistingMatchingRule.NONE ) ), true );
        }
        else
        {
            MatchingRuleImpl matchingRule = schemaHandler.getMatchingRule( equalityName );
            if ( matchingRule != null )
            {
                equalityComboViewer.setSelection( new StructuredSelection( matchingRule ), true );
            }
            else
View Full Code Here

            orderingComboViewer.setSelection( new StructuredSelection( new NonExistingMatchingRule(
                NonExistingMatchingRule.NONE ) ), true );
        }
        else
        {
            MatchingRuleImpl matchingRule = schemaHandler.getMatchingRule( orderingName );
            if ( matchingRule != null )
            {
                orderingComboViewer.setSelection( new StructuredSelection( matchingRule ), true );
            }
            else
View Full Code Here

            substringComboViewer.setSelection( new StructuredSelection( new NonExistingMatchingRule(
                NonExistingMatchingRule.NONE ) ), true );
        }
        else
        {
            MatchingRuleImpl matchingRule = schemaHandler.getMatchingRule( substringName );
            if ( matchingRule != null )
            {
                substringComboViewer.setSelection( new StructuredSelection( matchingRule ), true );
            }
            else
View Full Code Here

            equalityComboViewer.setSelection( new StructuredSelection( new NonExistingMatchingRule(
                NonExistingMatchingRule.NONE ) ), true );
        }
        else
        {
            MatchingRuleImpl matchingRule = schemaHandler.getMatchingRule( equalityName );
            if ( matchingRule != null )
            {
                equalityComboViewer.setSelection( new StructuredSelection( matchingRule ), true );
            }
            else
View Full Code Here

            orderingComboViewer.setSelection( new StructuredSelection( new NonExistingMatchingRule(
                NonExistingMatchingRule.NONE ) ), true );
        }
        else
        {
            MatchingRuleImpl matchingRule = schemaHandler.getMatchingRule( orderingName );
            if ( matchingRule != null )
            {
                orderingComboViewer.setSelection( new StructuredSelection( matchingRule ), true );
            }
            else
View Full Code Here

            substringComboViewer.setSelection( new StructuredSelection( new NonExistingMatchingRule(
                NonExistingMatchingRule.NONE ) ), true );
        }
        else
        {
            MatchingRuleImpl matchingRule = schemaHandler.getMatchingRule( substringName );
            if ( matchingRule != null )
            {
                substringComboViewer.setSelection( new StructuredSelection( matchingRule ), true );
            }
            else
View Full Code Here

            }
            attributeTypesMap.put( at.getOid(), at );
        }
        else if ( object instanceof MatchingRuleImpl )
        {
            MatchingRuleImpl mr = ( MatchingRuleImpl ) object;
            matchingRulesList.add( mr );
            String[] names = mr.getNames();
            if ( names != null )
            {
                for ( String name : names )
                {
                    matchingRulesMap.put( name.toLowerCase(), mr );
                }
            }
            matchingRulesMap.put( mr.getOid(), mr );
        }
        else if ( object instanceof ObjectClassImpl )
        {
            ObjectClassImpl oc = ( ObjectClassImpl ) object;
            objectClassesList.add( oc );
View Full Code Here

            }
            attributeTypesMap.remove( at.getOid() );
        }
        else if ( object instanceof MatchingRuleImpl )
        {
            MatchingRuleImpl mr = ( MatchingRuleImpl ) object;
            matchingRulesList.remove( mr );
            String[] names = mr.getNames();
            if ( names != null )
            {
                for ( String name : mr.getNames() )
                {
                    matchingRulesMap.remove( name.toLowerCase() );
                }
            }
            matchingRulesMap.remove( mr.getOid() );
        }
        else if ( object instanceof ObjectClassImpl )
        {
            ObjectClassImpl oc = ( ObjectClassImpl ) object;
            objectClassesList.remove( oc );
View Full Code Here

     *      the schema
     * @throws XMLSchemaFileImportException
     */
    private static void readMatchingRule( Element element, Schema schema ) throws XMLSchemaFileImportException
    {
        MatchingRuleImpl mr = null;

        // OID
        Attribute oidAttribute = element.attribute( OID_TAG );
        if ( ( oidAttribute != null ) && ( !oidAttribute.getValue().equals( "" ) ) )
        {
            mr = new MatchingRuleImpl( oidAttribute.getValue() );
        }
        else
        {
            throw new XMLSchemaFileImportException( "A matching rule definition must contain an attribute for the OID." );
        }

        // Schema
        mr.setSchema( schema.getName() );

        // Aliases
        Element aliasesElement = element.element( ALIASES_TAG );
        if ( aliasesElement != null )
        {
            List<String> aliases = new ArrayList<String>();
            for ( Iterator<?> i = aliasesElement.elementIterator( ALIAS_TAG ); i.hasNext(); )
            {
                Element aliasElement = ( Element ) i.next();
                aliases.add( aliasElement.getText() );
            }
            if ( aliases.size() >= 1 )
            {
                mr.setNames( aliases.toArray( new String[0] ) );
            }
        }

        // Description
        Element descriptionElement = element.element( DESCRIPTION_TAG );
        if ( ( descriptionElement != null ) && ( !descriptionElement.getText().equals( "" ) ) )
        {
            mr.setDescription( descriptionElement.getText() );
        }

        // Obsolete
        Attribute obsoleteAttribute = element.attribute( OBSOLETE_TAG );
        if ( ( obsoleteAttribute != null ) && ( !obsoleteAttribute.getValue().equals( "" ) ) )
        {
            mr.setObsolete( readBoolean( obsoleteAttribute.getValue() ) );
        }

        // Syntax OID
        Element syntaxOidElement = element.element( SYNTAX_OID_TAG );
        if ( ( syntaxOidElement != null ) && ( !syntaxOidElement.getText().equals( "" ) ) )
        {
            mr.setSyntaxOid( syntaxOidElement.getText() );
        }

        // Adding the matching rule to the schema
        schema.addMatchingRule( mr );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.schemaeditor.model.MatchingRuleImpl

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.