From 0439ad4249ab8bea03d35f95530c47dc7c29aaa5 Mon Sep 17 00:00:00 2001
From: sin <sin@localhost>
Date: Wed, 22 Jul 2009 14:16:56 +0000
Subject: [PATCH] Minor changes to remove the tight-coupling introduced between the entry class and the ldapsyntaxes attribute

---
 opends/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java |   54 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 51 insertions(+), 3 deletions(-)

diff --git a/opends/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java b/opends/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java
index 59e90f7..c97d32b 100644
--- a/opends/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java
+++ b/opends/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java
@@ -524,7 +524,7 @@
         throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                                      message);
       }
-      syntax = new SubstitutionSyntax(subSyntax,description,oid);
+      syntax = new SubstitutionSyntax(subSyntax,valueStr,description,oid);
     }
     else if(lowerTokenName.equals("x-pattern"))
     {
@@ -542,7 +542,7 @@
       try
       {
         Pattern pattern = Pattern.compile(regex);
-        syntax = new RegexSyntax(pattern,description,oid);
+        syntax = new RegexSyntax(pattern,valueStr,description,oid);
       }
       catch(Exception e)
       {
@@ -585,7 +585,7 @@
         }
         entries.add(entry);
       }
-      syntax = new EnumSyntax(entries, description, oid);
+      syntax = new EnumSyntax(entries, valueStr,description, oid);
     }
     else
     {
@@ -970,6 +970,10 @@
     // The description of this syntax.
     private String description;
 
+    // The definition of this syntax.
+    private String definition;
+
+
     //The oid of this syntax.
     private String oid;
 
@@ -977,11 +981,13 @@
 
     //Creates a new instance of this syntax.
     private SubstitutionSyntax(AttributeSyntax subSyntax,
+            String definition,
             String description,
             String oid)
     {
       super();
       this.subSyntax = subSyntax;
+      this.definition = definition;
       this.description = description;
       this.oid = oid;
     }
@@ -1022,6 +1028,17 @@
 
 
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString()
+    {
+      return definition;
+    }
+
+
+
      /**
      * {@inheritDoc}
      */
@@ -1116,6 +1133,9 @@
     //The oid of this syntax.
     private String oid;
 
+    //The definition of this syntax.
+    private String definition;
+
     //The equality matching rule.
     private EqualityMatchingRule equalityMatchingRule;
 
@@ -1131,10 +1151,12 @@
 
     //Creates a new instance of this syntax.
     private RegexSyntax(Pattern pattern,
+            String definition,
             String description,
             String oid)
     {
       super();
+      this.definition = definition;
       this.pattern = pattern;
       this.description = description;
       this.oid = oid;
@@ -1175,6 +1197,16 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString()
+    {
+      return definition;
+    }
+
+
 
     /**
      * {@inheritDoc}
@@ -1312,14 +1344,19 @@
     //The approximate matching rule.
     private ApproximateMatchingRule approximateMatchingRule;
 
+    //The definition of this syntax.
+    private String definition;
+
 
     //Creates a new instance of this syntax.
     private EnumSyntax(LinkedList<ByteSequence> entries,
+            String definition,
             String description,
             String oid)
     {
       super();
       this.entries = entries;
+      this.definition = definition;
       this.description = description;
       this.oid = oid;
     }
@@ -1352,6 +1389,17 @@
     /**
      * {@inheritDoc}
      */
+    @Override
+    public String toString()
+    {
+      return definition;
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
      @Override
     public String getDescription()
     {

--
Gitblit v1.10.0