From 00786b8f6e90c1a848c9c09d8b82e73a56042a0a Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Thu, 19 Jul 2007 14:54:30 +0000
Subject: [PATCH] Fix issues 1943 (unable to create je-index), 1996 (exception when creating components with empty names), and 1998 (exception when creating components with blank names).
---
opends/src/server/org/opends/server/admin/InstantiableRelationDefinition.java | 57 ++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 42 insertions(+), 15 deletions(-)
diff --git a/opends/src/server/org/opends/server/admin/InstantiableRelationDefinition.java b/opends/src/server/org/opends/server/admin/InstantiableRelationDefinition.java
index b5898bf..2035206 100644
--- a/opends/src/server/org/opends/server/admin/InstantiableRelationDefinition.java
+++ b/opends/src/server/org/opends/server/admin/InstantiableRelationDefinition.java
@@ -27,6 +27,8 @@
package org.opends.server.admin;
+
+
import java.util.Locale;
@@ -46,6 +48,9 @@
<C extends ConfigurationClient, S extends Configuration>
extends RelationDefinition<C, S> {
+ // The optional naming property definition.
+ private final PropertyDefinition<?> namingPropertyDefinition;
+
// The plural name of the relation.
private final String pluralName;
@@ -62,12 +67,43 @@
* The plural name of the relation.
* @param cd
* The child managed object definition.
+ * @param namingPropertyDefinition
+ * The property of the child managed object definition
+ * which should be used for naming, or <code>null</code>
+ * if this relation does not use a property for naming.
*/
public InstantiableRelationDefinition(
AbstractManagedObjectDefinition<?, ?> pd, String name, String pluralName,
- AbstractManagedObjectDefinition<C, S> cd) {
+ AbstractManagedObjectDefinition<C, S> cd,
+ PropertyDefinition<?> namingPropertyDefinition) {
super(pd, name, cd);
this.pluralName = pluralName;
+ this.namingPropertyDefinition = namingPropertyDefinition;
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <R, P> R accept(RelationDefinitionVisitor<R, P> v, P p) {
+ return v.visitInstantiable(this, p);
+ }
+
+
+
+ /**
+ * Get the property of the child managed object definition which
+ * should be used for naming children.
+ *
+ * @return Returns the property of the child managed object
+ * definition which should be used for naming, or
+ * <code>null</code> if this relation does not use a
+ * property for naming.
+ */
+ public final PropertyDefinition<?> getNamingPropertyDefinition() {
+ return namingPropertyDefinition;
}
@@ -106,10 +142,9 @@
* definition in the specified locale.
*/
public final String getUserFriendlyPluralName(Locale locale) {
- String property = "relation." + getName()
- + ".user-friendly-plural-name";
- return ManagedObjectDefinitionI18NResource.getInstance()
- .getMessage(getParentDefinition(), property, locale);
+ String property = "relation." + getName() + ".user-friendly-plural-name";
+ return ManagedObjectDefinitionI18NResource.getInstance().getMessage(
+ getParentDefinition(), property, locale);
}
@@ -125,16 +160,8 @@
builder.append(getParentDefinition().getName());
builder.append(" child=");
builder.append(getChildDefinition().getName());
+ builder.append(" child=");
+ builder.append(getChildDefinition().getName());
builder.append(" minOccurs=0");
}
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public <R, P> R accept(RelationDefinitionVisitor<R, P> v, P p) {
- return v.visitInstantiable(this, p);
- }
}
--
Gitblit v1.10.0