mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Gaetan Boismal
09.53.2015 02d9dccf732357f76a9db0f0e2eef75c0371e7d3
OPENDJ-2111 GUI Removes matching rules type

Since matching rule sdk migration, we can not know the matching rule type.
This commit remove control panel code related to matching rule type.

* src/main/java/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java
** Remove type filter for matching rules

* src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
** Duplicate change done in r12433

* src/main/java/org/opends/guitools/controlpanel/ui/MatchingRulePanel.java
** Remove type information in matching rule panel

* src/main/java/org/opends/guitools/controlpanel/util/Utilities.java
** Remove methods to get type of matching rule
4 files modified
125 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java 40 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MatchingRulePanel.java 37 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java 44 ●●●●● patch | view | raw | blame | history
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;
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);
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();
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