Package org.apache.directory.shared.ldap.schema.parsers

Examples of org.apache.directory.shared.ldap.schema.parsers.AttributeTypeDescription


                            Messages.getString( "ObjectClassDescriptionDetailsPage.MayAttributesCount" ), new Object[] { names.size() } ) ); //$NON-NLS-1$
                for ( String name : names )
                {
                    if ( getSchema().hasAttributeTypeDescription( name ) )
                    {
                        AttributeTypeDescription mayAtd = getSchema().getAttributeTypeDescription( name );
                        Hyperlink mayLink = toolkit.createHyperlink( mayClient, SchemaUtils.toString( mayAtd ),
                            SWT.WRAP );
                        mayLink.setHref( mayAtd );
                        mayLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                        mayLink.setUnderlined( true );
View Full Code Here


            {
                supertypeSection.setText( NLS.bind( Messages
                    .getString( "AttributeTypeDescriptionDetailsPage.SupertypeCount" ), new Object[] { 1 } ) ); //$NON-NLS-1$
                if ( getSchema().hasAttributeTypeDescription( superType ) )
                {
                    AttributeTypeDescription supAtd = getSchema().getAttributeTypeDescription( superType );
                    Hyperlink superLink = toolkit.createHyperlink( superClient, SchemaUtils.toString( supAtd ),
                        SWT.WRAP );
                    superLink.setHref( supAtd );
                    superLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                    superLink.setUnderlined( true );
View Full Code Here

            if ( attributeHierarchy.size() == 1 && attributeHierarchy.getAttribute().getValueSize() == 0 )
            {
                // validate if value is allowed
                IEntry entry = attributeHierarchy.getAttribute().getEntry();
                Collection<AttributeTypeDescription> allAtds = SchemaUtils.getAllAttributeTypeDescriptions( entry );
                AttributeTypeDescription atd = attributeHierarchy.getAttribute().getAttributeTypeDescription();
                if ( !allAtds.contains( atd ) )
                {
                    message.append( NLS.bind( Messages.getString( "OpenBestEditorAction.AttributeNotInSubSchema" ), //$NON-NLS-1$
                        attributeHierarchy.getAttribute().getDescription() ) );
                    message.append( BrowserCoreConstants.LINE_SEPARATOR );
View Full Code Here

                Schema schema = getSchema();
                for ( String name : names )
                {
                    if ( schema.hasAttributeTypeDescription( name ) )
                    {
                        AttributeTypeDescription appliesAtd = schema.getAttributeTypeDescription( name );
                        Hyperlink appliesLink = toolkit.createHyperlink( appliesClient, SchemaUtils
                            .toString( appliesAtd ), SWT.WRAP );
                        appliesLink.setHref( appliesAtd );
                        appliesLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
                        appliesLink.setUnderlined( true );
View Full Code Here

        if ( userSelectedValueEditor != null )
        {
            return userSelectedValueEditor;
        }

        AttributeTypeDescription atd = schema.getAttributeTypeDescription( attributeType );
        // check attribute preferences
        Map<String, String> attributeValueEditorMap = BrowserCommonActivator.getDefault().getValueEditorsPreferences()
            .getAttributeValueEditorMap();
        if ( atd.getNumericOid() != null && attributeValueEditorMap.containsKey( atd.getNumericOid().toLowerCase() ) )
        {
            return ( IValueEditor ) class2ValueEditors.get( attributeValueEditorMap.get( atd.getNumericOid()
                .toLowerCase() ) );
        }
        List<String> names = atd.getNames();
        for ( String name : names )
        {
            if ( attributeValueEditorMap.containsKey( name.toLowerCase() ) )
            {
                return ( IValueEditor ) class2ValueEditors.get( attributeValueEditorMap.get( name.toLowerCase() ) );
View Full Code Here

    {
        if ( schema != null )
        {
            for ( String possibleAttributeType : possibleAttributeTypes.keySet() )
            {
                AttributeTypeDescription description = possibleAttributeTypes.get( possibleAttributeType );
                if ( possibleAttributeType.toUpperCase().startsWith( attributeType.toUpperCase() ) )
                {
                    String replacementString = possibleAttributeType;
                    String displayString = possibleAttributeType;
                    if ( displayString.equals( description.getNumericOid() ) )
                    {
                        displayString += " (" + SchemaUtils.toString( description ) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
                    }
                    else
                    {
                        displayString += " (" + description.getNumericOid() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
                    }
                    String info = SchemaUtils.getLdifLine( description );
                    ICompletionProposal proposal = new CompletionProposal( replacementString, offset, attributeType
                        .length(), replacementString.length(), getAttributeTypeImage(), displayString, null, info );
                    proposalList.add( proposal );
View Full Code Here

     */
    public IValueEditor[] getAlternativeValueEditors( Schema schema, String attributeName )
    {
        List<IValueEditor> alternativeList = new ArrayList<IValueEditor>();

        AttributeTypeDescription atd = schema.getAttributeTypeDescription( attributeName );

        if ( SchemaUtils.isBinary( atd, schema ) )
        {
            alternativeList.add( defaultBinaryValueEditor );
            alternativeList.add( defaultStringSingleLineValueEditor );
View Full Code Here

                    && fc.getAttributeToken().getOffset() <= hoverRegion.getOffset()
                    && hoverRegion.getOffset() <= fc.getAttributeToken().getOffset()
                        + fc.getAttributeToken().getLength() )
                {
                    String attributeType = fc.getAttributeToken().getValue();
                    AttributeTypeDescription attributeTypeDescription = schema
                        .getAttributeTypeDescription( attributeType );
                    String ldifLine = SchemaUtils.getLdifLine( attributeTypeDescription );
                    return ldifLine;
                }
                if ( fc.getAttributeToken() != null
                    && SchemaConstants.OBJECT_CLASS_AT.equalsIgnoreCase( fc.getAttributeToken().getValue() )
                    && fc.getValueToken() != null && fc.getValueToken().getOffset() <= hoverRegion.getOffset()
                    && hoverRegion.getOffset() <= fc.getValueToken().getOffset() + fc.getValueToken().getLength() )
                {
                    String objectClass = fc.getValueToken().getValue();
                    ObjectClassDescription objectClassDescription = schema.getObjectClassDescription( objectClass );
                    String ldifLine = SchemaUtils.getLdifLine( objectClassDescription );
                    return ldifLine;
                }
            }
            if ( filter.getFilterComponent() instanceof LdapFilterExtensibleComponent )
            {
                LdapFilterExtensibleComponent fc = ( LdapFilterExtensibleComponent ) filter.getFilterComponent();
                if ( fc.getAttributeToken() != null
                    && fc.getAttributeToken().getOffset() <= hoverRegion.getOffset()
                    && hoverRegion.getOffset() <= fc.getAttributeToken().getOffset()
                        + fc.getAttributeToken().getLength() )
                {
                    String attributeType = fc.getAttributeToken().getValue();
                    AttributeTypeDescription attributeTypeDescription = schema
                        .getAttributeTypeDescription( attributeType );
                    String ldifLine = SchemaUtils.getLdifLine( attributeTypeDescription );
                    return ldifLine;
                }
                if ( fc.getMatchingRuleToken() != null
View Full Code Here

        Map<AttributeTypeDescription, Integer> attributeNameToSelectedValuesCountMap = new HashMap<AttributeTypeDescription, Integer>();
        Set<ObjectClassDescription> selectedObjectClasses = new HashSet<ObjectClassDescription>();
        for ( IValue value : values )
        {
            String type = value.getAttribute().getType();
            AttributeTypeDescription 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 );
            }

            // check if a value of an operational attribute is selected
            if ( !SchemaUtils.isModifiable( atd ) )
            {
                message.append( NLS.bind( Messages.getString( "DeleteAction.DeleteNonModifiable" ), type ) ); //$NON-NLS-1$
                message.append( BrowserCoreConstants.LINE_SEPARATOR );
                message.append( BrowserCoreConstants.LINE_SEPARATOR );
                continue;
            }
        }

        // check if a required objectClass is selected
        if ( values.size() > 0 && !selectedObjectClasses.isEmpty() )
        {
            IEntry entry = values.iterator().next().getAttribute().getEntry();
            Schema schema = entry.getBrowserConnection().getSchema();
            // get remaining attributes
            Collection<ObjectClassDescription> remainingObjectClasses = entry.getObjectClassDescriptions();
            remainingObjectClasses.removeAll( selectedObjectClasses );
            Set<AttributeTypeDescription> remainingAttributeSet = new HashSet<AttributeTypeDescription>();
            for ( ObjectClassDescription ocd : remainingObjectClasses )
            {
                {
                    Collection<String> mustAttrs = SchemaUtils.getMustAttributeTypeDescriptionNamesTransitive( ocd,
                        schema );
                    for ( String mustAttr : mustAttrs )
                    {
                        AttributeTypeDescription atd = entry.getBrowserConnection().getSchema()
                            .getAttributeTypeDescription( mustAttr );
                        remainingAttributeSet.add( atd );
                    }
                    Collection<String> mayAttrs = SchemaUtils.getMayAttributeTypeDescriptionNamesTransitive( ocd,
                        schema );
                    for ( String mayAttr : mayAttrs )
                    {
                        AttributeTypeDescription atd = entry.getBrowserConnection().getSchema()
                            .getAttributeTypeDescription( mayAttr );
                        remainingAttributeSet.add( atd );
                    }
                }
            }
View Full Code Here

                {
                    if ( attribute.getAttributeNumericOidOrName() != null )
                    {
                        if ( attributeNames2AtdMap.containsKey( attribute.getAttributeNumericOidOrName() ) )
                        {
                            AttributeTypeDescription atd = ( AttributeTypeDescription ) attributeNames2AtdMap
                                .get( attribute.getAttributeNumericOidOrName() );
                            String s = atd.getNumericOid();
                            for ( String attributeName : atd.getNames() )
                            {
                                if ( !attribute.getAttributeNumericOidOrName().equals( attributeName ) )
                                {
                                    s += ", " + attributeName; //$NON-NLS-1$
                                }
                            }
                            return s;
                        }
                        else if ( attributeOid2AtdMap.containsKey( attribute.getAttributeNumericOidOrName() ) )
                        {
                            AttributeTypeDescription atd = ( AttributeTypeDescription ) attributeOid2AtdMap
                                .get( attribute.getAttributeNumericOidOrName() );
                            return SchemaUtils.toString( atd );
                        }
                        else if ( Utils.getOidDescription( attribute.getAttributeNumericOidOrName() ) != null )
                        {
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.schema.parsers.AttributeTypeDescription

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.