From 5203374a1e5dc294088749071cf5350d2f82787d Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Thu, 20 Mar 2014 10:06:11 +0000
Subject: [PATCH] Checkpoint commit for OPENDJ-1308 Migrate schema support Code Review : CR-3230

---
 opendj3-server-dev/src/server/org/opends/server/schema/AbstractOrderingMatchingRule.java |   51 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/AbstractOrderingMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/schema/AbstractOrderingMatchingRule.java
index fdf3ded..7ff209b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/AbstractOrderingMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/AbstractOrderingMatchingRule.java
@@ -24,6 +24,9 @@
  */
 package org.opends.server.schema;
 
+
+import java.util.Comparator;
+
 import org.forgerock.opendj.ldap.*;
 import org.opends.server.api.AbstractMatchingRule;
 import org.opends.server.api.NotImplementedAssertion;
@@ -63,10 +66,54 @@
       @Override
       public ConditionResult matches(ByteSequence attributeValue)
       {
-        return ConditionResult.valueOf(
-            compareValues(assertionValue, attributeValue) < 0);
+        return ConditionResult.valueOf(compareValues(attributeValue, assertionValue) < 0);
       }
     };
   }
 
+  /** {@inheritDoc} */
+  @Override
+  public Assertion getGreaterOrEqualAssertion(ByteSequence value) throws DecodeException
+  {
+    final ByteString normAssertion = normalizeAssertionValue(value);
+    return new NotImplementedAssertion()
+    {
+      @Override
+      public ConditionResult matches(final ByteSequence normalizedAttributeValue)
+      {
+        return ConditionResult.valueOf(compareValues(normalizedAttributeValue, normAssertion) >= 0);
+      }
+    };
+  }
+
+  /** {@inheritDoc} */
+  @Override
+  public Assertion getLessOrEqualAssertion(ByteSequence value) throws DecodeException
+  {
+    final ByteString normAssertion = normalizeAssertionValue(value);
+    return new NotImplementedAssertion()
+    {
+      @Override
+      public ConditionResult matches(final ByteSequence normalizedAttributeValue)
+      {
+        return ConditionResult.valueOf(compareValues(normalizedAttributeValue, normAssertion) <= 0);
+      }
+    };
+  }
+
+  /** {@inheritDoc} */
+  @Override
+  public Comparator<ByteSequence> comparator()
+  {
+    return new Comparator<ByteSequence>()
+    {
+      @Override
+      public int compare(ByteSequence o1, ByteSequence o2)
+      {
+        return AbstractOrderingMatchingRule.this.compare(o1.toByteArray(), o2.toByteArray());
+      }
+    };
+  }
+
+
 }

--
Gitblit v1.10.0