From 85811b64468e9b7a876bd352a0299b904a53a3fb Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Mon, 31 May 2010 12:16:23 +0000
Subject: [PATCH] Fix for Issue #615. Add support for multiple object-class inheritance. Support added in the schema, core server and tools including Control-Panel
---
opends/src/guitools/org/opends/guitools/controlpanel/ui/StandardObjectClassPanel.java | 95 ++++++++++++++++++++++++++++++++++++-----------
1 files changed, 72 insertions(+), 23 deletions(-)
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/StandardObjectClassPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/StandardObjectClassPanel.java
index 4836d0a..1f7c1e5 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/StandardObjectClassPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/StandardObjectClassPanel.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008-2009 Sun Microsystems, Inc.
+ * Copyright 2008-2010 Sun Microsystems, Inc.
*/
package org.opends.guitools.controlpanel.ui;
@@ -68,6 +68,9 @@
{
private static final long serialVersionUID = 5561268287795223026L;
private TitlePanel titlePanel = new TitlePanel(Message.EMPTY, Message.EMPTY);
+
+ private JLabel lParent;
+
private JLabel name = Utilities.createDefaultLabel();
private JLabel parent = Utilities.createDefaultLabel();
private JLabel oid = Utilities.createDefaultLabel();
@@ -182,6 +185,10 @@
gbc.insets.left = 0;
gbc.gridx = 0;
JLabel l = Utilities.createPrimaryLabel(labels[i]);
+ if (i == 1)
+ {
+ lParent = l;
+ }
c.add(l, gbc);
gbc.insets.left = 10;
gbc.gridx = 1;
@@ -309,20 +316,7 @@
}
titlePanel.setDetails(Message.raw(n));
name.setText(n);
- ObjectClass superior = oc.getSuperiorClass();
- if (superior == null)
- {
- n = null;
- }
- else
- {
- n = superior.getPrimaryName();
- }
- if (n == null)
- {
- n = NOT_APPLICABLE.toString();
- }
- parent.setText(n);
+ parent.setText(getSuperiorText(oc));
oid.setText(oc.getOID());
origin.setText(getOrigin(oc).toString());
n = oc.getDescription();
@@ -364,13 +358,31 @@
{
requiredAttrs.add(attr.getNameOrOID());
}
- ObjectClass parent = oc.getSuperiorClass();
- if (parent != null)
+ Set<ObjectClass> parents = oc.getSuperiorClasses();
+ if (parents != null)
{
- for (AttributeType attr : parent.getRequiredAttributeChain())
+ if (parents.size() > 1)
{
- inheritedAttrs.add(attr.getNameOrOID());
+ lParent.setText(
+ INFO_CTRL_PANEL_OBJECTCLASS_PARENTS_LABEL.get().toString());
}
+ else
+ {
+ lParent.setText(
+ INFO_CTRL_PANEL_OBJECTCLASS_PARENT_LABEL.get().toString());
+ }
+ for (ObjectClass parent : parents)
+ {
+ for (AttributeType attr : parent.getRequiredAttributeChain())
+ {
+ inheritedAttrs.add(attr.getNameOrOID());
+ }
+ }
+ }
+ else
+ {
+ lParent.setText(
+ INFO_CTRL_PANEL_OBJECTCLASS_PARENT_LABEL.get().toString());
}
DefaultListModel model = (DefaultListModel)requiredAttributes.getModel();
@@ -396,12 +408,14 @@
{
optionalAttrs.add(attr.getNameOrOID());
}
- parent = oc.getSuperiorClass();
- if (parent != null)
+ if (parents != null)
{
- for (AttributeType attr : parent.getOptionalAttributeChain())
+ for (ObjectClass parent : parents)
{
- inheritedAttrs.add(attr.getNameOrOID());
+ for (AttributeType attr : parent.getOptionalAttributeChain())
+ {
+ inheritedAttrs.add(attr.getNameOrOID());
+ }
}
}
model = (DefaultListModel)optionalAttributes.getModel();
@@ -422,6 +436,41 @@
}
}
+ private String getSuperiorText(ObjectClass oc)
+ {
+ String n;
+ Set<ObjectClass> superiors = oc.getSuperiorClasses();
+ if (superiors == null)
+ {
+ n = null;
+ }
+ else
+ {
+ if (superiors.isEmpty())
+ {
+ n = NOT_APPLICABLE.toString();
+ }
+ else if (superiors.size() == 1)
+ {
+ n = superiors.iterator().next().getPrimaryName();
+ }
+ else
+ {
+ SortedSet<String> names = new TreeSet<String>();
+ for (ObjectClass superior : superiors)
+ {
+ names.add(superior.getPrimaryName());
+ }
+ n = Utilities.getStringFromCollection(names, ", ");
+ }
+ }
+ if (n == null)
+ {
+ n = NOT_APPLICABLE.toString();
+ }
+ return n;
+ }
+
/**
* Returns the message describing the object class type (structural, obsolete,
* etc.) of a given object class.
--
Gitblit v1.10.0