entryColAttr.add( subentryColAttr.get( ii ) );
entryColAttr.add( subentryColAttr.get( jj ) );
    private void addCollectiveAttributes( Attributes entry ) throws NamingException    {        Attribute subentries = entry.get( SubentryService.COLLECTIVE_ATTRIBUTE_SUBENTRIES );        if ( subentries == null )        {            return;        }        /*         * Before we proceed we need to lookup the exclusions within the         * entry and build a set of exclusions for rapid lookup.  We use         * OID values in the exclusions set instead of regular names that         * may have case variance.         */        Attribute collectiveExclusions = entry.get( "collectiveExclusions" );        Set exclusions = null;        if ( collectiveExclusions != null )        {            if ( collectiveExclusions.contains( "2.5.18.0" ) ||                 collectiveExclusions.contains( "excludeAllCollectiveAttributes" ) )            {                return;            }            exclusions = new HashSet();            for ( int ii = 0; ii < collectiveExclusions.size(); ii++ )            {                AttributeType attrType = registry.lookup( ( String ) collectiveExclusions.get( ii ) );                exclusions.add( attrType.getOid() );            }        }        /*         * For each collective subentry referenced by the entry we lookup the         * attributes of the subentry and copy collective attributes from the         * subentry into the entry.         */        for ( int ii = 0; ii < subentries.size(); ii++ )        {            String subentryDnStr = ( String ) subentries.get( ii );            Name subentryDn = new LdapName( subentryDnStr );            Attributes subentry = nexus.lookup( subentryDn );            NamingEnumeration attrIds = subentry.getIDs();            while ( attrIds.hasMore() )            {                String attrId = ( String ) attrIds.next();                AttributeType attrType = registry.lookup( attrId );                // skip the addition of this collective attribute if it is excluded                if ( exclusions.contains( attrType.getOid() ) )                {                    continue;                }                /*                 * If the attribute type of the subentry attribute is collective                 * then we need to add all the values of the collective attribute                 * to the entry making sure we do not overwrite values already                 * existing for the collective attribute in case multiple                 * subentries add the same collective attributes to this entry.                 */                if ( attrType.isCollective() )                {                    Attribute subentryColAttr = subentry.get( attrId );                    Attribute entryColAttr = entry.get( attrId );                    // if entry does not have attribute for colattr then create it                    if ( entryColAttr == null )                    {                        entryColAttr = new LockableAttributeImpl( attrId );                        entry.put( entryColAttr );                    }                    // add all the collective attribute values in the subentry to entry                    for ( int jj = 0; jj < subentryColAttr.size(); jj++ )                    {                        entryColAttr.add( subentryColAttr.get( ii ) );                    }                }            }        }    }