From 12f788c17b8c281179f0819352f02b612b0219e2 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Mon, 02 Feb 2009 23:37:54 +0000
Subject: [PATCH] Fix issue 3734 - Make network group policies extensible.

---
 opendj-sdk/opends/src/server/org/opends/server/admin/client/ldap/LDAPManagedObject.java |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/admin/client/ldap/LDAPManagedObject.java b/opendj-sdk/opends/src/server/org/opends/server/admin/client/ldap/LDAPManagedObject.java
index 30c1c43..70a46b1 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/admin/client/ldap/LDAPManagedObject.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/admin/client/ldap/LDAPManagedObject.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2007-2008 Sun Microsystems, Inc.
+ *      Copyright 2007-2009 Sun Microsystems, Inc.
  */
 
 package org.opends.server.admin.client.ldap;
@@ -54,6 +54,7 @@
 import org.opends.server.admin.PropertyValueVisitor;
 import org.opends.server.admin.Reference;
 import org.opends.server.admin.RelationDefinition;
+import org.opends.server.admin.SetRelationDefinition;
 import org.opends.server.admin.UnknownPropertyDefinitionException;
 import org.opends.server.admin.client.AuthorizationException;
 import org.opends.server.admin.client.CommunicationException;
@@ -174,16 +175,23 @@
     }
 
     // We may need to create the parent "relation" entry if this is a
-    // child of an instantiable relation.
+    // child of an instantiable or set relation.
     RelationDefinition<?, ?> r = path.getRelationDefinition();
-    if (r instanceof InstantiableRelationDefinition) {
-      InstantiableRelationDefinition<?, ?> ir =
-        (InstantiableRelationDefinition<?, ?>) r;
+    if (r instanceof InstantiableRelationDefinition
+        || r instanceof SetRelationDefinition) {
 
       // TODO: this implementation does not handle relations which
       // comprise of more than one RDN arc (this will probably never
       // be required anyway).
-      LdapName dn = LDAPNameBuilder.create(parent, ir, driver.getLDAPProfile());
+      LdapName dn;
+      if (r instanceof InstantiableRelationDefinition) {
+        dn = LDAPNameBuilder.create(parent,
+            (InstantiableRelationDefinition) r, driver.getLDAPProfile());
+      } else {
+        dn = LDAPNameBuilder.create(parent,
+            (SetRelationDefinition) r, driver.getLDAPProfile());
+      }
+
       if (!driver.entryExists(dn)) {
         // We need to create the entry.
         Attributes attributes = new BasicAttributes();
@@ -191,7 +199,7 @@
         // Create the branch's object class attribute.
         Attribute oc = new BasicAttribute("objectClass");
         for (String objectClass : driver.getLDAPProfile()
-            .getInstantiableRelationObjectClasses(ir)) {
+            .getRelationObjectClasses(r)) {
           oc.add(objectClass);
         }
         attributes.put(oc);

--
Gitblit v1.10.0