help/en/help/configtab_schema3.html | 12
help/en/help/configtab_schema4.html | 12
src/com/netscape/admin/dirserv/dirserv.properties | 6
src/com/netscape/admin/dirserv/panel/AttributeDialog.java | 327 +++++++++-
src/com/netscape/admin/dirserv/panel/SchemaAttributesPanel.java | 48 +
5 files changed, 371 insertions(+), 34 deletions(-)
New commits:
commit c95594f53800cf51736d9d0a95c51213e473ddee
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Thu Mar 10 13:16:31 2011 -0800
Bug 616707 - Add attribute matching rule UI to Console
This patch adds support for viewing and modifying the matching rules
used by an attribute to the Console UI. When one creates or edits an
attribute in the schema, 3 new combo boxes can be used to set the
equality, ordering, and substring matching rules to be used by the
attribute. The Console will only allow the matching rules whose
syntax matches that of the attribute to be selected.
diff --git a/help/en/help/configtab_schema3.html b/help/en/help/configtab_schema3.html
index 598d38a..eb309e6 100644
--- a/help/en/help/configtab_schema3.html
+++ b/help/en/help/configtab_schema3.html
@@ -26,6 +26,18 @@ Syntax—Displays the syntax of the attribute. For example, the
syntax type o
<li>
Multi—Defines whether the attribute is multi-valued. If the checkbox in this
column is selected, the attribute can be multi-valued. The directory allows more than one
instance of a multi-valued attribute per entry.
</li>
+
+<li>
+Equality MR—Displays the equality matching rule used by the attribute.
+</li>
+
+<li>
+Ordering MR—Displays the ordering matching rule used by the attribute.
+</li>
+
+<li>
+Substring MR—Displays the substring matching rule used by the attribute.
+</li>
</ul>
<p class="text">
diff --git a/help/en/help/configtab_schema4.html b/help/en/help/configtab_schema4.html
index 0545906..f8bb4c2 100644
--- a/help/en/help/configtab_schema4.html
+++ b/help/en/help/configtab_schema4.html
@@ -27,5 +27,17 @@ This dialog box allows you to create new attributes or edit existing
ones.
</p>
<p class="text">
+<b>Equality matching rule (optional). </b>Select an equality matching rule to
be used by the attribute. Select <code>none</code> if you do not want to
specify a matching rule. The selected matching rule must be allowed to be used with the
selected syntax in order to enable the OK button.
+</p>
+
+<p class="text">
+<b>Ordering matching rule (optional). </b>Select an ordering matching rule to
be used by the attribute. Select <code>none</code> if you do not want to
specify a matching rule. The selected matching rule must be allowed to be used with the
selected syntax in order to enable the OK button.
+</p>
+
+<p class="text">
+<b>Substring matching rule (optional). </b>Select a substring matching rule
to be used by the attribute. Select <code>none</code> if you do not want to
specify a matching rule. The selected matching rule must be allowed to be used with the
selected syntax in order to enable the OK button.
+</p>
+
+<p class="text">
<b>Multi-valued. </b>When selected, this option specifies that the attribute
you are creating is multi-valued, meaning an entry may contain more than one instance of
this attribute.
</p>
diff --git a/src/com/netscape/admin/dirserv/dirserv.properties
b/src/com/netscape/admin/dirserv/dirserv.properties
index 90b56bd..d5915b2 100644
--- a/src/com/netscape/admin/dirserv/dirserv.properties
+++ b/src/com/netscape/admin/dirserv/dirserv.properties
@@ -752,6 +752,9 @@ schemaattributes-newsyntax-5=Distinguished Name
schemaattributes-newsyntax-6=Integer
schemaattributes-newsyntax-default=Case Ignore String
schemaattributes-newsyntax-unknown=Unknown
+schemaattributes-newmrequality-label=Equality matching rule (optional):
+schemaattributes-newmrordering-label=Ordering matching rule (optional):
+schemaattributes-newmrsubstring-label=Substring matching rule (optional):
schemaattributes-current-title=Current Attributes
schemaattributes-standard-label=Standard Attributes (Read-Only):
schemaattributes-userdefined-label=User Defined Attributes:
@@ -759,6 +762,9 @@ schemaattributes-namecolumn-label=Name
schemaattributes-oidcolumn-label=OID
schemaattributes-syntaxcolumn-label=Syntax
schemaattributes-multicolumn-label=Multi
+schemaattributes-mrequality-label=Equality MR
+schemaattributes-mrordering-label= Ordering MR
+schemaattributes-mrsubstring-label= Substring MR
schemaattributes-clear-label=Clear
schemaattributes-create-label=Create...
schemaattributes-create-mnemonic=A
diff --git a/src/com/netscape/admin/dirserv/panel/AttributeDialog.java
b/src/com/netscape/admin/dirserv/panel/AttributeDialog.java
index e0d89eb..b59de38 100644
--- a/src/com/netscape/admin/dirserv/panel/AttributeDialog.java
+++ b/src/com/netscape/admin/dirserv/panel/AttributeDialog.java
@@ -187,12 +187,30 @@ class AttributePanel extends BlankPanel {
break;
}
}
+
String superior = null;
LDAPAttributeSchema las =
new LDAPAttributeSchema(name, oid, desc,
syntaxOID,
!multi, superior, aliases);
las.setQualifier("X-ORIGIN", "user defined");
+
+ // Set the matching rules if any were selected
+ String selectedEqMatchingRule = (String)_cmbAttributeMrEquality.getSelectedItem();
+ if ((selectedEqMatchingRule != null) &&
(!selectedEqMatchingRule.equalsIgnoreCase("none"))) {
+ las.setQualifier("EQUALITY", selectedEqMatchingRule);
+ }
+
+ String selectedOrdMatchingRule = (String)_cmbAttributeMrOrdering.getSelectedItem();
+ if ((selectedOrdMatchingRule != null) &&
(!selectedOrdMatchingRule.equalsIgnoreCase("none"))) {
+ las.setQualifier("ORDERING", selectedOrdMatchingRule);
+ }
+
+ String selectedSubMatchingRule = (String)_cmbAttributeMrSubstring.getSelectedItem();
+ if ((selectedSubMatchingRule != null) &&
(!selectedSubMatchingRule.equalsIgnoreCase("none"))) {
+ las.setQualifier("SUBSTR", selectedSubMatchingRule);
+ }
+
boolean done = false;
boolean deleted = false;
boolean status = false;
@@ -475,7 +493,96 @@ class AttributePanel extends BlankPanel {
}
}
}
-
+
+ /* check if the EQUALITY matching rule can be used with the syntax */
+ boolean isEqMatchingRuleValid = true;
+ boolean isEqMatchingRuleModified = false;
+ String selectedEqMatchingRule = (String)_cmbAttributeMrEquality.getSelectedItem();
+ String originalEqMatchingRule = null;
+ if (_las != null) {
+ String [] mr_eq_vals = _las.getQualifier("EQUALITY");
+ if ((mr_eq_vals != null) && (mr_eq_vals.length > 0)) {
+ originalEqMatchingRule = mr_eq_vals[0];
+ }
+
+ if (selectedEqMatchingRule != null) {
+ // was the matching rule modified?
+ if ((originalEqMatchingRule != null) &&
!originalEqMatchingRule.equals(selectedEqMatchingRule)) {
+ isEqMatchingRuleModified = true;
+ }
+
+ // get the name of the syntax used in the matching rule
+ String selectedEqSyntax = null;
+ if (_htMatchingRuleStrings.get(selectedEqMatchingRule) != null) {
+ selectedEqSyntax =
(String)_htSyntaxStrings.get(_htMatchingRuleStrings.get(selectedEqMatchingRule));
+ }
+
+ // is the matching rule valid?
+ if ((selectedEqSyntax != null) && !selectedEqSyntax.equals(selectedSyntax))
{
+ isEqMatchingRuleValid = false;
+ }
+ }
+ }
+
+ /* check if the ORDERING matching rule can be used with the syntax */
+ boolean isOrdMatchingRuleValid = true;
+ boolean isOrdMatchingRuleModified = false;
+ String selectedOrdMatchingRule = (String)_cmbAttributeMrOrdering.getSelectedItem();
+ String originalOrdMatchingRule = null;
+ if (_las != null) {
+ String [] mr_ord_vals = _las.getQualifier("ORDERING");
+ if ((mr_ord_vals != null) && (mr_ord_vals.length > 0)) {
+ originalOrdMatchingRule = mr_ord_vals[0];
+ }
+
+ if (selectedOrdMatchingRule != null) {
+ // was the matching rule modified?
+ if ((originalOrdMatchingRule != null) &&
!originalOrdMatchingRule.equals(selectedOrdMatchingRule)) {
+ isOrdMatchingRuleModified = true;
+ }
+
+ // get the name of the syntax used in the matching rule
+ String selectedOrdSyntax = null;
+ if (_htMatchingRuleStrings.get(selectedOrdMatchingRule) != null) {
+ selectedOrdSyntax =
(String)_htSyntaxStrings.get(_htMatchingRuleStrings.get(selectedOrdMatchingRule));
+ }
+
+ // is the matching rule valid?
+ if ((selectedOrdSyntax != null) && !selectedOrdSyntax.equals(selectedSyntax))
{
+ isOrdMatchingRuleValid = false;
+ }
+ }
+ }
+
+ /* check if the SUBSTR matching rule can be used with the syntax */
+ boolean isSubMatchingRuleValid = true;
+ boolean isSubMatchingRuleModified = false;
+ String selectedSubMatchingRule = (String)_cmbAttributeMrSubstring.getSelectedItem();
+ String originalSubMatchingRule = null;
+ if (_las != null) {
+ String [] mr_sub_vals = _las.getQualifier("SUBSTR");
+ if ((mr_sub_vals != null) && (mr_sub_vals.length > 0)) {
+ originalSubMatchingRule = mr_sub_vals[0];
+ }
+
+ if (selectedSubMatchingRule != null) {
+ // was the matching rule modified?
+ if ((originalSubMatchingRule != null) &&
!originalSubMatchingRule.equals(selectedSubMatchingRule)) {
+ isSubMatchingRuleModified = true;
+ }
+
+ // get the name of the syntax used in the matching rule
+ String selectedSubSyntax = null;
+ if (_htMatchingRuleStrings.get(selectedSubMatchingRule) != null) {
+ selectedSubSyntax =
(String)_htSyntaxStrings.get(_htMatchingRuleStrings.get(selectedSubMatchingRule));
+ }
+
+ // is the matching rule valid?
+ if ((selectedSubSyntax != null) && !selectedSubSyntax.equals(selectedSyntax))
{
+ isSubMatchingRuleValid = false;
+ }
+ }
+ }
/* CHECK MULTIVALUED (always valid, only modification) */
boolean isMultiValuedModified = false;
@@ -522,6 +629,29 @@ class AttributePanel extends BlankPanel {
setChangeState(_lAttributeSyntax, CHANGE_STATE_UNMODIFIED);
}
+ if (!isEqMatchingRuleValid) {
+ setChangeState(_lAttributeMrEquality, CHANGE_STATE_ERROR);
+ } else if (isEqMatchingRuleModified) {
+ setChangeState(_lAttributeMrEquality, CHANGE_STATE_MODIFIED);
+ } else {
+ setChangeState(_lAttributeMrEquality, CHANGE_STATE_UNMODIFIED);
+ }
+
+ if (!isOrdMatchingRuleValid) {
+ setChangeState(_lAttributeMrOrdering, CHANGE_STATE_ERROR);
+ } else if (isOrdMatchingRuleModified) {
+ setChangeState(_lAttributeMrOrdering, CHANGE_STATE_MODIFIED);
+ } else {
+ setChangeState(_lAttributeMrOrdering, CHANGE_STATE_UNMODIFIED);
+ }
+
+ if (!isSubMatchingRuleValid) {
+ setChangeState(_lAttributeMrSubstring, CHANGE_STATE_ERROR);
+ } else if (isSubMatchingRuleModified) {
+ setChangeState(_lAttributeMrSubstring, CHANGE_STATE_MODIFIED);
+ } else {
+ setChangeState(_lAttributeMrSubstring, CHANGE_STATE_UNMODIFIED);
+ }
if (isMultiValuedModified) {
setChangeState(_ckbAttributeIsMulti, CHANGE_STATE_MODIFIED);
@@ -531,7 +661,8 @@ class AttributePanel extends BlankPanel {
boolean isValid = isNameValid &&
isAliasValid &&
- isOIDValid;
+ isOIDValid && isEqMatchingRuleValid &&
+ isOrdMatchingRuleValid && isSubMatchingRuleValid;
_dlg.setOKButtonEnabled( isValid );
}
@@ -550,35 +681,45 @@ class AttributePanel extends BlankPanel {
}
protected JPanel createNewAttributeArea() {
- // create the widgets
- _lAttributeName = makeJLabel(PANEL_NAME, "newname");
- _tfAttributeName = makeJTextField(PANEL_NAME, "newname",
+ /* In _htSyntaxStrings we have as key the OID of the syntax, and as value, the
Description of the Syntax */
+ if ( _htSyntaxStrings == null ) {
+ _htSyntaxStrings =
SchemaAttributesPanel.getSyntaxStrings(getModel().getSchema());
+ }
+
+ // In _htMatchingRuleStrings we have as key the name of the MR, and as
value, the AVA syntax OID
+ if ( _htMatchingRuleStrings == null ) {
+ _htMatchingRuleStrings =
SchemaAttributesPanel.getMatchingRuleStrings(getModel().getSchema());
+ }
+
+ // create the widgets
+ _lAttributeName = makeJLabel(PANEL_NAME, "newname");
+ _tfAttributeName = makeJTextField(PANEL_NAME, "newname",
null, 20);
_lAttributeName.setLabelFor(_tfAttributeName);
_lAttributeAliases = makeJLabel(PANEL_NAME, "newaliases");
- _tfAttributeAliases = makeJTextField(PANEL_NAME, "newaliases",
+ _tfAttributeAliases = makeJTextField(PANEL_NAME, "newaliases",
null, 20);
_lAttributeAliases.setLabelFor(_tfAttributeAliases);
- _lAttributeOID = makeJLabel(PANEL_NAME, "newoid");
- _tfAttributeOID = makeJTextField(PANEL_NAME, "newoid",
+ _lAttributeOID = makeJLabel(PANEL_NAME, "newoid");
+ _tfAttributeOID = makeJTextField(PANEL_NAME, "newoid",
null, 20);
_lAttributeOID.setLabelFor(_tfAttributeOID);
- _lAttributeDesc = makeJLabel(PANEL_NAME, "newdesc");
- _tfAttributeDesc = makeJTextField(PANEL_NAME, "newdesc",
+ _lAttributeDesc = makeJLabel(PANEL_NAME, "newdesc");
+ _tfAttributeDesc = makeJTextField(PANEL_NAME, "newdesc",
null, 20);
_lAttributeDesc.setLabelFor(_tfAttributeDesc);
- _ckbAttributeIsMulti = makeJCheckBox(PANEL_NAME, "newmulti",
+ _ckbAttributeIsMulti = makeJCheckBox(PANEL_NAME, "newmulti",
false);
// Value by default
_ckbAttributeIsMulti.setSelected(true);
_ckbAttributeIsMulti.addActionListener(this);
- _lAttributeSyntax = makeJLabel(PANEL_NAME, "newsyntax");
- _cmbAttributeSyntax = makeJComboBox(PANEL_NAME, "newsyntax",
+ _lAttributeSyntax = makeJLabel(PANEL_NAME, "newsyntax");
+ _cmbAttributeSyntax = makeJComboBox(PANEL_NAME, "newsyntax",
null);
_lAttributeSyntax.setLabelFor(_cmbAttributeSyntax);
_cmbAttributeSyntax.addItemListener(this);
@@ -593,12 +734,38 @@ class AttributePanel extends BlankPanel {
if ( c instanceof JTextField )
((JTextField)c).setMargin( getTextInsets() );
}
- /* In _htSyntaxStrings we have as key the OID of the syntax, and as value, the
Description of the Syntax */
- if ( _htSyntaxStrings == null ) {
- _htSyntaxStrings = SchemaAttributesPanel.getSyntaxStrings(getModel().getSchema());
+
+ // Equality matching rules
+ _lAttributeMrEquality = makeJLabel(PANEL_NAME, "newmrequality");
+ _cmbAttributeMrEquality = makeJComboBox(PANEL_NAME, "newmrequality",
+ null);
+ _lAttributeMrEquality.setLabelFor(_cmbAttributeMrEquality);
+ _cmbAttributeMrEquality.addItemListener(this);
+ UIFactory.setToolTip(PANEL_NAME, "newmrequality", _cmbAttributeMrEquality);
+ ed = _cmbAttributeMrEquality.getEditor();
+ if ( ed != null ) {
+ Component c = ed.getEditorComponent();
+ if ( c instanceof JTextField )
+ ((JTextField)c).setMargin( getTextInsets() );
}
+
+ // Ordering matching rules
+ _lAttributeMrOrdering = makeJLabel(PANEL_NAME, "newmrordering");
+ _cmbAttributeMrOrdering = makeJComboBox(PANEL_NAME, "newmrordering",
+ null);
+ _lAttributeMrOrdering.setLabelFor(_cmbAttributeMrOrdering);
+ _cmbAttributeMrOrdering.addItemListener(this);
+
+
+ // Substring matching rules
+ _lAttributeMrSubstring = makeJLabel(PANEL_NAME, "newmrsubstring");
+ _cmbAttributeMrSubstring = makeJComboBox(PANEL_NAME, "newmrsubstring",
+ null);
+ _lAttributeMrSubstring.setLabelFor(_cmbAttributeMrSubstring);
+ _cmbAttributeMrSubstring.addItemListener(this);
+
/* We add the different syntaxes to the combobox */
- Enumeration syntaxes = _htSyntaxStrings.elements();
+ Enumeration syntaxes = _htSyntaxStrings.elements();
while (syntaxes.hasMoreElements()) {
String item = (String)syntaxes.nextElement();
if (item != null) {
@@ -606,9 +773,28 @@ class AttributePanel extends BlankPanel {
}
}
- // layout the widgets
- // create a panel to hold things
- JPanel panel = new JPanel(new GridBagLayout());
+ // Fill in the combo boxes with a sorted list of matching rules
+ _cmbAttributeMrEquality.insertItemAt("none", 0);
+ _cmbAttributeMrOrdering.insertItemAt("none", 0);
+ _cmbAttributeMrSubstring.insertItemAt("none", 0);
+ Vector vMatchingRules = new Vector (_htMatchingRuleStrings.keySet());
+ Collections.sort(vMatchingRules);
+ Enumeration matchingrules = vMatchingRules.elements();
+ while (matchingrules.hasMoreElements()) {
+ String item = (String)matchingrules.nextElement();
+ // Don't add the matching rule if it's syntax isn't in the hashtable of
+ // syntax strings. This is to avoid including matching rules that use the
+ // substring assertion syntax, which we don't support.
+ if ((item != null) && (_htSyntaxStrings.get(_htMatchingRuleStrings.get(item))
!= null)) {
+ _cmbAttributeMrEquality.addItem(item);
+ _cmbAttributeMrOrdering.addItem(item);
+ _cmbAttributeMrSubstring.addItem(item);
+ }
+ }
+
+ // layout the widgets
+ // create a panel to hold things
+ JPanel panel = new JPanel(new GridBagLayout());
panel.setBorder( new EmptyBorder( 0, 0, 0, 0 ) );
GridBagConstraints gbc = new GridBagConstraints();
int different = UIFactory.getDifferentSpace();
@@ -681,6 +867,45 @@ class AttributePanel extends BlankPanel {
panel.add(_cmbAttributeSyntax, gbc);
gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.gridwidth = gbc.RELATIVE;
+ gbc.weightx = 0;
+ gbc.insets = left;
+ panel.add(_lAttributeMrEquality, gbc);
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = right;
+ panel.add(_cmbAttributeMrEquality, gbc);
+
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.gridwidth = gbc.RELATIVE;
+ gbc.weightx = 0;
+ gbc.insets = left;
+ panel.add(_lAttributeMrOrdering, gbc);
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = right;
+ panel.add(_cmbAttributeMrOrdering, gbc);
+
+ gbc.fill = gbc.NONE;
+ gbc.anchor = gbc.NORTHEAST;
+ gbc.gridwidth = gbc.RELATIVE;
+ gbc.weightx = 0;
+ gbc.insets = left;
+ panel.add(_lAttributeMrSubstring, gbc);
+ gbc.fill = gbc.HORIZONTAL;
+ gbc.anchor = gbc.WEST;
+ gbc.weightx = 1;
+ gbc.gridwidth = gbc.REMAINDER;
+ gbc.insets = right;
+ panel.add(_cmbAttributeMrSubstring, gbc);
+
+ gbc.fill = gbc.NONE;
gbc.weightx = 0.0;
gbc.anchor = gbc.NORTHEAST;
gbc.gridwidth = gbc.RELATIVE;
@@ -704,12 +929,52 @@ class AttributePanel extends BlankPanel {
if (syntax != null) {
_cmbAttributeSyntax.setSelectedItem( syntax );
}
+
+ String [] mr_eq_vals = _las.getQualifier("EQUALITY");
+ if ((mr_eq_vals != null) && (mr_eq_vals.length > 0)) {
+ String mr_eq = mr_eq_vals[0];
+ if (mr_eq != null) {
+ _cmbAttributeMrEquality.setSelectedItem( mr_eq );
+ } else {
+ _cmbAttributeMrEquality.setSelectedIndex(0);
+ }
+ } else {
+ _cmbAttributeMrEquality.setSelectedIndex(0);
+ }
+
+ String [] mr_ord_vals = _las.getQualifier("ORDERING");
+ if ((mr_ord_vals != null) && (mr_ord_vals.length > 0)) {
+ String mr_ord = mr_ord_vals[0];
+ if (mr_ord != null) {
+ _cmbAttributeMrOrdering.setSelectedItem( mr_ord );
+ } else {
+ _cmbAttributeMrOrdering.setSelectedIndex(0);
+ }
+ } else {
+ _cmbAttributeMrOrdering.setSelectedIndex(0);
+ }
+
+ String [] mr_sub_vals = _las.getQualifier("SUBSTR");
+ if ((mr_sub_vals != null) && (mr_sub_vals.length > 0)) {
+ String mr_sub = mr_sub_vals[0];
+ if (mr_sub != null) {
+ _cmbAttributeMrSubstring.setSelectedItem( mr_sub );
+ } else {
+ _cmbAttributeMrSubstring.setSelectedIndex(0);
+ }
+ } else {
+ _cmbAttributeMrSubstring.setSelectedIndex(0);
+ }
+
_ckbAttributeIsMulti.setSelected( !_las.isSingleValued() );
} else {
/* Give a default value */
- _tfAttributeName.setText(DSUtil._resource.getString(
- PANEL_NAME,
- "newname-default"));
+ _tfAttributeName.setText(DSUtil._resource.getString(PANEL_NAME,
"newname-default"));
+
+ /* Select none for all matching rules */
+ _cmbAttributeMrEquality.setSelectedIndex(0);
+ _cmbAttributeMrOrdering.setSelectedIndex(0);
+ _cmbAttributeMrSubstring.setSelectedIndex(0);
}
return panel;
}
@@ -767,11 +1032,14 @@ class AttributePanel extends BlankPanel {
*
* @param e Event indicating what changed
*/
- public void itemStateChanged(ItemEvent e) {
- if (e.getSource().equals(_cmbAttributeSyntax)) {
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getSource().equals(_cmbAttributeSyntax) ||
+ e.getSource().equals(_cmbAttributeMrEquality) ||
+ e.getSource().equals(_cmbAttributeMrOrdering) ||
+ e.getSource().equals(_cmbAttributeMrSubstring)) {
checkOkay();
}
- }
+ }
private JLabel _lAttributeAliases;
@@ -779,16 +1047,23 @@ class AttributePanel extends BlankPanel {
private JLabel _lAttributeName;
private JLabel _lAttributeDesc;
private JLabel _lAttributeSyntax;
+ private JLabel _lAttributeMrEquality;
+ private JLabel _lAttributeMrOrdering;
+ private JLabel _lAttributeMrSubstring;
private JTextField _tfAttributeName; // new attribute name
private JTextField _tfAttributeAliases; // aliases
private JTextField _tfAttributeOID; // oid for new attribute (optional)
private JTextField _tfAttributeDesc; // attribute description (optional)
private JCheckBox _ckbAttributeIsMulti; // true if attr is multivalued
private JComboBox _cmbAttributeSyntax; // syntax for new attribute
+ private JComboBox _cmbAttributeMrEquality; //equality matching rule
+ private JComboBox _cmbAttributeMrOrdering; //ordering matching rule
+ private JComboBox _cmbAttributeMrSubstring; //substring matching rule
private LDAPAttributeSchema _las = null;
private boolean _create = false;
private SimpleDialog _dlg;
private Hashtable _htSyntaxStrings = null;
+ private Hashtable _htMatchingRuleStrings = null;
static final public String PANEL_NAME = "schemaattributes"; // name of panel
in resource file
}
diff --git a/src/com/netscape/admin/dirserv/panel/SchemaAttributesPanel.java
b/src/com/netscape/admin/dirserv/panel/SchemaAttributesPanel.java
index b605fa1..5514b2f 100644
--- a/src/com/netscape/admin/dirserv/panel/SchemaAttributesPanel.java
+++ b/src/com/netscape/admin/dirserv/panel/SchemaAttributesPanel.java
@@ -81,10 +81,23 @@ public class SchemaAttributesPanel extends BlankPanel
return "";
}
- /**
- * Takes an ID in format 1.2.3.4{128} and creates an ID without the length
definition.
- * In this case the resulting ID is 1.2.3.4
- */
+ // Create a hashtable of matching rule names to the AVA syntax OIDs
+ static Hashtable getMatchingRuleStrings(LDAPSchema sch) {
+ Hashtable htMatchingRuleStrings = new Hashtable();
+ Enumeration matchingrules = sch.getMatchingRules();
+ while (matchingrules.hasMoreElements()) {
+ LDAPMatchingRuleSchema mr = (LDAPMatchingRuleSchema)matchingrules.nextElement();
+ if (mr != null) {
+ htMatchingRuleStrings.put(mr.getName(), mr.getSyntaxString());
+ }
+ }
+ return htMatchingRuleStrings;
+ }
+
+ /**
+ * Takes an ID in format 1.2.3.4{128} and creates an ID without the length
definition.
+ * In this case the resulting ID is 1.2.3.4
+ */
private static String getNormalizedID(String id) {
String normalizedId;
int index = id.indexOf('{');
@@ -236,9 +249,12 @@ public class SchemaAttributesPanel extends BlankPanel
String dummy = new String(); // for getClass()
Object[][] colHeader = {
{DSUtil._resource.getString(_section, "namecolumn-label"),
dummy.getClass()},
- {DSUtil._resource.getString(_section, "oidcolumn-label"),
dummy.getClass()},
- {DSUtil._resource.getString(_section, "syntaxcolumn-label"),
dummy.getClass()},
- {DSUtil._resource.getString(_section, "multicolumn-label"),
Boolean.TYPE}
+ {DSUtil._resource.getString(_section, "oidcolumn-label"),
dummy.getClass()},
+ {DSUtil._resource.getString(_section, "syntaxcolumn-label"),
dummy.getClass()},
+ {DSUtil._resource.getString(_section, "multicolumn-label"), Boolean.TYPE},
+ {DSUtil._resource.getString(_section, "mrequality-label"),
dummy.getClass()},
+ {DSUtil._resource.getString(_section, "mrordering-label"),
dummy.getClass()},
+ {DSUtil._resource.getString(_section, "mrsubstring-label"),
dummy.getClass()}
};
/* create standard attributes panel */
@@ -768,8 +784,12 @@ class AttrTableModel extends AbstractTableModel {
}
}
void addRow(LDAPAttributeSchema las) {
- Object row[] = new Object[4];
+ Object row[] = new Object[7];
String name = las.getName();
+ String [] mr_eq_vals = las.getQualifier("EQUALITY");
+ String [] mr_ord_vals = las.getQualifier("ORDERING");
+ String [] mr_sub_vals = las.getQualifier("SUBSTR");
+
// can't have alias list as first column in table because the code uses
// that value to look up the attribute schema
// String[] aliases = las.getAliases();
@@ -781,6 +801,18 @@ class AttrTableModel extends AbstractTableModel {
row[1] = las.getID();
row[2] = SchemaAttributesPanel.getSyntaxString(las.getSyntaxString());
row[3] = new Boolean( !las.isSingleValued() );
+
+ // Fill in any matching rules that are set
+ if ((mr_eq_vals != null) && (mr_eq_vals.length > 0)) {
+ row[4] = mr_eq_vals[0];
+ }
+ if ((mr_ord_vals != null) && (mr_ord_vals.length > 0)) {
+ row[5] = mr_ord_vals[0];
+ }
+ if ((mr_sub_vals != null) && (mr_sub_vals.length > 0)) {
+ row[6] = mr_sub_vals[0];
+ }
+
addRow(row);
}
void addRow( Object[] values ) {