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

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


     * ObjectClass could be created
     * @throws NamingException
     */
    private static SyntaxImpl createSyntax( SearchResult sr ) throws NamingException
    {
        SyntaxImpl syntax = new SyntaxImpl( getOid( sr ) );
        syntax.setNames( getNames( sr ) );
        syntax.setDescription( getDescription( sr ) );
        syntax.setObsolete( isObsolete( sr ) );
        syntax.setHumanReadable( isHumanReadable( sr ) );
        return syntax;
    }
View Full Code Here


     *      the schema
     * @throws XMLSchemaFileImportException
     */
    private static void readSyntax( Element element, Schema schema ) throws XMLSchemaFileImportException
    {
        SyntaxImpl syntax = null;

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

        // Schema
        syntax.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 )
            {
                syntax.setNames( aliases.toArray( new String[0] ) );
            }
        }

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

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

        // Human Readible
        Attribute humanReadibleAttribute = element.attribute( HUMAN_READABLE_TAG );
        if ( ( humanReadibleAttribute != null ) && ( !humanReadibleAttribute.getValue().equals( "" ) ) )
        {
            syntax.setHumanReadable( readBoolean( humanReadibleAttribute.getValue() ) );
        }

        // Adding the syntax to the schema
        schema.addSyntax( syntax );
    }
View Full Code Here

        // Checking syntax
        String syntaxOid = at.getSyntaxOid();
        if ( ( syntaxOid != null ) && ( !"".equals( syntaxOid ) ) )
        {
            SyntaxImpl syntax = schemaHandler.getSyntax( syntaxOid );
            if ( syntax == null )
            {
                SchemaError error = new NonExistingSyntaxError( at, syntaxOid );
                errorsList.add( error );
                errorsMap.put( at, error );
View Full Code Here

            syntaxComboViewer.setSelection( new StructuredSelection( new NonExistingSyntax( NonExistingSyntax.NONE ) ),
                true );
        }
        else
        {
            SyntaxImpl syntax = schemaHandler.getSyntax( syntaxOID );
            if ( syntax != null )
            {
                syntaxComboViewer.setSelection( new StructuredSelection( syntax ), true );
            }
            else
View Full Code Here

        {
            public String getText( Object element )
            {
                if ( element instanceof SyntaxImpl )
                {
                    SyntaxImpl syntax = ( SyntaxImpl ) element;

                    String name = syntax.getName();
                    if ( name != null )
                    {
                        return name + "  -  (" + syntax.getOid() + ")";
                    }
                    else
                    {
                        return "(None)  -  (" + syntax.getOid() + ")";
                    }
                }

                return super.getText( element );
            }
View Full Code Here

     *      the schema
     * @throws XMLSchemaFileImportException
     */
    private static void readSyntax( Element element, Schema schema ) throws XMLSchemaFileImportException
    {
        SyntaxImpl syntax = null;

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

        // Schema
        syntax.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 )
            {
                syntax.setNames( aliases.toArray( new String[0] ) );
            }
        }

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

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

        // Human Readible
        Attribute humanReadibleAttribute = element.attribute( HUMAN_READABLE_TAG );
        if ( ( humanReadibleAttribute != null ) && ( !humanReadibleAttribute.getValue().equals( "" ) ) )
        {
            syntax.setHumanReadable( readBoolean( humanReadibleAttribute.getValue() ) );
        }

        // Adding the syntax to the schema
        schema.addSyntax( syntax );
    }
View Full Code Here

        // Checking syntax
        String syntaxOid = at.getSyntaxOid();
        if ( ( syntaxOid != null ) && ( !"".equals( syntaxOid ) ) )
        {
            SyntaxImpl syntax = schemaHandler.getSyntax( syntaxOid );
            if ( syntax == null )
            {
                SchemaError error = new NonExistingSyntaxError( at, syntaxOid );
                errorsList.add( error );
                errorsMap.put( at, error );
View Full Code Here

        {
            public String getText( Object element )
            {
                if ( element instanceof SyntaxImpl )
                {
                    SyntaxImpl syntax = ( SyntaxImpl ) element;

                    String name = syntax.getName();
                    if ( name != null )
                    {
                        return name + "  -  (" + syntax.getOid() + ")";
                    }
                    else
                    {
                        return "(None)  -  (" + syntax.getOid() + ")";
                    }
                }

                return super.getText( element );
            }
View Full Code Here

                        MatchingRuleImpl mr = createMatchingRule( searchResult );
                        mr.setSchema( name );
                        schema.addMatchingRule( mr );
                        break;
                    case SYNTAX:
                        SyntaxImpl syntax = createSyntax( searchResult );
                        syntax.setSchema( name );
                        schema.addSyntax( syntax );
                        break;
                    default:
                        break;
                }
View Full Code Here

     * ObjectClass could be created
     * @throws NamingException
     */
    private static SyntaxImpl createSyntax( SearchResult sr ) throws NamingException
    {
        SyntaxImpl syntax = new SyntaxImpl( getOid( sr ) );
        syntax.setNames( getNames( sr ) );
        syntax.setDescription( getDescription( sr ) );
        syntax.setObsolete( isObsolete( sr ) );
        syntax.setHumanReadable( isHumanReadable( sr ) );
        return syntax;
    }
View Full Code Here

TOP

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

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.