コード例 #1
0
  /**
   * Validates different requirements of component compiling a series of reports detailing
   * information on errors found in the component. Used by the RiceDictionaryValidator.
   *
   * @param tracer Record of component's location
   */
  @Override
  public void completeValidation(ValidationTrace tracer) {
    tracer.addBean("CaseConstraint", getMessageKey());

    if (getWhenConstraint() == null) {
      String currentValues[] = {"whenCaseConstraint = " + getWhenConstraint()};
      tracer.createWarning("WhenCaseConstraints should at least have 1 item", currentValues);
    } else {
      if (getWhenConstraint().size() == 0) {
        String currentValues[] = {"whenCaseConstraint.size() = " + getWhenConstraint().size()};
        tracer.createError("WhenCaseConstraints should at least have 1 item", currentValues);
      } else {
        for (int i = 0; i < getWhenConstraint().size(); i++) {
          getWhenConstraint().get(i).completeValidation(tracer.getCopy());
        }
      }
    }
  }
コード例 #2
0
ファイル: Header.java プロジェクト: jameysundevil/kuali_rice
  /** {@inheritDoc} */
  @Override
  public void completeValidation(ValidationTrace tracer) {
    tracer.addBean(this);

    // Checks that a correct header level is set
    String headerLevel = getHeaderLevel().toUpperCase();
    boolean correctHeaderLevel = false;
    if (headerLevel.compareTo("H1") == 0) {
      correctHeaderLevel = true;
    } else if (headerLevel.compareTo("H2") == 0) {
      correctHeaderLevel = true;
    } else if (headerLevel.compareTo("H3") == 0) {
      correctHeaderLevel = true;
    } else if (headerLevel.compareTo("H4") == 0) {
      correctHeaderLevel = true;
    } else if (headerLevel.compareTo("H5") == 0) {
      correctHeaderLevel = true;
    } else if (headerLevel.compareTo("H6") == 0) {
      correctHeaderLevel = true;
    } else if (headerLevel.compareTo("LABEL") == 0) {
      correctHeaderLevel = true;
    }
    if (!correctHeaderLevel) {
      String currentValues[] = {"headerLevel =" + getHeaderLevel()};
      tracer.createError(
          "HeaderLevel must be of values h1, h2, h3, h4, h5, h6, or label", currentValues);
    }

    // Checks that header text is set
    if (getHeaderText() == null) {
      if (!Validator.checkExpressions(this, "headerText")) {
        String currentValues[] = {"headertText =" + getHeaderText()};
        tracer.createWarning("HeaderText should be set", currentValues);
      }
    }

    super.completeValidation(tracer.getCopy());
  }