blob: 74d22c443f8917ffce36eaceedfd509c6baa3567 [file] [log] [blame]
#*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*#
package $package;
import java.util.ArrayList;
import javax.naming.NamingException;
import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
import org.apache.directory.server.schema.registries.*;
#if ( $package != "org.apache.directory.server.schema.bootstrap" )
import org.apache.directory.server.schema.bootstrap.*;
#end
#**
* A producer of schema objectClass definations for the $schema schema. This
* code has been automatically generated using schema files in the OpenLDAP
* format along with the directory plugin for maven. This has been done
* to facilitate OpenLDAP schema interoperability.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*#
public class $classname extends AbstractBootstrapProducer
{
public $classname()
{
super( ProducerTypeEnum.OBJECT_CLASS_PRODUCER );
}
## ------------------------------------------------------------------------
## BootstrapProducer Methods
## ------------------------------------------------------------------------
#**
* @see BootstrapProducer#produce(Registries, ProducerCallback)
*#
public void produce( Registries registries, ProducerCallback cb )
throws NamingException
{
ArrayList<String> array = new ArrayList<String>();
BootstrapObjectClass objectClass;
#foreach ( $objectClass in $objectClasses )
// --------------------------------------------------------------------
// ObjectClass $objectClass.getOid() $!objectClass.getName()
// --------------------------------------------------------------------
objectClass = newObjectClass( "$objectClass.getOid()", registries );
objectClass.setObsolete( $objectClass.isObsolete() );
#if ( $objectClass.getDescription() )
#set( $desc = $objectClass.getDescription().replaceAll("\"", "\\\"") )
objectClass.setDescription( "$desc" );
#end
// set the objectclass type
#if ( $objectClass.getClassType().getValue() == 0 )
objectClass.setType( ObjectClassTypeEnum.ABSTRACT );
#elseif ( $objectClass.getClassType().getValue() == 1 )
objectClass.setType( ObjectClassTypeEnum.AUXILIARY );
#elseif ( $objectClass.getClassType().getValue() == 2 )
objectClass.setType( ObjectClassTypeEnum.STRUCTURAL );
#end
// set superior objectClasses
#if ( $objectClass.getSuperiors() )
array.clear();
#foreach ( $id in $objectClass.getSuperiors() ) array.add( "$id" );
#end
objectClass.setSuperClassIds( array.toArray( EMPTY ) );
#else
objectClass.setSuperClassIds( EMPTY );
#end
// set must list
#if ( $objectClass.getMust() )
array.clear();
#foreach ( $id in $objectClass.getMust() ) array.add( "$id" );
#end
objectClass.setMustListIds( array.toArray( EMPTY ) );
#else
objectClass.setMustListIds( EMPTY );
#end
// set may list
#if ( $objectClass.getMay() )
array.clear();
#foreach ( $id in $objectClass.getMay() ) array.add( "$id" );
#end
objectClass.setMayListIds( array.toArray( EMPTY ) );
#else
objectClass.setMayListIds( EMPTY );
#end
// set names
#if ( $objectClass.getNames() )
array.clear();
#foreach ( $id in $objectClass.getNames() ) array.add( "$id" );
#end
objectClass.setNames( array.toArray( EMPTY ) );
#else
objectClass.setNames( EMPTY );
#end
cb.schemaObjectProduced( this, "$objectClass.getOid()", objectClass );
#end }
}