/** * Check the constraints for the Usage field. */ private void checkUsage( List<Throwable> errors, Registries registries ) { // Check that the AT usage is the same that its superior if ( ( superior != null ) && ( usage != superior.getUsage() ) ) { // This is an error String msg = I18n.err( I18n.ERR_04314, getName() ); Throwable error = new LdapProtocolErrorException( msg ); errors.add( error ); LOG.info( msg ); return; } // Now, check that the AttributeType's USAGE does not conflict if ( !isUserModifiable() && ( usage == UsageEnum.USER_APPLICATIONS ) ) { // Cannot have a not user modifiable AT which is not an operational AT String msg = I18n.err( I18n.ERR_04315, getName() ); Throwable error = new LdapProtocolErrorException( msg ); errors.add( error ); LOG.info( msg ); } }
/** * Filters out the operational attributes within a search results attributes. The attributes are directly * modified. * * @param attributes the resultant attributes to filter * @return true always */ private boolean filter( Attributes attributes ) throws NamingException { NamingEnumeration list = attributes.getIDs(); while ( list.hasMore() ) { String attrId = ( String ) list.next(); AttributeType type = null; if ( registry.hasAttributeType( attrId ) ) { type = registry.lookup( attrId ); } if ( type != null && type.getUsage() != UsageEnum.USERAPPLICATIONS ) { // just make sure we do not remove the ref attribute if ( ! type.getOid().equals( refAttrOid.getOid() ) ) { attributes.remove( attrId ); } } } return true; }
buf.append( UsageEnum.render( attributeType.getUsage() ) ); buf.append( '\n' );
if ( !attributeType.isCollective() && ( attributeType.getUsage() == UsageEnum.USERAPPLICATIONS ) )
entry.put( MetaSchemaConstants.M_NO_USER_MODIFICATION_AT, getBoolean( ! attributeType.isUserModifiable() ) ); entry.put( MetaSchemaConstants.M_SINGLE_VALUE_AT, getBoolean( attributeType.isSingleValued() ) ); entry.put( MetaSchemaConstants.M_USAGE_AT, attributeType.getUsage().toString() ); entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() ); entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );