From 4cd06b3633e335f68d6cad0ad2483246076775b4 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 07 Apr 2015 15:43:34 +0000
Subject: [PATCH] Code simplification in AttributeIndex
---
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java | 86 +++++++++---------------------------------
1 files changed, 19 insertions(+), 67 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java
index a151ad9..ba40a2f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java
@@ -109,7 +109,7 @@
}
/**
- * This class implements an attribute indexer for matching rules in JE Backend.
+ * This class implements an attribute indexer for matching rules in a Backend.
*/
final class MatchingRuleIndex extends DefaultIndex
{
@@ -999,72 +999,6 @@
}
/**
- * Return the equality index.
- *
- * @return The equality index.
- */
- MatchingRuleIndex getEqualityIndex()
- {
- return getIndexById(IndexType.EQUALITY.toString());
- }
-
- /**
- * Return the approximate index.
- *
- * @return The approximate index.
- */
- MatchingRuleIndex getApproximateIndex()
- {
- return getIndexById(IndexType.APPROXIMATE.toString());
- }
-
- /**
- * Return the ordering index.
- *
- * @return The ordering index.
- */
- MatchingRuleIndex getOrderingIndex()
- {
- return getIndexById(IndexType.ORDERING.toString());
- }
-
- /**
- * Return the substring index.
- *
- * @return The substring index.
- */
- MatchingRuleIndex getSubstringIndex()
- {
- return getIndexById(IndexType.SUBSTRING.toString());
- }
-
- /**
- * Return the presence index.
- *
- * @return The presence index.
- */
- MatchingRuleIndex getPresenceIndex()
- {
- return getIndexById(IndexType.PRESENCE.toString());
- }
-
- /**
- * Return the index identified by the provided identifier.
- * <p>
- * Common index identifiers are "presence", "equality", "substring",
- * "ordering" and "approximate".
- *
- * @param indexId
- * the identifier of the requested index
- * @return The index identified by the provided identifier, or null if no such
- * index exists
- */
- MatchingRuleIndex getIndexById(String indexId)
- {
- return nameToIndexes.get(indexId);
- }
-
- /**
* Return the mapping of extensible index types and indexes.
*
* @return The map containing entries (extensible index type, list of indexes)
@@ -1119,6 +1053,24 @@
return new LinkedHashSet<Index>(nameToIndexes.values());
}
+ Map<String, MatchingRuleIndex> getNameToIndexes()
+ {
+ return nameToIndexes;
+ }
+
+ Map<String, MatchingRuleIndex> getDefaultNameToIndexes()
+ {
+ final Map<String, MatchingRuleIndex> result = new HashMap<String, MatchingRuleIndex>(nameToIndexes);
+ for (Iterator<String> it = result.keySet().iterator(); it.hasNext();)
+ {
+ if (!isDefaultIndex(it.next()))
+ {
+ it.remove();
+ }
+ }
+ return result;
+ }
+
/**
* Retrieve the entry IDs that might match an extensible filter.
*
--
Gitblit v1.10.0