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

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


                        ObjectClassImpl oc = createObjectClass( searchResult );
                        oc.setSchema( name );
                        schema.addObjectClass( oc );
                        break;
                    case MATCHING_RULE:
                        MatchingRuleImpl mr = createMatchingRule( searchResult );
                        mr.setSchema( name );
                        schema.addMatchingRule( mr );
                        break;
                    case SYNTAX:
                        SyntaxImpl syntax = createSyntax( searchResult );
                        syntax.setSchema( name );
View Full Code Here


     * ObjectClass could be created
     * @throws NamingException
     */
    private static MatchingRuleImpl createMatchingRule( SearchResult sr ) throws NamingException
    {
        MatchingRuleImpl mr = new MatchingRuleImpl( getOid( sr ) );
        mr.setNames( getNames( sr ) );
        mr.setDescription( getDescription( sr ) );
        mr.setObsolete( isObsolete( sr ) );
        mr.setSyntaxOid( getSyntax( sr ) );
        return mr;
    }
View Full Code Here

        // 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

    {
        Object selection = ( ( StructuredSelection ) equalityComboViewer.getSelection() ).getFirstElement();

        if ( selection instanceof MatchingRuleImpl )
        {
            MatchingRuleImpl mr = ( ( MatchingRuleImpl ) selection );

            String[] names = mr.getNames();
            if ( ( names != null ) && ( names.length > 0 ) )
            {
                return mr.getName();
            }
            else
            {
                return mr.getOid();
            }
        }

        return null;
    }
View Full Code Here

    {
        Object selection = ( ( StructuredSelection ) orderingComboViewer.getSelection() ).getFirstElement();

        if ( selection instanceof MatchingRuleImpl )
        {
            MatchingRuleImpl mr = ( ( MatchingRuleImpl ) selection );

            String[] names = mr.getNames();
            if ( ( names != null ) && ( names.length > 0 ) )
            {
                return mr.getName();
            }
            else
            {
                return mr.getOid();
            }
        }

        return null;
    }
View Full Code Here

    {
        Object selection = ( ( StructuredSelection ) substringComboViewer.getSelection() ).getFirstElement();

        if ( selection instanceof MatchingRuleImpl )
        {
            MatchingRuleImpl mr = ( ( MatchingRuleImpl ) selection );

            String[] names = mr.getNames();
            if ( ( names != null ) && ( names.length > 0 ) )
            {
                return mr.getName();
            }
            else
            {
                return mr.getOid();
            }
        }

        return null;
    }
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.