List of usage examples for java.sql Date getYear
@Deprecated public int getYear()
From source file:org.kuali.coeus.common.budget.impl.distribution.BudgetUnrecoveredFandAAuditRule.java
@KcEventMethod @Deprecated/* w w w.java2 s .c o m*/ public boolean processRunAuditBusinessRules(BudgetAuditEvent event) { Budget budget = event.getBudget(); if (getAuditErrorMap().containsKey(BUDGET_UNRECOVERED_F_AND_A_ERROR_KEY)) { List auditErrors = ((AuditCluster) getAuditErrorMap().get(BUDGET_UNRECOVERED_F_AND_A_ERROR_KEY)) .getAuditErrorList(); auditErrors.clear(); } // Returns if unrecovered f and a is not applicable if (!budget.isUnrecoveredFandAApplicable()) { return true; } List<BudgetUnrecoveredFandA> unrecoveredFandAs = budget.getBudgetUnrecoveredFandAs(); boolean retval = true; // Forces full allocation of unrecovered f and a if (budget.getUnallocatedUnrecoveredFandA().isGreaterThan(ScaleTwoDecimal.ZERO) && budget.isUnrecoveredFandAEnforced()) { retval = false; if (unrecoveredFandAs.size() == 0) { getAuditErrors().add(new AuditError("document.budget.budgetUnrecoveredFandA", KeyConstants.AUDIT_ERROR_BUDGET_DISTRIBUTION_UNALLOCATED_NOT_ZERO, Constants.BUDGET_DISTRIBUTION_AND_INCOME_PAGE + "." + Constants.BUDGET_UNRECOVERED_F_AND_A_PANEL_ANCHOR, params)); } for (int i = 0; i < unrecoveredFandAs.size(); i++) { getAuditErrors().add(new AuditError("document.budget.budgetUnrecoveredFandA[" + i + "].amount", KeyConstants.AUDIT_ERROR_BUDGET_DISTRIBUTION_UNALLOCATED_NOT_ZERO, Constants.BUDGET_DISTRIBUTION_AND_INCOME_PAGE + "." + Constants.BUDGET_UNRECOVERED_F_AND_A_PANEL_ANCHOR, params)); } } String source = null; Integer fiscalYear = null; int i = 0; int j = 0; BudgetParent budgetParent = budget.getBudgetParent(); Date projectStartDate = budgetParent.getRequestedStartDateInitial(); Date projectEndDate = budgetParent.getRequestedEndDateInitial(); // Forces inclusion of source account boolean duplicateEntryFound = false; for (BudgetUnrecoveredFandA unrecoveredFandA : unrecoveredFandAs) { source = unrecoveredFandA.getSourceAccount(); fiscalYear = unrecoveredFandA.getFiscalYear(); if (null == source || source.length() == 0) { retval = false; getAuditErrors() .add(new AuditError("document.budget.budgetUnrecoveredFandA[" + i + "].sourceAccount", KeyConstants.AUDIT_ERROR_BUDGET_DISTRIBUTION_SOURCE_MISSING, Constants.BUDGET_DISTRIBUTION_AND_INCOME_PAGE + "." + Constants.BUDGET_UNRECOVERED_F_AND_A_PANEL_ANCHOR, params)); } if (null == fiscalYear || fiscalYear.intValue() <= 0) { retval = false; getAuditErrors().add(new AuditError("document.budget.budgetUnrecoveredFandA[" + i + "].fiscalYear", KeyConstants.AUDIT_ERROR_BUDGET_DISTRIBUTION_FISCALYEAR_MISSING, Constants.BUDGET_DISTRIBUTION_AND_INCOME_PAGE + "." + Constants.BUDGET_UNRECOVERED_F_AND_A_PANEL_ANCHOR, params)); } if (fiscalYear != null && (fiscalYear < projectStartDate.getYear() + YEAR_CONSTANT || fiscalYear > projectEndDate.getYear() + YEAR_CONSTANT)) { getAuditWarnings() .add(new AuditError("document.budget.budgetUnrecoveredFandA[" + i + "].fiscalYear", KeyConstants.AUDIT_WARNING_BUDGET_DISTRIBUTION_FISCALYEAR_INCONSISTENT, Constants.BUDGET_DISTRIBUTION_AND_INCOME_PAGE + "." + Constants.BUDGET_UNRECOVERED_F_AND_A_PANEL_ANCHOR, params)); } if (!duplicateEntryFound) { j = 0; for (BudgetUnrecoveredFandA unrecoveredFandAForComparison : unrecoveredFandAs) { if (i != j && unrecoveredFandA.getFiscalYear() != null && unrecoveredFandAForComparison.getFiscalYear() != null && unrecoveredFandA.getFiscalYear().intValue() == unrecoveredFandAForComparison .getFiscalYear().intValue() && unrecoveredFandA.getApplicableRate() .equals(unrecoveredFandAForComparison.getApplicableRate()) && unrecoveredFandA.getOnCampusFlag() .equalsIgnoreCase(unrecoveredFandAForComparison.getOnCampusFlag()) && StringUtils.equalsIgnoreCase(unrecoveredFandA.getSourceAccount(), unrecoveredFandAForComparison.getSourceAccount()) && unrecoveredFandA.getAmount().equals(unrecoveredFandAForComparison.getAmount())) { retval = false; getAuditErrors().add(new AuditError("document.budget.budgetUnrecoveredFandA[" + i + "]", KeyConstants.AUDIT_ERROR_BUDGET_DISTRIBUTION_DUPLICATE_UNRECOVERED_FA, Constants.BUDGET_DISTRIBUTION_AND_INCOME_PAGE + "." + Constants.BUDGET_UNRECOVERED_F_AND_A_PANEL_ANCHOR, params)); duplicateEntryFound = true; break; } j++; } } i++; } return retval; }