Package org.apache.directory.studio.ldapbrowser.core.model

Examples of org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy


                }

                for ( int r = 0; r < ras.length; r++ )
                {
                    // clear attributes requested from server, also include sub-types
                    AttributeHierarchy ah = entry.getAttributeWithSubtypes( ras[r] );
                    if ( ah != null )
                    {
                        for ( Iterator<IAttribute> it = ah.iterator(); it.hasNext(); )
                        {
                            IAttribute attribute = it.next();
                            entry.deleteAttribute( attribute );
                        }
                    }
View Full Code Here


        Set<ObjectClass> selectedObjectClasses = new HashSet<ObjectClass>();
        for ( IValue value : values )
        {
            String type = value.getAttribute().getType();
            AttributeType atd = value.getAttribute().getAttributeTypeDescription();
            AttributeHierarchy ah = value.getAttribute().getEntry().getAttributeWithSubtypes( type );

            // check if (part of) Rdn is selected
            if ( value.isRdnPart() )
            {
                message.append( NLS.bind( Messages.getString( "DeleteAction.DeletePartOfRDN" ), value.toString() ) ); //$NON-NLS-1$
                message.append( BrowserCoreConstants.LINE_SEPARATOR );
                message.append( BrowserCoreConstants.LINE_SEPARATOR );
            }

            // check if a required objectClass is selected
            if ( value.getAttribute().isObjectClassAttribute() )
            {
                selectedObjectClasses.add( value.getAttribute().getEntry().getBrowserConnection().getSchema()
                    .getObjectClassDescription( value.getStringValue() ) );
            }

            // check if ALL values of objectClass or a MUST attribute are selected
            if ( !attributeNameToSelectedValuesCountMap.containsKey( atd ) )
            {
                attributeNameToSelectedValuesCountMap.put( atd, new Integer( 0 ) );
            }
            int count = ( attributeNameToSelectedValuesCountMap.get( atd ) ).intValue() + 1;
            attributeNameToSelectedValuesCountMap.put( atd, new Integer( count ) );
            if ( value.getAttribute().isObjectClassAttribute() && count >= ah.getValueSize() )
            {
                message.append( Messages.getString( "DeleteAction.DeleteObjectClass" ) ); //$NON-NLS-1$
                message.append( BrowserCoreConstants.LINE_SEPARATOR );
                message.append( BrowserCoreConstants.LINE_SEPARATOR );
                continue;
            }
            else if ( value.getAttribute().isMustAttribute() && count >= ah.getValueSize() )
            {
                message.append( NLS.bind( Messages.getString( "DeleteAction.DeleteMust" ), type ) ); //$NON-NLS-1$
                message.append( BrowserCoreConstants.LINE_SEPARATOR );
                message.append( BrowserCoreConstants.LINE_SEPARATOR );
            }
View Full Code Here

                IEntry entry = ( IEntry ) newInput;
                dn = "DN: " + entry.getDn().getUpName();
            }
            else if ( newInput != null && newInput instanceof AttributeHierarchy )
            {
                AttributeHierarchy ah = ( AttributeHierarchy ) newInput;
                dn = "DN: " + ah.getAttribute().getEntry().getDn().getUpName();
            }
            else
            {
                dn = "No entry selected";
                enabled = false;
View Full Code Here

                return values;
            }
        }
        else if ( inputElement != null && inputElement instanceof AttributeHierarchy )
        {
            AttributeHierarchy ah = ( AttributeHierarchy ) inputElement;
            IAttribute[] attributes = ah.getAttributes();
            Object[] values = getValues( attributes, showOperationalAttributes );
            return values;
        }
        else
        {
View Full Code Here

                for ( int i = 0; i < objects.length; i++ )
                {
                    Object object = objects[i];
                    if ( object instanceof AttributeHierarchy )
                    {
                        AttributeHierarchy ah = ( AttributeHierarchy ) object;
                        for ( IAttribute attribute : ah )
                        {
                            entry = attribute.getEntry();
                            IValue[] values = attribute.getValues();
                            for ( int v = 0; v < values.length; v++ )
View Full Code Here

            String[] returningAttributes = searchResult.getSearch().getReturningAttributes();
            for ( int r = 0; r < returningAttributes.length; r++ )
            {
                String ra = returningAttributes[r];
                AttributeHierarchy ah = searchResult.getAttributeWithSubtypes( ra );
                if ( ah != null )
                {
                    IAttribute[] attributes = ah.getAttributes();
                    for ( int i = 0; i < attributes.length; i++ )
                    {
                        IValue[] values = attributes[i].getValues();
                        for ( int k = 0; k < values.length; k++ )
                        {
View Full Code Here

    public boolean canModify( Object element, String property )
    {
        if ( element != null && element instanceof ISearchResult && property != null )
        {
            ISearchResult result = ( ISearchResult ) element;
            AttributeHierarchy ah = result.getAttributeWithSubtypes( property );

            // check DN
            if ( BrowserUIConstants.DN.equals( property ) )
            {
                return false;
            }

            // attribute dummy
            if ( ah == null )
            {
                ah = new AttributeHierarchy( result.getEntry(), property, new IAttribute[]
                    { new Attribute( result.getEntry(), property ) } );
            }

            // check schema modifiable
            boolean isOneModifyable = false;
View Full Code Here

    public Object getValue( Object element, String property )
    {
        if ( element != null && element instanceof ISearchResult && property != null )
        {
            ISearchResult result = ( ISearchResult ) element;
            AttributeHierarchy ah = result.getAttributeWithSubtypes( property );

            if ( !canModify( element, property ) )
            {
                return null;
            }

            if ( ah == null )
            {
                ah = new AttributeHierarchy( result.getEntry(), property, new IAttribute[]
                    { new Attribute( result.getEntry(), property ) } );
            }

            return valueEditorManager.getCurrentValueEditor( ah ).getRawValue( ah );
        }
View Full Code Here

        }

        if ( element != null && element instanceof ISearchResult && property != null )
        {
            ISearchResult result = ( ISearchResult ) element;
            AttributeHierarchy ah = result.getAttributeWithSubtypes( property );

            // switch operation:
            if ( ah == null && newRawValue != null )
            {
                valueEditorManager.createValue( result.getEntry(), property, newRawValue );
            }
            else if ( ah != null && newRawValue == null )
            {
                valueEditorManager.deleteAttribute( ah );
            }
            else if ( ah != null && ah.size() == 1 && ah.getAttribute().getValueSize() == 1 && newRawValue != null )
            {
                valueEditorManager.modifyValue( ah.getAttribute().getValues()[0], newRawValue );
            }
        }
    }
View Full Code Here

            // compare normalized names
            return compare( entry1.getDn().getNormName(), entry2.getDn().getNormName() );
        }
        else
        {
            AttributeHierarchy ah1 = entry1.getAttributeWithSubtypes( attributeName );
            AttributeHierarchy ah2 = entry2.getAttributeWithSubtypes( attributeName );
            if ( ah1 == null && ah2 == null )
            {
                return equal();
            }
            else if ( ah1 == null && ah2 != null )
            {
                return lessThan();
            }
            else if ( ah1 != null && ah2 == null )
            {
                return greaterThan();
            }
            else
            {
                IAttribute attribute1 = ah1.getAttribute();
                IAttribute attribute2 = ah2.getAttribute();

                String value1 = getValue( attribute1 );
                String value2 = getValue( attribute2 );
                return compare( value1, value2 );
            }
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy

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.