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

Examples of org.apache.directory.shared.ldap.schema.AttributeType


                existenceIdx.add( modsOid, id );
            }
        }

        // add all the values in mods to the same attribute in the entry
        AttributeType type = schemaManager.lookupAttributeTypeRegistry( modsOid );

        for ( Value<?> value : mods )
        {
            entry.add( type, value );
        }
View Full Code Here


            {
                existenceIdx.drop( modsOid, id );
            }
        }

        AttributeType attrType = schemaManager.lookupAttributeTypeRegistry( modsOid );
        /*
         * If there are no attribute values in the modifications then this
         * implies the compelete removal of the attribute from the entry. Else
         * we remove individual attribute values from the entry in mods one
         * at a time.
View Full Code Here

        for ( AVA newAtav : newRdn )
        {
            String newNormType = newAtav.getNormType();
            Object newNormValue = newAtav.getNormValue().get();
            AttributeType newRdnAttrType = schemaManager.lookupAttributeTypeRegistry( newNormType );

            entry.add( newRdnAttrType, newAtav.getUpValue() );

            if ( hasUserIndexOn( newNormType ) )
            {
                Index<?, E, Long> index = getUserIndex( newNormType );
                ( ( Index ) index ).add( newNormValue, id );

                // Make sure the altered entry shows the existence of the new attrib
                if ( !existenceIdx.forward( newNormType, id ) )
                {
                    existenceIdx.add( newNormType, id );
                }
            }
        }

        /*
         * H A N D L E   O L D   R D N
         * ====================================================================
         * If the old RDN is to be removed we need to get the attribute and
         * value for it.  Keep in mind the old RDN need not be based on the
         * same attr as the new one.  We remove the RDN value from the entry
         * and remove the value/id tuple from the index on the old RDN attr
         * if any.  We also test if the delete of the old RDN index tuple
         * removed all the attribute values of the old RDN using a reverse
         * lookup.  If so that means we blew away the last value of the old
         * RDN attribute.  In this case we need to remove the attrName/id
         * tuple from the existance index.
         *
         * We only remove an ATAV of the old RDN if it is not included in the
         * new RDN.
         */

        if ( deleteOldRdn )
        {
            RDN oldRdn = updn.getRdn();
            for ( AVA oldAtav : oldRdn )
            {
                // check if the new ATAV is part of the old RDN
                // if that is the case we do not remove the ATAV
                boolean mustRemove = true;
                for ( AVA newAtav : newRdn )
                {
                    if ( oldAtav.equals( newAtav ) )
                    {
                        mustRemove = false;
                        break;
                    }
                }

                if ( mustRemove )
                {
                    String oldNormType = oldAtav.getNormType();
                    String oldNormValue = oldAtav.getNormValue().getString();
                    AttributeType oldRdnAttrType = schemaManager.lookupAttributeTypeRegistry( oldNormType );
                    entry.remove( oldRdnAttrType, oldNormValue );

                    if ( hasUserIndexOn( oldNormType ) )
                    {
                        Index<?, E, Long> index = getUserIndex( oldNormType );
View Full Code Here

         */
        if ( req.getFilter() instanceof PresenceNode )
        {
            PresenceNode presenceNode = ( PresenceNode ) req.getFilter();
           
            AttributeType at = session.getCoreSession().getDirectoryService()
                .getSchemaManager().lookupAttributeTypeRegistry( presenceNode.getAttribute() );
            if ( at.getOid().equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
            {
                return;
            }
        }

View Full Code Here

        try
        {
            ExprNode filter = FilterParser.parse( "(uid=" + username + ")" );
            Set<AttributeTypeOptions> returningAttributes = new HashSet<AttributeTypeOptions>();
           
            AttributeType passwordAT = adminSession.getDirectoryService().getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.USER_PASSWORD_AT );
            returningAttributes.add( new AttributeTypeOptions( passwordAT) );
            bindDn = (String)ldapSession.getSaslProperty( SaslConstants.SASL_USER_BASE_DN );
           
            DN baseDn = new DN( bindDn );
View Full Code Here

                try
                {
                    String id = SchemaUtils.stripOptions( returnAttribute );
                    Set<String> options = SchemaUtils.getOptions( returnAttribute );
                   
                    AttributeType attributeType = session.getDirectoryService()
                        .getSchemaManager().lookupAttributeTypeRegistry( id );
                    AttributeTypeOptions attrOptions = new AttributeTypeOptions( attributeType, options );
                  
                    returningAttributes.add( attrOptions );
                }
View Full Code Here

        if ( !schemaManager.getAttributeTypeRegistry().contains( compareContext.getOid() ) )
        {
            throw new LdapInvalidAttributeIdentifierException( I18n.err( I18n.ERR_266, compareContext.getOid() ) );
        }

        AttributeType attrType = schemaManager.lookupAttributeTypeRegistry( compareContext.getOid() );
       
        EntryAttribute attr = partition.lookup( compareContext.newLookupContext(
            compareContext.getDn() ) ).get( attrType.getName() );

        // complain if the attribute being compared does not exist in the entry
        if ( attr == null )
        {
            throw new LdapNoSuchAttributeException();
        }

        // see first if simple match without normalization succeeds
        if ( attr.contains( (Value<?>)compareContext.getValue()  ) )
        {
            return true;
        }

        // now must apply normalization to all values (attr and in request) to compare

        /*
         * Get ahold of the normalizer for the attribute and normalize the request
         * assertion value for comparisons with normalized attribute values.  Loop
         * through all values looking for a match.
         */
        Normalizer normalizer = attrType.getEquality().getNormalizer();
        Value<?> reqVal = normalizer.normalize( compareContext.getValue() );

        for ( Value<?> value:attr )
        {
            Value<?> attrValObj = normalizer.normalize( value );
View Full Code Here

       
        ServerEntry rootDSE = getRootDSE( new GetRootDSEOperationContext( searchOperationContext.getSession() ) );
       
        for ( EntryAttribute attribute:rootDSE )
        {
            AttributeType type = schemaManager.lookupAttributeTypeRegistry( attribute.getUpId() );
           
            if ( realIds.contains( type.getOid() ) )
            {
                serverEntry.put( attribute );
            }
            else if ( allUserAttributes && ( type.getUsage() == UsageEnum.USER_APPLICATIONS ) )
            {
                serverEntry.put( attribute );
            }
            else if ( allOperationalAttributes && ( type.getUsage() != UsageEnum.USER_APPLICATIONS ) )
            {
                serverEntry.put( attribute );
            }
        }
View Full Code Here

     *
     * @return An instance of a AttributesImpl() object
     */
    public static Attribute toBasicAttribute( ServerAttribute entryAttribute )
    {
        AttributeType attributeType = entryAttribute.getAttributeType();
       
        Attribute attribute = new BasicAttribute( attributeType.getName() );
       
        for ( Value<?> value: entryAttribute )
        {
            attribute.add( value.get() );
        }
View Full Code Here

                    String attributeId = attr.getID();
                    String id = SchemaUtils.stripOptions( attributeId );
                    Set<String> options = SchemaUtils.getOptions( attributeId );
                    // TODO : handle options.
                    AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( id );
                    ServerAttribute serverAttribute = ServerEntryUtils.toServerAttribute( attr, attributeType );
                   
                    if ( serverAttribute != null )
                    {
                        entry.put( serverAttribute );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.schema.AttributeType

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.