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

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


            supComboViewer.setSelection( new StructuredSelection( new NonExistingAttributeType(
                NonExistingAttributeType.NONE ) ), true );
        }
        else
        {
            AttributeTypeImpl supAT = schemaHandler.getAttributeType( supAtName );
            if ( supAT != null )
            {
                supComboViewer.setSelection( new StructuredSelection( supAT ), true );
            }
            else
View Full Code Here


    /* (non-Javadoc)
     * @see org.eclipse.jface.wizard.Wizard#performFinish()
     */
    public boolean performFinish()
    {
        AttributeTypeImpl newAT = new AttributeTypeImpl( generalPage.getOidValue() );
        newAT.setSchema( generalPage.getSchemaValue() );
        newAT.setNames( generalPage.getAliasesValue() );
        newAT.setDescription( generalPage.getDescriptionValue() );
        newAT.setSuperiorName( contentPage.getSuperiorValue() );
        newAT.setUsage( contentPage.getUsageValue() );
        newAT.setSyntaxOid( contentPage.getSyntax() );
        newAT.setLength( contentPage.getSyntaxLengthValue() );
        newAT.setObsolete( contentPage.getObsoleteValue() );
        newAT.setSingleValue( contentPage.getSingleValueValue() );
        newAT.setCollective( contentPage.getCollectiveValue() );
        newAT.setCanUserModify( !contentPage.getNoUserModificationValue() );
        newAT.setEqualityName( matchingRulesPage.getEqualityMatchingRuleValue() );
        newAT.setOrderingName( matchingRulesPage.getOrderingMatchingRuleValue() );
        newAT.setSubstrName( matchingRulesPage.getSubstringMatchingRuleValue() );

        Activator.getDefault().getSchemaHandler().addAttributeType( newAT );

        return true;
    }
View Full Code Here

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

            String[] names = at.getNames();
            if ( ( names != null ) && ( names.length > 0 ) )
            {
                return ViewUtils.concateAliases( names ) + "  -  (" + at.getOid() + ")";
            }
            else
            {
                return "(None)  -  (" + at.getOid() + ")";
            }
        }
        else if ( obj instanceof NonExistingAttributeType )
        {
            return ( ( NonExistingAttributeType ) obj ).getDisplayName();
View Full Code Here

     * @return
     *      a clone of the given attribute type
     */
    public static AttributeTypeImpl getClone( AttributeTypeImpl at )
    {
        AttributeTypeImpl clone = new AttributeTypeImpl( at.getOid() );
        clone.setNames( at.getNames() );
        clone.setSchema( at.getSchema() );
        clone.setDescription( at.getDescription() );
        clone.setSuperiorName( at.getSuperiorName() );
        clone.setUsage( at.getUsage() );
        clone.setSyntaxOid( at.getSyntaxOid() );
        clone.setLength( at.getLength() );
        clone.setObsolete( at.isObsolete() );
        clone.setSingleValue( at.isSingleValue() );
        clone.setCollective( at.isCollective() );
        clone.setCanUserModify( at.isCanUserModify() );
        clone.setEqualityName( at.getEqualityName() );
        clone.setOrderingName( at.getOrderingName() );
        clone.setSubstrName( at.getSubstrName() );

        return clone;
    }
View Full Code Here

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

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

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

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

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

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

                // Comparing the First Name
                if ( ( o1Names != null ) && ( o2Names != null ) )
                {
                    if ( ( o1Names.length > 0 ) && ( o2Names.length > 0 ) )
                    {
                        return o1Names[0].compareToIgnoreCase( o2Names[0] );
                    }
                    else if ( ( o1Names.length == 0 ) && ( o2Names.length > 0 ) )
                    {
                        return "".compareToIgnoreCase( o2Names[0] );
                    }
                    else if ( ( o1Names.length > 0 ) && ( o2Names.length == 0 ) )
                    {
                        return o1Names[0].compareToIgnoreCase( "" );
                    }
                }

                // Default
                return o1.toString().compareToIgnoreCase( o2.toString() );
            }
        };

        oidSorter = new Comparator<SchemaObject>()
        {
            public int compare( SchemaObject o1, SchemaObject o2 )
            {
                if ( ( o1 instanceof AttributeTypeImpl ) && ( o2 instanceof AttributeTypeImpl ) )
                {
                    AttributeTypeImpl at1 = ( AttributeTypeImpl ) o1;
                    AttributeTypeImpl at2 = ( AttributeTypeImpl ) o2;

                    return at1.getOid().compareToIgnoreCase( at2.getOid() );
                }
                else if ( ( o1 instanceof ObjectClassImpl ) && ( o2 instanceof ObjectClassImpl ) )
                {
                    ObjectClassImpl oc1 = ( ObjectClassImpl ) o1;
                    ObjectClassImpl oc2 = ( ObjectClassImpl ) o2;

                    return oc1.getOid().compareToIgnoreCase( oc2.getOid() );
                }
                else if ( ( o1 instanceof AttributeTypeImpl ) && ( o2 instanceof ObjectClassImpl ) )
                {
                    AttributeTypeImpl at = ( AttributeTypeImpl ) o1;
                    ObjectClassImpl oc = ( ObjectClassImpl ) o2;

                    return at.getOid().compareToIgnoreCase( oc.getOid() );
                }
                else if ( ( o1 instanceof ObjectClassWrapper ) && ( o2 instanceof AttributeTypeImpl ) )
                {
                    ObjectClassImpl oc = ( ObjectClassImpl ) o1;
                    AttributeTypeImpl at = ( AttributeTypeImpl ) o2;

                    return oc.getOid().compareToIgnoreCase( at.getOid() );
                }

                // Default
                return o1.toString().compareToIgnoreCase( o2.toString() );
            }
View Full Code Here

            .getInt( PluginConstants.PREFS_SEARCH_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH );
        boolean schemaLabelDisplay = store.getBoolean( PluginConstants.PREFS_SEARCH_VIEW_SCHEMA_LABEL_DISPLAY );

        if ( element instanceof AttributeTypeImpl )
        {
            AttributeTypeImpl at = ( AttributeTypeImpl ) element;

            // Label
            if ( labelValue == PluginConstants.PREFS_SEARCH_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_SEARCH_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_SEARCH_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 ObjectClassImpl )
        {
            ObjectClassImpl oc = ( ObjectClassImpl ) element;

            // Label
            if ( labelValue == PluginConstants.PREFS_SEARCH_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_SEARCH_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_SEARCH_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$
            }
        }

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

                if ( secondaryLabelValue == PluginConstants.PREFS_SEARCH_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_SEARCH_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_SEARCH_VIEW_LABEL_OID )
                {
                    secondaryLabel = at.getOid();
                }
            }
            else if ( element instanceof ObjectClassImpl )
            {
                ObjectClassImpl oc = ( ObjectClassImpl ) element;
View Full Code Here

            children = new ArrayList<TreeNode>();
            children.add( ocw );
        }
        else if ( parentElement instanceof AttributeTypeImpl )
        {
            AttributeTypeImpl at = ( AttributeTypeImpl ) parentElement;

            AttributeTypeWrapper atw = new AttributeTypeWrapper( at, null );
            children = new ArrayList<TreeNode>();
            children.add( atw );
        }
        else if ( parentElement instanceof ObjectClassWrapper )
        {
            ObjectClassWrapper ocw = ( ObjectClassWrapper ) parentElement;
            ObjectClassImpl oc = ocw.getObjectClass();

            if ( mode == PluginConstants.PREFS_HIERARCHY_VIEW_MODE_SUPERTYPE )
            {
                String[] superiors = oc.getSuperClassesNames();
                for ( String superior : superiors )
                {
                    if ( superior != null || "".equals( superior ) ) //$NON-NLS-1$
                    {
                        ObjectClassImpl supOC = schemaHandler.getObjectClass( superior );
                        if ( supOC != null )
                        {
                            ObjectClassWrapper supOCW = new ObjectClassWrapper( supOC, ocw );
                            ocw.addChild( supOCW );
                        }
                    }
                }
            }
            else if ( mode == PluginConstants.PREFS_HIERARCHY_VIEW_MODE_SUBTYPE )
            {
                for ( ObjectClassImpl objectClass : objectClasses )
                {
                    String[] superiors = objectClass.getSuperClassesNames();
                    for ( String superior : superiors )
                    {
                        if ( superior != null || "".equals( superior ) ) //$NON-NLS-1$
                        {
                            ObjectClassImpl supOC = schemaHandler.getObjectClass( superior );
                            if ( supOC != null && oc.equals( supOC ) )
                            {
                                ObjectClassWrapper supOCW = new ObjectClassWrapper( objectClass, ocw );
                                ocw.addChild( supOCW );
                            }
                        }
                    }
                }
            }

            children = ocw.getChildren();
        }
        else if ( parentElement instanceof AttributeTypeWrapper )
        {
            AttributeTypeWrapper atw = ( AttributeTypeWrapper ) parentElement;
            AttributeTypeImpl at = atw.getAttributeType();

            if ( mode == PluginConstants.PREFS_HIERARCHY_VIEW_MODE_SUPERTYPE )
            {
                String superior = at.getSuperiorName();
                if ( superior != null || "".equals( superior ) ) //$NON-NLS-1$
                {
                    AttributeTypeImpl supAT = schemaHandler.getAttributeType( superior );
                    if ( supAT != null )
                    {
                        AttributeTypeWrapper supATW = new AttributeTypeWrapper( supAT, atw );
                        atw.addChild( supATW );
                    }
                }
            }
            else if ( mode == PluginConstants.PREFS_HIERARCHY_VIEW_MODE_SUBTYPE )
            {
                for ( AttributeTypeImpl attributeType : attributeTypes )
                {
                    String superior = attributeType.getSuperiorName();
                    if ( superior != null && !"".equals( superior ) ) //$NON-NLS-1$
                    {
                        AttributeTypeImpl supAT = schemaHandler.getAttributeType( superior );
                        if ( supAT != null && at.equals( supAT ) )
                        {
                            AttributeTypeWrapper supATW = new AttributeTypeWrapper( attributeType, atw );
                            atw.addChild( supATW );
                        }
View Full Code Here

            }
        }
        else if ( element instanceof DifferentUsageAsSuperiorError )
        {
            DifferentUsageAsSuperiorError differentUsageAsSuperiorError = ( DifferentUsageAsSuperiorError ) element;
            AttributeTypeImpl source = ( AttributeTypeImpl ) differentUsageAsSuperiorError.getSource();
            AttributeTypeImpl superior = ( AttributeTypeImpl ) differentUsageAsSuperiorError.getSuperior();

            message.append( "Attribute type '" + getDisplayName( source )
                + "' has a different usage value than its superior '" + getDisplayName( superior ) + "'." );
        }
        else if ( element instanceof DifferentCollectiveAsSuperiorError )
        {
            DifferentCollectiveAsSuperiorError differentCollectiveAsSuperiorError = ( DifferentCollectiveAsSuperiorError ) element;
            AttributeTypeImpl source = ( AttributeTypeImpl ) differentCollectiveAsSuperiorError.getSource();
            AttributeTypeImpl superior = ( AttributeTypeImpl ) differentCollectiveAsSuperiorError.getSuperior();

            message.append( "Attribute type '" + getDisplayName( source ) + "' must be collective as its superior '"
                + getDisplayName( superior ) + "'." );
        }
View Full Code Here

     */
    public String getColumnText( Object element, int columnIndex )
    {
        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() + ")";
            }
        }
        else if ( element instanceof NonExistingAttributeType )
        {
            return ( ( NonExistingAttributeType ) element ).getDisplayName();
View Full Code Here

            List<Object> results = new ArrayList<Object>();

            String[] attributes = ( String[] ) inputElement;
            for ( String attribute : attributes )
            {
                AttributeTypeImpl at = schemaHandler.getAttributeType( attribute );
                if ( at != null )
                {
                    results.add( at );
                }
                else
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.