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

matthew_swift
28.47.2010 f2160f4bd1c8ac67e5a86a6710d431e8932877f9
sdk/src/org/opends/sdk/schema/EnhancedGuideSyntaxImpl.java
@@ -30,8 +30,10 @@
import static com.sun.opends.sdk.messages.Messages.*;
import static com.sun.opends.sdk.util.StaticUtils.*;
import static org.opends.sdk.schema.SchemaConstants.*;
import static com.sun.opends.sdk.util.StaticUtils.toLowerCase;
import static org.opends.sdk.schema.SchemaConstants.EMR_OCTET_STRING_OID;
import static org.opends.sdk.schema.SchemaConstants.OMR_OCTET_STRING_OID;
import static org.opends.sdk.schema.SchemaConstants.SYNTAX_ENHANCED_GUIDE_NAME;
import org.opends.sdk.ByteSequence;
import org.opends.sdk.DecodeException;
@@ -42,9 +44,9 @@
/**
 * This class implements the enhanced guide attribute syntax, which may
 * be used to provide criteria for generating search filters for entries
 * of a given objectclass.
 * This class implements the enhanced guide attribute syntax, which may be used
 * to provide criteria for generating search filters for entries of a given
 * objectclass.
 */
final class EnhancedGuideSyntaxImpl extends AbstractSyntaxImpl
{
@@ -79,21 +81,21 @@
  /**
   * Indicates whether the provided value is acceptable for use in an
   * attribute with this syntax. If it is not, then the reason may be
   * appended to the provided buffer.
   *
   * Indicates whether the provided value is acceptable for use in an attribute
   * with this syntax. If it is not, then the reason may be appended to the
   * provided buffer.
   *
   * @param schema
   *          The schema in which this syntax is defined.
   * @param value
   *          The value for which to make the determination.
   * @param invalidReason
   *          The buffer to which the invalid reason should be appended.
   * @return <CODE>true</CODE> if the provided value is acceptable for
   *         use with this syntax, or <CODE>false</CODE> if not.
   * @return <CODE>true</CODE> if the provided value is acceptable for use with
   *         this syntax, or <CODE>false</CODE> if not.
   */
  public boolean valueIsAcceptable(Schema schema, ByteSequence value,
      LocalizableMessageBuilder invalidReason)
  public boolean valueIsAcceptable(final Schema schema,
      final ByteSequence value, final LocalizableMessageBuilder invalidReason)
  {
    // Get a lowercase string version of the provided value.
    final String valueStr = toLowerCase(value.toString());
@@ -104,8 +106,8 @@
    if (sharpPos < 0)
    {
      invalidReason.append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_NO_SHARP
          .get(valueStr));
      invalidReason
          .append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_NO_SHARP.get(valueStr));
      return false;
    }
@@ -115,15 +117,13 @@
    if (ocLength == 0)
    {
      invalidReason.append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_NO_OC
          .get(valueStr));
      invalidReason.append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_NO_OC.get(valueStr));
      return false;
    }
    try
    {
      SchemaUtils.readOID(new SubstringReader(ocName
          .substring(ocLength)));
      SchemaUtils.readOID(new SubstringReader(ocName.substring(ocLength)));
    }
    catch (final DecodeException de)
    {
@@ -156,9 +156,8 @@
      else
      {
        invalidReason
            .append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_INVALID_SCOPE.get(
                valueStr, scopeStr));
        invalidReason.append(ERR_ATTR_SYNTAX_ENHANCEDGUIDE_INVALID_SCOPE.get(
            valueStr, scopeStr));
      }
      return false;
@@ -166,8 +165,8 @@
    // Everything between the two octothorpes must be the criteria. Make
    // sure it is valid.
    final String criteria =
        valueStr.substring(sharpPos + 1, lastSharpPos).trim();
    final String criteria = valueStr.substring(sharpPos + 1, lastSharpPos)
        .trim();
    final int criteriaLength = criteria.length();
    if (criteriaLength == 0)
    {
@@ -177,7 +176,6 @@
      return false;
    }
    return GuideSyntaxImpl.criteriaIsValid(criteria, valueStr,
        invalidReason);
    return GuideSyntaxImpl.criteriaIsValid(criteria, valueStr, invalidReason);
  }
}