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

Jean-Noël Rouvignac
02.09.2016 3d0432b70360e04c423d82bf5dcd78cfb98417bb
OPENDJ-3037 Inlined DirectoryServer.getMatchingRuleUse()
2 files modified
43 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java 24 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java 19 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -72,12 +72,9 @@
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.DITContentRule;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.forgerock.opendj.ldap.schema.MatchingRuleUse;
import org.forgerock.opendj.ldap.schema.NameForm;
import org.forgerock.opendj.ldap.schema.ObjectClass;
import org.forgerock.opendj.ldap.schema.Syntax;
import org.forgerock.opendj.ldap.schema.UnknownSchemaElementException;
import org.forgerock.opendj.server.config.server.AlertHandlerCfg;
import org.forgerock.opendj.server.config.server.ConnectionHandlerCfg;
import org.forgerock.opendj.server.config.server.CryptoManagerCfg;
@@ -2362,27 +2359,6 @@
  }
  /**
   * Retrieves the matching rule use associated with the provided matching rule.
   *
   * @param  matchingRule  The matching rule for which to retrieve the matching
   *                       rule use.
   *
   * @return  The matching rule use for the provided matching rule, or
   *          {@code null} if none is defined.
   */
  public static MatchingRuleUse getMatchingRuleUse(MatchingRule matchingRule)
  {
    try
    {
      return directoryServer.schema.getMatchingRuleUse(matchingRule);
    }
    catch (UnknownSchemaElementException e)
    {
      return null;
    }
  }
  /**
   * Retrieves the DIT content rule associated with the specified objectclass.
   *
   * @param  objectClass  The objectclass for which to retrieve the associated
opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java
@@ -3226,18 +3226,19 @@
    // determine if it allows that attribute type.
    if (attributeType != null)
    {
      MatchingRuleUse mru = DirectoryServer.getMatchingRuleUse(matchingRule);
      if (mru != null && !mru.hasAttribute(attributeType))
      try
      {
        if (logger.isTraceEnabled())
        MatchingRuleUse mru = DirectoryServer.getSchema().getMatchingRuleUse(matchingRule);
        if (!mru.hasAttribute(attributeType))
        {
          logger.trace(
              "Attribute type %s is not allowed for use with " +
              "matching rule %s because of matching rule use " +
              "definition %s", attributeType.getNameOrOID(),
              matchingRule.getNameOrOID(), mru.getNameOrOID());
          logger.trace("Attribute type %s is not allowed for use with "
              + "matching rule %s because of matching rule use definition %s",
              attributeType.getNameOrOID(), matchingRule.getNameOrOID(), mru.getNameOrOID());
          return ConditionResult.UNDEFINED;
        }
        return ConditionResult.UNDEFINED;
      }
      catch (UnknownSchemaElementException ignored)
      {
      }
    }