* @return the attributes of the metaSchema entry representing the objectClass
* @throws NamingException if there are any problems
*/
public ServerEntry getAttributes( ObjectClass objectClass, Schema schema, SchemaManager schemaManager ) throws NamingException
{
ServerEntry entry = new DefaultServerEntry( schemaManager );
entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_OBJECT_CLASS_OC );
entry.put( MetaSchemaConstants.M_TYPE_OBJECT_CLASS_AT, objectClass.getType().toString() );
entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
injectCommon( objectClass, entry, schemaManager );
// handle the superior objectClasses
if ( objectClass.getSuperiorOids() != null && objectClass.getSuperiorOids().size() != 0 )
{
EntryAttribute attr = new DefaultServerAttribute( schemaManager.lookupAttributeTypeRegistry( MetaSchemaConstants.M_SUP_OBJECT_CLASS_AT ) );
for ( String superior:objectClass.getSuperiorOids() )
{
attr.add( superior );
}
entry.put( attr );
}
// add the must list
if ( objectClass.getMustAttributeTypeOids() != null && objectClass.getMustAttributeTypeOids().size() != 0 )
{
EntryAttribute attr = new DefaultServerAttribute( schemaManager.lookupAttributeTypeRegistry( MetaSchemaConstants.M_MUST_AT ) );
for ( String mustOid :objectClass.getMustAttributeTypeOids() )
{
attr.add( mustOid );
}
entry.put( attr );
}
// add the may list
if ( objectClass.getMayAttributeTypeOids() != null && objectClass.getMayAttributeTypeOids().size() != 0 )
{
EntryAttribute attr = new DefaultServerAttribute( schemaManager.lookupAttributeTypeRegistry( MetaSchemaConstants.M_MAY_AT ) );
for ( String mayOid :objectClass.getMayAttributeTypeOids() )
{
attr.add( mayOid );
}
entry.put( attr );
}
return entry;
}