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

sin
22.16.2009 0439ad4249ab8bea03d35f95530c47dc7c29aaa5
Minor changes to remove the tight-coupling introduced between the entry class and the ldapsyntaxes attribute
3 files modified
69 ■■■■ changed files
opends/src/server/org/opends/server/api/AttributeSyntax.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java 54 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/Entry.java 11 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/api/AttributeSyntax.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 */
package org.opends.server.api;
import org.opends.messages.Message;
@@ -285,7 +285,7 @@
   * @return  A string representation of this attribute syntax in the
   *          format defined in RFC 2252.
   */
  public final String toString()
  public String toString()
  {
    StringBuilder buffer = new StringBuilder();
    toString(buffer);
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()
    {
opends/src/server/org/opends/server/types/Entry.java
@@ -1659,17 +1659,6 @@
      return allSuccessful;
    }
    AttributeType ldapSyntaxType =
         DirectoryServer.getAttributeType(ATTR_LDAP_SYNTAXES_LC,
         true);
    if (attribute.getAttributeType().equals(ldapSyntaxType))
    {
      // This is tricky as ldapsyntaxes type is part real and part
      // virtual. Don't do anything here and let the backend take
      // care of it.
      return true;
    }
    AttributeType attributeType = attribute.getAttributeType();
    List<Attribute> attributes;