Package org.apache.directory.studio.schemaeditor.controller

Examples of org.apache.directory.studio.schemaeditor.controller.SchemaHandler


                        ObjectClassImpl oc = ( ( ObjectClassWrapper ) selectedItem ).getObjectClass();
                        schemaObjectsList.add( oc );
                    }
                }

                SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
                // Removing schema objects
                for ( SchemaObject schemaObject : schemaObjectsList )
                {
                    if ( !schemasMap.containsKey( schemaObject.getSchema().toLowerCase() ) )
                    {
                        // If the schema object is not part of deleted schema, we need to delete it.
                        // But, we don't delete schema objects that are part of a deleted schema, since
                        // deleting the schema will also delete this schema object.
                        if ( schemaObject instanceof AttributeTypeImpl )
                        {
                            schemaHandler.removeAttributeType( ( AttributeTypeImpl ) schemaObject );
                        }
                        else if ( schemaObject instanceof ObjectClassImpl )
                        {
                            schemaHandler.removeObjectClass( ( ObjectClassImpl ) schemaObject );
                        }
                    }
                }

                // Removing schemas
                for ( Schema schema : schemasMap.values() )
                {
                    schemaHandler.removeSchema( schema );
                }
            }
        }
    }
View Full Code Here


     *      schema depends on
     */
    private String[] getSchemaDependencies( Schema schema )
    {
        Set<String> schemaNames = new HashSet<String>();
        SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();

        // Looping on Attribute Types
        for ( AttributeTypeImpl at : schema.getAttributeTypes() )
        {
            // Superior
            String supName = at.getSuperiorName();
            if ( supName != null )
            {
                AttributeTypeImpl sup = schemaHandler.getAttributeType( supName );
                if ( sup != null )
                {
                    if ( !schema.getName().toLowerCase().equals( sup.getSchema().toLowerCase() ) )
                    {
                        schemaNames.add( sup.getSchema() );
                    }
                }
            }
        }

        // Looping on Object Classes
        for ( ObjectClassImpl oc : schema.getObjectClasses() )
        {
            // Superiors
            String[] supNames = oc.getSuperClassesNames();
            if ( supNames != null )
            {
                for ( String supName : oc.getSuperClassesNames() )
                {
                    ObjectClassImpl sup = schemaHandler.getObjectClass( supName );
                    if ( sup != null )
                    {
                        if ( !schema.getName().toLowerCase().equals( sup.getSchema().toLowerCase() ) )
                        {
                            schemaNames.add( sup.getSchema() );
                        }
                    }
                }
            }

            // Mays
            String[] mayNames = oc.getMayNamesList();
            if ( mayNames != null )
            {
                for ( String mayName : mayNames )
                {
                    AttributeTypeImpl may = schemaHandler.getAttributeType( mayName );
                    if ( may != null )
                    {
                        if ( !schema.getName().toLowerCase().equals( may.getSchema().toLowerCase() ) )
                        {
                            schemaNames.add( may.getSchema() );
                        }
                    }
                }

            }

            // Musts
            String[] mustNames = oc.getMustNamesList();
            if ( mustNames != null )
            {
                for ( String mustName : oc.getMustNamesList() )
                {
                    AttributeTypeImpl must = schemaHandler.getAttributeType( mustName );
                    if ( must != null )
                    {
                        if ( !schema.getName().toLowerCase().equals( must.getSchema().toLowerCase() ) )
                        {
                            schemaNames.add( must.getSchema() );
View Full Code Here

    public DependenciesComputer( List<Schema> schemas ) throws DependencyComputerException
    {
        this.schemasList = schemas;

        // Creating the SchemaHandler
        schemaHandler = new SchemaHandler();

        // Creating the dependencies MultiMaps
        schemasDependencies = new MultiValueMap();
        attributeTypesDependencies = new MultiValueMap();
        objectClassesDependencies = new MultiValueMap();
View Full Code Here

    private void init( ProjectType type, String name, ProjectState state )
    {
        this.type = type;
        this.name = name;
        this.state = state;
        schemaHandler = new SchemaHandler();
    }
View Full Code Here

            String computedSearchString = searchString.replaceAll( "\\*", "\\\\S*" ); //$NON-NLS-1$ //$NON-NLS-2$
            computedSearchString = computedSearchString.replaceAll( "\\?", ".*" ); //$NON-NLS-1$ //$NON-NLS-2$

            Pattern pattern = Pattern.compile( computedSearchString, Pattern.CASE_INSENSITIVE );

            SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
            if ( schemaHandler != null )
            {
                List<SearchInEnum> searchScope = new ArrayList<SearchInEnum>( Arrays.asList( searchIn ) );

                if ( ( scope == PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_AND_OC )
                    || ( scope == PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_ONLY ) )
                {
                    // Looping on attribute types
                    List<AttributeTypeImpl> attributeTypes = schemaHandler.getAttributeTypes();
                    for ( AttributeTypeImpl at : attributeTypes )
                    {
                        // Aliases
                        if ( searchScope.contains( SearchInEnum.ALIASES ) )
                        {
                            if ( checkArray( pattern, at.getNamesRef() ) )
                            {
                                searchResults.add( at );
                                continue;
                            }
                        }

                        // OID
                        if ( searchScope.contains( SearchInEnum.OID ) )
                        {
                            if ( checkString( pattern, at.getOid() ) )
                            {
                                searchResults.add( at );
                                continue;
                            }
                        }

                        // Description
                        if ( searchScope.contains( SearchInEnum.DESCRIPTION ) )
                        {
                            if ( checkString( pattern, at.getDescription() ) )
                            {
                                searchResults.add( at );
                                continue;
                            }
                        }

                        // Superior
                        if ( searchScope.contains( SearchInEnum.SUPERIOR ) )
                        {
                            if ( checkString( pattern, at.getSuperiorName() ) )
                            {
                                searchResults.add( at );
                                continue;
                            }
                        }

                        // Syntax
                        if ( searchScope.contains( SearchInEnum.SYNTAX ) )
                        {
                            if ( checkString( pattern, at.getSyntaxOid() ) )
                            {
                                searchResults.add( at );
                                continue;
                            }
                        }

                        // Matching Rules
                        if ( searchScope.contains( SearchInEnum.MATCHING_RULES ) )
                        {
                            // Equality
                            if ( checkString( pattern, at.getEqualityName() ) )
                            {
                                searchResults.add( at );
                                continue;
                            }

                            // Ordering
                            if ( checkString( pattern, at.getOrderingName() ) )
                            {
                                searchResults.add( at );
                                continue;
                            }

                            // Substring
                            if ( checkString( pattern, at.getSubstrName() ) )
                            {
                                searchResults.add( at );
                                continue;
                            }
                        }
                    }
                }

                if ( ( scope == PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_AND_OC )
                    || ( scope == PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OC_ONLY ) )
                {
                    // Looping on object classes
                    List<ObjectClassImpl> objectClasses = schemaHandler.getObjectClasses();
                    for ( ObjectClassImpl oc : objectClasses )
                    {
                        // Aliases
                        if ( searchScope.contains( SearchInEnum.ALIASES ) )
                        {
View Full Code Here

        setPartName( input.getName() );

        originalAttributeType = ( ( AttributeTypeEditorInput ) getEditorInput() ).getAttributeType();
        modifiedAttributeType = PluginUtils.getClone( originalAttributeType );

        SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
        originalSchema = schemaHandler.getSchema( originalAttributeType.getSchema() );
        schemaHandler.addListener( originalAttributeType, attributeTypeListener );
        schemaHandler.addListener( schemaHandlerListener );

        addPageChangedListener( pageChangedListener );
    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.eclipse.ui.forms.editor.FormEditor#dispose()
     */
    public void dispose()
    {
        SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
        schemaHandler.removeListener( originalAttributeType, attributeTypeListener );
        schemaHandler.removeListener( schemaHandlerListener );

        super.dispose();
    }
View Full Code Here

            // Getting the selected 'core' schemas
            String[] selectedSchemas = schemasSelectionPage.getSelectedSchemas();
            ServerTypeEnum serverType = schemasSelectionPage.getServerType();
            if ( ( selectedSchemas != null ) && ( serverType != null ) )
            {
                SchemaHandler schemaHandler = project.getSchemaHandler();
                for ( String selectedSchema : selectedSchemas )
                {
                    Schema schema = PluginUtils.loadCoreSchema( serverType, selectedSchema );
                    if ( schema != null )
                    {
                        schema.setProject( project );
                        schemaHandler.addSchema( schema );
                    }
                }
            }
        }
View Full Code Here

        setPartName( input.getName() );

        originalObjectClass = ( ( ObjectClassEditorInput ) getEditorInput() ).getObjectClass();
        modifiedObjectClass = PluginUtils.getClone( originalObjectClass );

        SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
        originalSchema = schemaHandler.getSchema( originalObjectClass.getSchema() );
        schemaHandler.addListener( originalObjectClass, objectClassListener );
        schemaHandler.addListener( schemaHandlerListener );

        addPageChangedListener( pageChangedListener );
    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.eclipse.ui.forms.editor.FormEditor#dispose()
     */
    public void dispose()
    {
        SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
        schemaHandler.removeListener( originalObjectClass, objectClassListener );
        schemaHandler.removeListener( schemaHandlerListener );

        super.dispose();
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.schemaeditor.controller.SchemaHandler

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.