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/BrowseSchemaPanel.java    |    4 -
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MatchingRulePanel.java    |   37 ------------
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java          |   44 --------------
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java |   40 ++-----------
 4 files changed, 8 insertions(+), 117 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java
index 5dce5a9..bcba553 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java
@@ -1501,10 +1501,6 @@
       {
         return mustAdd(f, matchingRule.getOID(), matchingRule.getNameOrOID());
       }
-      else if (TYPE.equals(filterAttribute.getSelectedItem()))
-      {
-        return mustAddType(f, MatchingRulePanel.getTypeValue(matchingRule));
-      }
       else
       {
         return false;
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);
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MatchingRulePanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MatchingRulePanel.java
index 1a899d1..6dc84b1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MatchingRulePanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MatchingRulePanel.java
@@ -64,7 +64,6 @@
   private JLabel oid = Utilities.createDefaultLabel();
   private JLabel description = Utilities.createDefaultLabel();
   private JLabel syntax = Utilities.createDefaultLabel();
-  private JLabel type = Utilities.createDefaultLabel();
   private JList usedByAttributes = new JList(new DefaultListModel());
 
   /**
@@ -124,10 +123,9 @@
         INFO_CTRL_PANEL_MATCHING_RULE_NAME.get(),
         INFO_CTRL_PANEL_MATCHING_RULE_OID.get(),
         INFO_CTRL_PANEL_MATCHING_RULE_DESCRIPTION.get(),
-        INFO_CTRL_PANEL_MATCHING_RULE_TYPE.get(),
         INFO_CTRL_PANEL_MATCHING_RULE_SYNTAX.get()
         };
-    JLabel[] values = {name, oid, description, type, syntax};
+    JLabel[] values = {name, oid, description, syntax};
     gbc.gridy ++;
     gbc.gridwidth = 1;
     gbc.anchor = GridBagConstraints.WEST;
@@ -232,8 +230,6 @@
     }
     description.setText(n);
 
-    type.setText(getTypeValue(matchingRule).toString());
-
     Comparator<String> lowerCaseComparator = new LowerCaseComparator();
     TreeSet<String> attributes = new TreeSet<>(lowerCaseComparator);
     for (AttributeType attr : schema.getAttributeTypes().values())
@@ -254,37 +250,6 @@
     }
   }
 
-  /**
-   * Returns the message for the type of the provided matching rule.
-   * @param matchingRule the matching rule.
-   * @return the message for the type of the provided matching rule.
-   */
-  static LocalizableMessage getTypeValue(MatchingRule matchingRule)
-  {
-    LocalizableMessage text;
-    if (Utilities.isEqualityMatchingRule(matchingRule))
-    {
-      text = INFO_CTRL_PANEL_INDEX_EQUALITY.get();
-    }
-    else if (Utilities.isOrderingMatchingRule(matchingRule))
-    {
-      text = INFO_CTRL_PANEL_INDEX_ORDERING.get();
-    }
-    else if (Utilities.isSubstringMatchingRule(matchingRule))
-    {
-      text = INFO_CTRL_PANEL_INDEX_SUBSTRING.get();
-    }
-    else if (Utilities.isApproximateMatchingRule(matchingRule))
-    {
-      text = INFO_CTRL_PANEL_INDEX_APPROXIMATE.get();
-    }
-    else
-    {
-      text = NOT_APPLICABLE;
-    }
-    return text;
-  }
-
   private void usedBySelected()
   {
     String o = (String)usedByAttributes.getSelectedValue();
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java
index a1f98a1..b7e67c7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java
@@ -2715,50 +2715,6 @@
   }
 
   /**
-   * Indicates if the provided matching rule is an equality matching rule.
-   *
-   * @param matchingRule
-   *            The matching rule.
-   * @return {@code true} if this matching rule is an equality mathing rule.
-   */
-  public static boolean isEqualityMatchingRule(MatchingRule matchingRule) {
-    return false;
-  }
-
-  /**
-   * Indicates if the provided matching rule is an approximate matching rule.
-   *
-   * @param matchingRule
-   *            The matching rule.
-   * @return {@code true} if this matching rule is an approximate mathing rule.
-   */
-  public static boolean isApproximateMatchingRule(MatchingRule matchingRule) {
-    return false;
-  }
-
-  /**
-   * Indicates if the provided matching rule is a substring matching rule.
-   *
-   * @param matchingRule
-   *            The matching rule.
-   * @return {@code true} if this matching rule is a substring mathing rule.
-   */
-  public static boolean isSubstringMatchingRule(MatchingRule matchingRule) {
-    return false;
-  }
-
-  /**
-   * Indicates if the provided matching rule is an ordering matching rule.
-   *
-   * @param matchingRule
-   *            The matching rule.
-   * @return {@code true} if this matching rule is an ordering mathing rule.
-   */
-  public static boolean isOrderingMatchingRule(MatchingRule matchingRule) {
-    return false;
-  }
-
-  /**
    * Computes the possible comparison results for monitoring information.
    *
    * @param monitor1

--
Gitblit v1.10.0