From 4a70043eb843b128d1476fd805d664acaa122932 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Fri, 15 Oct 2010 10:42:29 +0000
Subject: [PATCH] Fix for issue OPENDJ-1. Aci now implements Comparable, so dsconfig can do better control of added and deleted values

---
 opends/src/server/org/opends/server/authorization/dseecompat/Aci.java |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/opends/src/server/org/opends/server/authorization/dseecompat/Aci.java b/opends/src/server/org/opends/server/authorization/dseecompat/Aci.java
index a1acb5c..7e8f2f2 100644
--- a/opends/src/server/org/opends/server/authorization/dseecompat/Aci.java
+++ b/opends/src/server/org/opends/server/authorization/dseecompat/Aci.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2008 Sun Microsystems, Inc.
+ *      Portions Copyright 2010 ForgeRock AS
  */
 
 package org.opends.server.authorization.dseecompat;
@@ -39,7 +40,9 @@
 /**
  * The Aci class represents ACI strings.
  */
-public class Aci  {
+public class Aci
+  implements Comparable<Aci>
+{
 
     /*
      * The body of the ACI is the version, name and permission-bind rule
@@ -597,4 +600,22 @@
           lastWasPeriod = false;
       }
     }
-  }
+
+    /**
+     * Compares this DN with the provided DN based on a natural order.
+     * This order will be first hierarchical (ancestors will come before
+     * descendants) and then alphabetical by attribute name(s) and
+     * value(s).
+     *
+     * @param  dn  The DN against which to compare this DN.
+     *
+     * @return  A negative integer if this DN should come before the
+     *          provided DN, a positive integer if this DN should come
+     *          after the provided DN, or zero if there is no difference
+     *          with regard to ordering.
+     */
+    public int compareTo(Aci aci)
+    {
+      return this.aciString.compareTo(aci.toString());
+    }
+ }

--
Gitblit v1.10.0