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

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


                        Schema schema = ( ( SchemaWrapper ) selectedItem ).getSchema();
                        schemasMap.put( schema.getName().toLowerCase(), schema );
                    }
                    else if ( selectedItem instanceof AttributeTypeWrapper )
                    {
                        AttributeTypeImpl at = ( ( AttributeTypeWrapper ) selectedItem ).getAttributeType();
                        schemaObjectsList.add( at );
                    }
                    else if ( selectedItem instanceof ObjectClassWrapper )
                    {
                        ObjectClassImpl oc = ( ( ObjectClassWrapper ) selectedItem ).getObjectClass();
View Full Code Here


                return "(None)  -  (" + oc.getOid() + ")";
            }
        }
        else if ( element instanceof AttributeTypeImpl )
        {
            AttributeTypeImpl at = ( AttributeTypeImpl ) element;

            String[] names = at.getNames();
            if ( ( names != null ) && ( names.length > 0 ) )
            {
                return ViewUtils.concateAliases( names ) + "  -  (" + at.getOid() + ")";
            }
            else
            {
                return "(None)  -  (" + at.getOid() + ")";
            }
        }

        // Default
        return null;
View Full Code Here

    public Object[] getElements( Object inputElement )
    {
        if ( inputElement instanceof AttributeTypeImpl )
        {
            List<ObjectClassImpl> results = new ArrayList<ObjectClassImpl>();
            AttributeTypeImpl inputAT = ( AttributeTypeImpl ) inputElement;
            SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();

            List<String> names = new ArrayList<String>();

            String[] atNames = inputAT.getNames();
            if ( atNames != null )
            {
                for ( String name : atNames )
                {
                    names.add( name.toLowerCase() );
View Full Code Here

    public Object[] getElements( Object inputElement )
    {
        if ( inputElement instanceof AttributeTypeImpl )
        {
            List<ObjectClassImpl> results = new ArrayList<ObjectClassImpl>();
            AttributeTypeImpl inputAT = ( AttributeTypeImpl ) inputElement;
            SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();

            List<String> names = new ArrayList<String>();

            String[] atNames = inputAT.getNames();
            if ( atNames != null )
            {
                for ( String name : atNames )
                {
                    names.add( name.toLowerCase() );
View Full Code Here

            public String getText( Object element )
            {
                if ( element instanceof AttributeTypeImpl )
                {
                    AttributeTypeImpl at = ( AttributeTypeImpl ) element;

                    String[] names = at.getNames();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        return ViewUtils.concateAliases( names ) + "  -  (" + at.getOid() + ")";
                    }
                    else
                    {
                        return "(None)  -  (" + at.getOid() + ")";
                    }
                }
                // Default
                return super.getText( element );
            }
View Full Code Here

     */
    public String getText( Object element )
    {
        if ( element instanceof AttributeTypeImpl )
        {
            AttributeTypeImpl at = ( AttributeTypeImpl ) element;

            String[] names = at.getNames();
            if ( ( names != null ) && ( names.length > 0 ) )
            {
                return ViewUtils.concateAliases( names ) + "  -  (" + at.getOid() + ")";
            }
            else
            {
                return "(None)  -  (" + at.getOid() + ")";
            }
        }

        // Default
        return null;
View Full Code Here

    {
        SchemaChecker schemaChecker = Activator.getDefault().getSchemaChecker();

        if ( element instanceof AttributeTypeWrapper )
        {
            AttributeTypeImpl at = ( ( AttributeTypeWrapper ) element ).getAttributeType();

            if ( schemaChecker.hasErrors( at ) )
            {
                decoration.addOverlay( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
                    PluginConstants.IMG_OVERLAY_ERROR ), IDecoration.BOTTOM_LEFT );
View Full Code Here

        }
        else if ( element instanceof AttributeTypeDifference )
        {
            AttributeTypeDifference atd = ( AttributeTypeDifference ) element;

            AttributeTypeImpl at = null;

            switch ( atd.getType() )
            {
                case ADDED:
                    at = ( ( AttributeTypeImpl ) atd.getDestination() );
                    break;
                case MODIFIED:
                    at = ( ( AttributeTypeImpl ) atd.getDestination() );
                    break;
                case REMOVED:
                    at = ( ( AttributeTypeImpl ) atd.getSource() );
                    break;
                case IDENTICAL:
                    at = ( ( AttributeTypeImpl ) atd.getDestination() );
                    break;
            }

            // Label
            if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
            {
                String[] names = at.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
            {
                String[] names = at.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = ViewUtils.concateAliases( names );
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
            {
                label = at.getOid();
            }
            else
            // Default
            {
                String[] names = at.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }

            // Abbreviate
            if ( abbreviate && ( abbreviateMaxLength < label.length() ) )
            {
                label = label.substring( 0, abbreviateMaxLength ) + "..."; //$NON-NLS-1$
            }
        }
        else if ( element instanceof ObjectClassDifference )
        {
            ObjectClassDifference ocd = ( ObjectClassDifference ) element;

            ObjectClassImpl oc = null;

            switch ( ocd.getType() )
            {
                case ADDED:
                    oc = ( ( ObjectClassImpl ) ocd.getDestination() );
                    break;
                case MODIFIED:
                    oc = ( ( ObjectClassImpl ) ocd.getDestination() );
                    break;
                case REMOVED:
                    oc = ( ( ObjectClassImpl ) ocd.getSource() );
                    break;
                case IDENTICAL:
                    oc = ( ( ObjectClassImpl ) ocd.getDestination() );
                    break;
            }

            // Label
            if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
            {
                String[] names = oc.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
            {
                String[] names = oc.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = ViewUtils.concateAliases( names );
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
            {
                label = oc.getOid();
            }
            else
            // Default
            {
                String[] names = oc.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }

            // Abbreviate
            if ( abbreviate && ( abbreviateMaxLength < label.length() ) )
            {
                label = label.substring( 0, abbreviateMaxLength ) + "..."; //$NON-NLS-1$
            }
        }
        else if ( element instanceof Folder )
        {
            Folder folder = ( Folder ) element;

            return folder.getName() + " (" + folder.getChildren().size() + ")";
        }

        // Secondary Label
        if ( secondaryLabelDisplay )
        {
            String secondaryLabel = ""; //$NON-NLS-1$
            if ( element instanceof AttributeTypeDifference )
            {
                AttributeTypeDifference atd = ( AttributeTypeDifference ) element;

                AttributeTypeImpl at = null;

                switch ( atd.getType() )
                {
                    case ADDED:
                        at = ( ( AttributeTypeImpl ) atd.getDestination() );
                        break;
                    case MODIFIED:
                        at = ( ( AttributeTypeImpl ) atd.getDestination() );
                        break;
                    case REMOVED:
                        at = ( ( AttributeTypeImpl ) atd.getSource() );
                        break;
                    case IDENTICAL:
                        at = ( ( AttributeTypeImpl ) atd.getDestination() );
                        break;
                }

                if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
                {
                    String[] names = at.getNames();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = names[0];
                    }
                    else
                    {
                        secondaryLabel = NONE;
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
                {
                    String[] names = at.getNames();
                    if ( ( names != null ) && ( names.length > 0 ) )
                    {
                        secondaryLabel = ViewUtils.concateAliases( names );
                    }
                    else
                    {
                        secondaryLabel = NONE;
                    }
                }
                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
                {
                    secondaryLabel = at.getOid();
                }
            }
            else if ( element instanceof ObjectClassDifference )
            {
                ObjectClassDifference ocd = ( ObjectClassDifference ) element;
View Full Code Here

        String[] o1Names = null;
        String[] o2Names = null;

        if ( ( o1 instanceof AttributeTypeWrapper ) && ( o2 instanceof AttributeTypeWrapper ) )
        {
            AttributeTypeImpl at1 = ( ( AttributeTypeWrapper ) o1 ).getAttributeType();
            AttributeTypeImpl at2 = ( ( AttributeTypeWrapper ) o2 ).getAttributeType();

            o1Names = at1.getNames();
            o2Names = at2.getNames();
        }
        else if ( ( o1 instanceof ObjectClassWrapper ) && ( o2 instanceof ObjectClassWrapper ) )
        {
            ObjectClassImpl oc1 = ( ( ObjectClassWrapper ) o1 ).getObjectClass();
            ObjectClassImpl oc2 = ( ( ObjectClassWrapper ) o2 ).getObjectClass();

            o1Names = oc1.getNames();
            o2Names = oc2.getNames();
        }
        else if ( ( o1 instanceof AttributeTypeWrapper ) && ( o2 instanceof ObjectClassWrapper ) )
        {
            AttributeTypeImpl at = ( ( AttributeTypeWrapper ) o1 ).getAttributeType();
            ObjectClassImpl oc = ( ( ObjectClassWrapper ) o2 ).getObjectClass();

            o1Names = at.getNames();
            o2Names = oc.getNames();
        }
        else if ( ( o1 instanceof ObjectClassWrapper ) && ( o2 instanceof AttributeTypeWrapper ) )
        {
            ObjectClassImpl oc = ( ( ObjectClassWrapper ) o1 ).getObjectClass();
            AttributeTypeImpl at = ( ( AttributeTypeWrapper ) o2 ).getAttributeType();

            o1Names = oc.getNames();
            o2Names = at.getNames();
        }

        // Comparing the First Name
        if ( ( o1Names != null ) && ( o2Names != null ) )
        {
View Full Code Here

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

TOP

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

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.