Search in sources :

Example 6 with AccountReversionGlobalAccount

use of edu.cornell.kfs.coa.businessobject.AccountReversionGlobalAccount in project cu-kfs by CU-CommunityApps.

the class AccountReversionGlobalRule method areAllAccountsValid.

/**
 * This method tests if all the AccountReversionGlobalAccount objects associated with the given global account
 * reversion pass all of their tests.
 *
 * @param globalAcctRev the global account reversion to check
 * @return true if valid, false otherwise
 */
public boolean areAllAccountsValid(AccountReversionGlobal globalAcctRev) {
    boolean success = true;
    if (globalAcctRev.getAccountReversionGlobalAccounts().size() == 0) {
        putFieldError(KFSConstants.MAINTENANCE_ADD_PREFIX + "accountReversionGlobalAccounts.organizationCode", CUKFSKeyConstants.ERROR_DOCUMENT_GLOBAL_ACCT_REVERSION_NO_ACCOUNTS);
        success = false;
    } else {
        success &= checkAllAccountReversionsExistOrAllFieldsAreDefined(globalAcctRev);
        for (int i = 0; i < globalAcctRev.getAccountReversionGlobalAccounts().size(); i++) {
            AccountReversionGlobalAccount acct = globalAcctRev.getAccountReversionGlobalAccounts().get(i);
            String errorPath = MAINTAINABLE_ERROR_PREFIX + "accountReversionGlobalAccounts[" + i + "]";
            GlobalVariables.getMessageMap().addToErrorPath(errorPath);
            success &= checkAllObjectCodesForValidity(globalAcctRev, acct);
            success &= checkAccountValidity(acct);
            success &= checkAccountChartValidity(acct);
            success &= validateAccountFundGroup(acct);
            success &= validateAccountSubFundGroup(acct);
            GlobalVariables.getMessageMap().removeFromErrorPath(errorPath);
        }
    }
    return success;
}
Also used : AccountReversionGlobalAccount(edu.cornell.kfs.coa.businessobject.AccountReversionGlobalAccount)

Aggregations

AccountReversionGlobalAccount (edu.cornell.kfs.coa.businessobject.AccountReversionGlobalAccount)6 AccountReversionGlobal (edu.cornell.kfs.coa.businessobject.AccountReversionGlobal)2 AccountReversionGlobalDetail (edu.cornell.kfs.coa.businessobject.AccountReversionGlobalDetail)2 AccountReversion (edu.cornell.kfs.coa.businessobject.AccountReversion)1 ArrayList (java.util.ArrayList)1 MaintenanceLock (org.kuali.kfs.krad.maintenance.MaintenanceLock)1