Package org.apache.directory.ldapstudio.browser.core.model

Examples of org.apache.directory.ldapstudio.browser.core.model.IAttribute



    public int compare( Object o1, Object o2 )
    {

        IAttribute attribute1 = null;
        IValue value1 = null;
        if ( o1 instanceof IAttribute )
        {
            attribute1 = ( IAttribute ) o1;
        }
        else if ( o1 instanceof IValue )
        {
            value1 = ( IValue ) o1;
            attribute1 = value1.getAttribute();
        }
        else if ( o1 instanceof LdifAttrValLine )
        {
            LdifAttrValLine line1 = ( LdifAttrValLine ) o1;
            value1 = ModelConverter.ldifAttrValLineToValue( line1, dummyEntry );
            attribute1 = value1.getAttribute();
        }

        IAttribute attribute2 = null;
        IValue value2 = null;
        if ( o2 instanceof IAttribute )
        {
            attribute2 = ( IAttribute ) o2;
        }
View Full Code Here


    {

        List<IValue> valueList = new ArrayList<IValue>();
        for ( Iterator it = attributeHierarchy.iterator(); it.hasNext(); )
        {
            IAttribute attribute = ( IAttribute ) it.next();
            valueList.addAll( Arrays.asList( attribute.getValues() ) );
        }

        StringBuffer sb = new StringBuffer();
        if ( valueList.size() > 1 )
            sb.append( valueList.size() + " values: " );
View Full Code Here

                                {
                                    // select the value
                                    LdifAttrValLine line = ( LdifAttrValLine ) element;
                                    for ( int a = 0; a < attributes.length; a++ )
                                    {
                                        IAttribute attribute = attributes[a];
                                        if ( attribute.getDescription().equals( line.getUnfoldedAttributeDescription() ) )
                                        {
                                            IValue[] values = attribute.getValues();
                                            for ( int v = 0; v < values.length; v++ )
                                            {
                                                IValue value = values[v];
                                                if ( value.getStringValue().equals( line.getValueAsString() ) )
                                                {
                                                    selectionList.add( value );
                                                }
                                            }
                                        }
                                    }
                                }
                                else if ( element instanceof List )
                                {
                                    // select attribute and all values
                                    List list = ( List ) element;
                                    if ( !list.isEmpty() && list.get( 0 ) instanceof LdifAttrValLine )
                                    {
                                        LdifAttrValLine line = ( LdifAttrValLine ) list.get( 0 );
                                        for ( int a = 0; a < attributes.length; a++ )
                                        {
                                            IAttribute attribute = attributes[a];
                                            if ( attribute.getDescription().equals(
                                                line.getUnfoldedAttributeDescription() ) )
                                            {
                                                selectionList.add( attribute );
                                                selectionList.addAll( Arrays.asList( attribute.getValues() ) );
                                            }
                                        }
                                    }
                                }
                                else if ( element instanceof LdifRecord )
                                {
                                    for ( int a = 0; a < attributes.length; a++ )
                                    {
                                        IAttribute attribute = attributes[a];
                                        selectionList.add( attribute );
                                        selectionList.addAll( Arrays.asList( attribute.getValues() ) );
                                    }
                                }
                            }

                            IStructuredSelection selection = new StructuredSelection( selectionList );
View Full Code Here

     */
    public boolean select( Viewer viewer, Object parentElement, Object element )
    {
        if ( element instanceof IAttribute )
        {
            IAttribute attribute = ( IAttribute ) element;

            // check if one of the values goes through the quick filter
            boolean oneGoesThrough = false;
            IValue[] values = attribute.getValues();
            for ( int i = 0; i < values.length; i++ )
            {
                if ( goesThroughQuickFilter( values[i] ) )
                {
                    oneGoesThrough = true;
View Full Code Here

        Set filterSet = new LinkedHashSet();
        for ( int i = 0; i < getSelectedAttributeHierarchies().length; i++ )
        {
            for ( Iterator it = getSelectedAttributeHierarchies()[i].iterator(); it.hasNext(); )
            {
                IAttribute att = ( IAttribute ) it.next();
                IValue[] values = att.getValues();
                for ( int v = 0; v < values.length; v++ )
                {
                    filterSet.add( LdapFilterUtils.getFilter( values[v] ) );
                }
            }
View Full Code Here

     * {@inheritDoc}
     */
    public int compare( Viewer viewer, Object o1, Object o2 )
    {
        // check o1
        IAttribute attribute1 = null;
        IValue value1 = null;
        if ( o1 instanceof IAttribute )
        {
            attribute1 = ( IAttribute ) o1;
        }
        else if ( o1 instanceof IValue )
        {
            value1 = ( IValue ) o1;
            attribute1 = value1.getAttribute();
        }

        // check o2
        IAttribute attribute2 = null;
        IValue value2 = null;
        if ( o2 instanceof IAttribute )
        {
            attribute2 = ( IAttribute ) o2;
        }
View Full Code Here

     */
    public Object[] getChildren( Object parentElement )
    {
        if ( parentElement instanceof IAttribute )
        {
            IAttribute attribute = ( IAttribute ) parentElement;
            IValue[] values = attribute.getValues();
            return values;
        }
        return null;
    }
View Full Code Here

                        IEntry entry = value.getAttribute().getEntry();
                        select( entry );
                    }
                    else if ( obj instanceof IAttribute )
                    {
                        IAttribute attribute = ( IAttribute ) obj;
                        IEntry entry = attribute.getEntry();
                        select( entry );

                    }
                    else if ( obj instanceof ISearchResult )
                    {
View Full Code Here

        {

            boolean typeDetected = false;

            // check OpenLDAP
            IAttribute ocAttribute = connection.getRootDSE().getAttribute( "objectClass" );
            if ( ocAttribute != null )
            {
                for ( int i = 0; i < ocAttribute.getStringValues().length; i++ )
                {
                    if ( "OpenLDAProotDSE".equals( ocAttribute.getStringValues()[i] ) )
                    {
                        IAttribute ccAttribute = connection.getRootDSE().getAttribute( "configContext" );
                        if ( ccAttribute != null )
                        {
                            typeText.setText( "OpenLDAP 2.3" );
                            typeDetected = true;
                        }
                        if ( !typeDetected )
                        {
                            IAttribute scAttribute = connection.getRootDSE().getAttribute( "supportedControl" );
                            if ( scAttribute != null )
                            {
                                for ( int sci = 0; sci < scAttribute.getStringValues().length; sci++ )
                                {
                                    // if("1.2.840.113556.1.4.319".equals(scAttribute.getStringValues()[sci]))
                                    // {
                                    if ( "2.16.840.1.113730.3.4.18".equals( scAttribute.getStringValues()[sci] ) )
                                    {
                                        typeText.setText( "OpenLDAP 2.2" );
                                        typeDetected = true;
                                    }
                                }
                            }

                        }
                        if ( !typeDetected )
                        {
                            IAttribute seAttribute = connection.getRootDSE().getAttribute( "supportedExtension" );
                            if ( seAttribute != null )
                            {
                                for ( int sei = 0; sei < seAttribute.getStringValues().length; sei++ )
                                {
                                    if ( "1.3.6.1.4.1.4203.1.11.3".equals( seAttribute.getStringValues()[sei] ) )
                                    {
                                        typeText.setText( "OpenLDAP 2.1" );
                                        typeDetected = true;
                                    }
                                }
                            }
                        }
                        if ( !typeDetected )
                        {
                            IAttribute sfAttribute = connection.getRootDSE().getAttribute( "supportedFeatures" );
                            if ( sfAttribute != null )
                            {
                                for ( int sfi = 0; sfi < sfAttribute.getStringValues().length; sfi++ )
                                {
                                    if ( "1.3.6.1.4.1.4203.1.5.4".equals( sfAttribute.getStringValues()[sfi] ) )
                                    {
                                        typeText.setText( "OpenLDAP 2.0" );
                                        typeDetected = true;
                                    }
                                }
                            }
                        }
                        if ( !typeDetected )
                        {
                            typeText.setText( "OpenLDAP" );
                            typeDetected = true;
                        }
                    }
                }
            }

            // check Siemens DirX
            IAttribute ssseAttribute = connection.getRootDSE().getAttribute( "subSchemaSubentry" );
            if ( ssseAttribute != null )
            {
                for ( int i = 0; i < ssseAttribute.getStringValues().length; i++ )
                {
                    if ( "cn=LDAPGlobalSchemaSubentry".equals( ssseAttribute.getStringValues()[i] ) )
                    {
                        typeText.setText( "Siemens DirX" );
                    }
                }
            }

            // check active directory
            IAttribute rdncAttribute = connection.getRootDSE().getAttribute( "rootDomainNamingContext" );
            if ( rdncAttribute != null )
            {
                IAttribute ffAttribute = connection.getRootDSE().getAttribute( "forestFunctionality" );
                if ( ffAttribute != null )
                {
                    typeText.setText( "Microsoft Active Directory 2003" );
                }
                else
                {
                    typeText.setText( "Microsoft Active Directory 2000" );
                }
            }

            // check Novell eDirectory / Sun Directory Server / Netscape
            // Directory Server
            IAttribute vnAttribute = connection.getRootDSE().getAttribute( "vendorName" );
            IAttribute vvAttribute = connection.getRootDSE().getAttribute( "vendorVersion" );
            if ( vnAttribute != null && vnAttribute.getStringValues().length > 0 && vvAttribute != null
                && vvAttribute.getStringValues().length > 0 )
            {
                if ( vnAttribute.getStringValues()[0].indexOf( "Novell" ) > -1
                    || vvAttribute.getStringValues()[0].indexOf( "eDirectory" ) > -1 )
                {
                    typeText.setText( "Novell eDirectory" );
                }
                if ( vnAttribute.getStringValues()[0].indexOf( "Sun" ) > -1
                    || vvAttribute.getStringValues()[0].indexOf( "Sun" ) > -1 )
                {
                    typeText.setText( "Sun Directory Server" );
                }
                if ( vnAttribute.getStringValues()[0].indexOf( "Netscape" ) > -1
                    || vvAttribute.getStringValues()[0].indexOf( "Netscape" ) > -1 )
                {
                    typeText.setText( "Netscape Directory Server" );
                }
            }
        }
View Full Code Here

                    return "";
            }
        }
        else if ( obj != null && obj instanceof IAttribute )
        {
            IAttribute attribute = ( IAttribute ) obj;
            if ( index == EntryEditorWidgetTableMetadata.KEY_COLUMN_INDEX )
            {
                return attribute.getDescription() + " (" + attribute.getValueSize() + " values)";
            }
            else
            {
                return "";
            }
View Full Code Here

TOP

Related Classes of org.apache.directory.ldapstudio.browser.core.model.IAttribute

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.