コード例 #1
0
  /**
   * This method should only be called if an audit error is intending to be added because it will
   * actually add a <code>{@link List<AuditError>}</code> to the auditErrorMap.
   *
   * @return List of AuditError instances
   */
  private List<AuditError> getAuditErrors() {
    List<AuditError> auditErrors = new ArrayList<AuditError>();

    if (!GlobalVariables.getAuditErrorMap().containsKey("budgetPersonnelAuditErrors")) {
      GlobalVariables.getAuditErrorMap()
          .put(
              "budgetPersonnelAuditErrors",
              new AuditCluster("Budget Personnel Information", auditErrors, AUDIT_ERRORS));
    } else {
      auditErrors =
          ((AuditCluster) GlobalVariables.getAuditErrorMap().get("budgetPersonnelAuditErrors"))
              .getAuditErrorList();
    }

    return auditErrors;
  }
コード例 #2
0
  protected boolean processRunAuditBudgetVersionRule(BudgetParentDocument parentDocument) {
    // audit check for budgetversion with final status
    boolean finalAndCompleteBudgetVersionFound = false;
    boolean budgetVersionsExists = false;
    boolean retval = true;

    List<AuditError> auditErrors = new ArrayList<AuditError>();
    String budgetStatusCompleteCode =
        getParameterService()
            .getParameterValue(BudgetDocument.class, Constants.BUDGET_STATUS_COMPLETE_CODE);
    for (BudgetDocumentVersion budgetDocumentVersion : parentDocument.getBudgetDocumentVersions()) {
      BudgetVersionOverview budgetVersion = budgetDocumentVersion.getBudgetVersionOverview();
      budgetVersionsExists = true;
      if (budgetVersion.isFinalVersionFlag()) {
        BudgetParent budgetParent = parentDocument.getBudgetParent();
        if (budgetParent.getBudgetStatus() != null
            && budgetParent.getBudgetStatus().equals(budgetStatusCompleteCode)) {
          finalAndCompleteBudgetVersionFound = true;
        }
      }
    }
    if (budgetVersionsExists && !finalAndCompleteBudgetVersionFound) {
      auditErrors.add(
          new AuditError(
              "document.parentBudget.budgetVersionOverview",
              KeyConstants.AUDIT_ERROR_NO_BUDGETVERSION_COMPLETE_AND_FINAL,
              Constants.PD_BUDGET_VERSIONS_PAGE + "." + Constants.BUDGET_VERSIONS_PANEL_ANCHOR));
      retval = false;
    }
    if (auditErrors.size() > 0) {
      GlobalVariables.getAuditErrorMap()
          .put(
              "budgetVersionErrors",
              new AuditCluster(
                  Constants.BUDGET_VERSION_PANEL_NAME, auditErrors, Constants.AUDIT_ERRORS));
    }

    return retval;
  }