/** * Check the constraints for the Collective field. */ private void checkCollective( List<Throwable> errors, Registries registries ) { if ( superior != null ) { if ( superior.isCollective() ) { // An AttributeType will be collective if its superior is collective this.isCollective = true; } } if ( isCollective() && ( usage != UsageEnum.USER_APPLICATIONS ) ) { // An AttributeType which is collective must be a USER attributeType String msg = I18n.err( I18n.ERR_04316, getName() ); Throwable error = new LdapProtocolErrorException( msg ); errors.add( error ); LOG.info( msg ); } }
/** * Check if an entry contains some collective attributes or not * * @param entry The entry to be checked * @return <code>true</code> if the entry contains a collective attribute, <code>false</code> otherwise * @throws NamingException If something went wrong */ private boolean containsAnyCollectiveAttributes( Attributes entry ) throws NamingException { NamingEnumeration allIDs = entry.getIDs(); while ( allIDs.hasMoreElements() ) { String attrTypeStr = ( String ) allIDs.nextElement(); AttributeType attrType = attrTypeRegistry.lookup( attrTypeStr ); if ( attrType.isCollective() ) { return true; } } return false; } }
private boolean addsAnyCollectiveAttributes( ModificationItemImpl[] mods ) throws NamingException { for ( int i = 0; i < mods.length; i++ ) { Attribute attr = mods[i].getAttribute(); String attrID = attr.getID(); AttributeType attrType = attrTypeRegistry.lookup( attrID ); int modOp = mods[i].getModificationOp(); if ( ( modOp == DirContext.ADD_ATTRIBUTE || modOp == DirContext.REPLACE_ATTRIBUTE ) && attrType.isCollective() ) { return true; } } return false; }
if ( attributeType.isCollective() )
AttributeType attrType = attrTypeRegistry.lookup( attrId ); if ( !attrType.isCollective() )
if ( !attributeType.isCollective() && ( attributeType.getUsage() == UsageEnum.USERAPPLICATIONS ) )
if ( at0.isCollective() != at1.isCollective() )
entry.put( MetaSchemaConstants.M_COLLECTIVE_AT, getBoolean( attributeType.isCollective() ) ); entry.put( MetaSchemaConstants.M_NO_USER_MODIFICATION_AT, getBoolean( ! attributeType.isUserModifiable() ) ); entry.put( MetaSchemaConstants.M_SINGLE_VALUE_AT, getBoolean( attributeType.isSingleValued() ) );
if ( attributeType.isCollective() && ( attributeType.getUsage() != UsageEnum.USER_APPLICATIONS ) )