From 02d9dccf732357f76a9db0f0e2eef75c0371e7d3 Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Tue, 09 Jun 2015 13:53:24 +0000
Subject: [PATCH] OPENDJ-2111 GUI Removes matching rules type

---
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java |   40 +++++++---------------------------------
 1 files changed, 7 insertions(+), 33 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
index 3c1d768..d560c53 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
@@ -739,50 +739,24 @@
       updateComboBoxModel(newParents,
           ((DefaultComboBoxModel)parent.getModel()));
 
-      ArrayList<MatchingRule> approximateElements = new ArrayList<>();
-      ArrayList<MatchingRule> equalityElements = new ArrayList<>();
-      ArrayList<MatchingRule> orderingElements = new ArrayList<>();
-      ArrayList<MatchingRule> substringElements = new ArrayList<>();
-
-      HashMap<String, MatchingRule> matchingRuleNameMap = new HashMap<>();
+      final List<MatchingRule> availableMatchingRules = new ArrayList<>();
+      final Map<String, MatchingRule> matchingRuleNameMap = new HashMap<>();
       for (String key : schema.getMatchingRules().keySet())
       {
-        MatchingRule rule = schema.getMatchingRule(key);
-        matchingRuleNameMap.put(rule.getNameOrOID(), rule);
+        matchingRuleNameMap.put(schema.getMatchingRule(key).getNameOrOID(), schema.getMatchingRule(key));
       }
 
       orderedKeys.clear();
       orderedKeys.addAll(matchingRuleNameMap.keySet());
       for (String key : orderedKeys)
       {
-        MatchingRule matchingRule = matchingRuleNameMap.get(key);
-        if (Utilities.isApproximateMatchingRule(matchingRule))
-        {
-          approximateElements.add(matchingRule);
-        }
-        else if (Utilities.isEqualityMatchingRule(matchingRule))
-        {
-          equalityElements.add(matchingRule);
-        }
-        else if (Utilities.isOrderingMatchingRule(matchingRule))
-        {
-          orderingElements.add(matchingRule);
-        }
-        else if (Utilities.isSubstringMatchingRule(matchingRule))
-        {
-          substringElements.add(matchingRule);
-        }
+        availableMatchingRules.add(matchingRuleNameMap.get(key));
       }
       JComboBox[] combos = {approximate, equality, ordering, substring};
-      ArrayList<ArrayList<MatchingRule>> ruleNames = new ArrayList<>();
-      ruleNames.add(approximateElements);
-      ruleNames.add(equalityElements);
-      ruleNames.add(orderingElements);
-      ruleNames.add(substringElements);
-      for (int i=0; i<combos.length; i++)
+      for (int i = 0; i < combos.length; i++)
       {
-        DefaultComboBoxModel model = (DefaultComboBoxModel)combos[i].getModel();
-        ArrayList<Object> el = new ArrayList<Object>(ruleNames.get(i));
+        final DefaultComboBoxModel model = (DefaultComboBoxModel)combos[i].getModel();
+        final List<Object> el = new ArrayList<Object>(availableMatchingRules);
         if (model.getSize() == 0)
         {
           el.add(0, NO_MATCHING_RULE);

--
Gitblit v1.10.0