if ( parentElement instanceof ObjectClassImpl )
{
ObjectClassImpl oc = ( ObjectClassImpl ) parentElement;
ObjectClassWrapper ocw = new ObjectClassWrapper( oc, null );
children = new ArrayList<TreeNode>();
children.add( ocw );
}
else if ( parentElement instanceof AttributeTypeImpl )
{
AttributeTypeImpl at = ( AttributeTypeImpl ) parentElement;
AttributeTypeWrapper atw = new AttributeTypeWrapper( at, null );
children = new ArrayList<TreeNode>();
children.add( atw );
}
else if ( parentElement instanceof ObjectClassWrapper )
{
ObjectClassWrapper ocw = ( ObjectClassWrapper ) parentElement;
ObjectClassImpl oc = ocw.getObjectClass();
if ( mode == PluginConstants.PREFS_HIERARCHY_VIEW_MODE_SUPERTYPE )
{
String[] superiors = oc.getSuperClassesNames();
for ( String superior : superiors )
{
if ( superior != null || "".equals( superior ) ) //$NON-NLS-1$
{
ObjectClassImpl supOC = schemaHandler.getObjectClass( superior );
if ( supOC != null )
{
ObjectClassWrapper supOCW = new ObjectClassWrapper( supOC, ocw );
ocw.addChild( supOCW );
}
}
}
}
else if ( mode == PluginConstants.PREFS_HIERARCHY_VIEW_MODE_SUBTYPE )
{
for ( ObjectClassImpl objectClass : objectClasses )
{
String[] superiors = objectClass.getSuperClassesNames();
for ( String superior : superiors )
{
if ( superior != null || "".equals( superior ) ) //$NON-NLS-1$
{
ObjectClassImpl supOC = schemaHandler.getObjectClass( superior );
if ( supOC != null && oc.equals( supOC ) )
{
ObjectClassWrapper supOCW = new ObjectClassWrapper( objectClass, ocw );
ocw.addChild( supOCW );
}
}
}
}