Search in sources :

Example 11 with AccountGlobalDetail

use of org.kuali.kfs.coa.businessobject.AccountGlobalDetail in project cu-kfs by CU-CommunityApps.

the class GlobalIndirectCostRecoveryAccountsRule method buildMessageFromPrimaryKey.

private String buildMessageFromPrimaryKey(GlobalBusinessObjectDetailBase detail) {
    StringBuilder message = new StringBuilder();
    if (detail instanceof AccountGlobalDetail) {
        AccountGlobalDetail accountGlobalDetail = (AccountGlobalDetail) detail;
        message.append(accountGlobalDetail.getChartOfAccountsCode());
        message.append("-");
        message.append(accountGlobalDetail.getAccountNumber());
    } else if (detail instanceof SubAccountGlobalDetail) {
        SubAccountGlobalDetail subAccountGlobalDetail = (SubAccountGlobalDetail) detail;
        message.append(subAccountGlobalDetail.getChartOfAccountsCode());
        message.append("-");
        message.append(subAccountGlobalDetail.getAccountNumber());
        message.append("-");
        message.append(subAccountGlobalDetail.getSubAccountNumber());
    }
    return message.toString();
}
Also used : SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail) AccountGlobalDetail(org.kuali.kfs.coa.businessobject.AccountGlobalDetail) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail)

Example 12 with AccountGlobalDetail

use of org.kuali.kfs.coa.businessobject.AccountGlobalDetail in project cu-kfs by CU-CommunityApps.

the class CuAccountGlobal method updateGlobalDetailICRAccountCollection.

@Override
public void updateGlobalDetailICRAccountCollection(GlobalBusinessObjectDetailBase globalDetail, List<IndirectCostRecoveryAccount> updatedIcrAccounts) {
    AccountGlobalDetail accountGlobalDetail = (AccountGlobalDetail) globalDetail;
    accountGlobalDetail.getAccount().setIndirectCostRecoveryAccounts(updatedIcrAccounts);
}
Also used : AccountGlobalDetail(org.kuali.kfs.coa.businessobject.AccountGlobalDetail)

Example 13 with AccountGlobalDetail

use of org.kuali.kfs.coa.businessobject.AccountGlobalDetail in project cu-kfs by CU-CommunityApps.

the class CuAccountGlobal method createIndirectCostRecoveryAccountFromChange.

@Override
public IndirectCostRecoveryAccount createIndirectCostRecoveryAccountFromChange(GlobalBusinessObjectDetailBase globalDetail, IndirectCostRecoveryAccountChange newICR) {
    AccountGlobalDetail accountGlobalDetail = (AccountGlobalDetail) globalDetail;
    String chart = accountGlobalDetail.getChartOfAccountsCode();
    String account = accountGlobalDetail.getAccountNumber();
    IndirectCostRecoveryAccount icrAccount = new IndirectCostRecoveryAccount();
    icrAccount.setAccountNumber(account);
    icrAccount.setChartOfAccountsCode(chart);
    icrAccount.setIndirectCostRecoveryAccountNumber(newICR.getIndirectCostRecoveryAccountNumber());
    icrAccount.setIndirectCostRecoveryFinCoaCode(newICR.getIndirectCostRecoveryFinCoaCode());
    icrAccount.setActive(newICR.isActive());
    icrAccount.setAccountLinePercent(newICR.getAccountLinePercent());
    return icrAccount;
}
Also used : IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) AccountGlobalDetail(org.kuali.kfs.coa.businessobject.AccountGlobalDetail)

Example 14 with AccountGlobalDetail

use of org.kuali.kfs.coa.businessobject.AccountGlobalDetail in project cu-kfs by CU-CommunityApps.

the class CuAccountGlobal method getGlobalObjectDetailsAndIcrAccountsMap.

@Override
public Map<GlobalBusinessObjectDetailBase, List<IndirectCostRecoveryAccount>> getGlobalObjectDetailsAndIcrAccountsMap() {
    Map<GlobalBusinessObjectDetailBase, List<IndirectCostRecoveryAccount>> globalObjectDetailsAndIcrAccountsMap = new HashMap<GlobalBusinessObjectDetailBase, List<IndirectCostRecoveryAccount>>();
    List<AccountGlobalDetail> accountGlobalDetails = getAccountGlobalDetails();
    if (ObjectUtils.isNotNull(accountGlobalDetails) && !accountGlobalDetails.isEmpty()) {
        for (GlobalBusinessObjectDetailBase globalDetail : accountGlobalDetails) {
            AccountGlobalDetail accountGlobalDetail = (AccountGlobalDetail) globalDetail;
            accountGlobalDetail.refreshReferenceObject(KFSPropertyConstants.ACCOUNT);
            List<IndirectCostRecoveryAccount> icrAccounts = accountGlobalDetail.getAccount().getIndirectCostRecoveryAccounts();
            globalObjectDetailsAndIcrAccountsMap.put(globalDetail, icrAccounts);
        }
    }
    return globalObjectDetailsAndIcrAccountsMap;
}
Also used : HashMap(java.util.HashMap) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) ArrayList(java.util.ArrayList) List(java.util.List) GlobalBusinessObjectDetailBase(org.kuali.kfs.krad.bo.GlobalBusinessObjectDetailBase) AccountGlobalDetail(org.kuali.kfs.coa.businessobject.AccountGlobalDetail)

Example 15 with AccountGlobalDetail

use of org.kuali.kfs.coa.businessobject.AccountGlobalDetail in project cu-kfs by CU-CommunityApps.

the class AccountGlobalRule method checkCgRequiredFields.

/**
 * This method checks to make sure that if the contracts and grants fields are required they are entered correctly
 *
 * @param newAccount
 * @return
 */
protected boolean checkCgRequiredFields(CuAccountGlobal newAccount) {
    boolean result = true;
    if (ObjectUtils.isNotNull(newAccount.getSubFundGroup())) {
        if (getSubFundGroupService().isForContractsAndGrants(newAccount.getSubFundGroup())) {
            result &= checkIcrTypeCodeAndSeriesIdentifierExistWhenSubFundIsCG(newAccount);
            result &= checkContractControlAccountNumberRequired(newAccount);
            result &= checkICRCollectionExistsWhenUpdatingToCGSubFund(newAccount, newAccount.getSubFundGroupCode());
        } else {
            result &= checkCGFieldNotFilledIn(newAccount, KFSPropertyConstants.FINANCIAL_ICR_SERIES_IDENTIFIER, newAccount.getSubFundGroupCode());
            result &= checkCGFieldNotFilledIn(newAccount, KFSPropertyConstants.ACCT_INDIRECT_COST_RCVY_TYPE_CD, newAccount.getSubFundGroupCode());
            result &= checkICRCollectionDoesNotExistWhenUpdatingToNonCGSubFund(newAccount, newAccount.getSubFundGroupCode());
        }
    } else {
        if (ObjectUtils.isNotNull(newAccount.getAccountGlobalDetails()) && newAccount.getAccountGlobalDetails().size() > 0) {
            boolean hasAtLeastOneAccountWithCGSubFund = false;
            for (AccountGlobalDetail accountGlobalDetail : newAccount.getAccountGlobalDetails()) {
                accountGlobalDetail.refreshReferenceObject(KFSPropertyConstants.ACCOUNT);
                if (ObjectUtils.isNotNull(accountGlobalDetail.getAccount().getSubFundGroup())) {
                    if (!getSubFundGroupService().isForContractsAndGrants(accountGlobalDetail.getAccount().getSubFundGroup())) {
                        result &= checkCGFieldNotFilledIn(newAccount, KFSPropertyConstants.FINANCIAL_ICR_SERIES_IDENTIFIER, accountGlobalDetail.getAccount().getSubFundGroupCode());
                        result &= checkCGFieldNotFilledIn(newAccount, KFSPropertyConstants.ACCT_INDIRECT_COST_RCVY_TYPE_CD, accountGlobalDetail.getAccount().getSubFundGroupCode());
                        result &= checkCGFieldNotFilledIn(newAccount, accountGlobalDetail.getAccount(), KFSPropertyConstants.ACCT_INDIRECT_COST_RCVY_TYPE_CD);
                        result &= checkCGFieldNotFilledIn(newAccount, accountGlobalDetail.getAccount(), KFSPropertyConstants.FINANCIAL_ICR_SERIES_IDENTIFIER);
                        result &= checkICRCollectionDoesNotExistForExistingNonCGSubFund(newAccount, accountGlobalDetail, accountGlobalDetail.getAccount().getSubFundGroupCode());
                    } else {
                        result &= checkICRCollectionExistsForExistingCGSubFund(newAccount, accountGlobalDetail, accountGlobalDetail.getAccount().getSubFundGroupCode());
                        hasAtLeastOneAccountWithCGSubFund = true;
                    }
                }
            }
            if (hasAtLeastOneAccountWithCGSubFund && icrTypeCodeOrSeriesIdentifierAreSet(newAccount)) {
                result &= checkIcrTypeCodeAndSeriesIdentifierExistWhenSubFundIsCG(newAccount);
            }
        }
    }
    return result;
}
Also used : AccountGlobalDetail(org.kuali.kfs.coa.businessobject.AccountGlobalDetail)

Aggregations

AccountGlobalDetail (org.kuali.kfs.coa.businessobject.AccountGlobalDetail)25 IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount)8 CuAccountGlobal (edu.cornell.kfs.coa.businessobject.CuAccountGlobal)6 Test (org.junit.Test)5 SubAccountGlobalDetail (edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail)4 IndirectCostRecoveryAccountChange (edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange)3 HashMap (java.util.HashMap)3 Date (java.sql.Date)2 ArrayList (java.util.ArrayList)2 Account (org.kuali.kfs.coa.businessobject.Account)2 AccountGlobal (org.kuali.kfs.coa.businessobject.AccountGlobal)2 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)2 GlobalObjectWithIndirectCostRecoveryAccounts (edu.cornell.kfs.coa.businessobject.GlobalObjectWithIndirectCostRecoveryAccounts)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 AccountDelegate (org.kuali.kfs.coa.businessobject.AccountDelegate)1 AccountDelegateGlobalDetail (org.kuali.kfs.coa.businessobject.AccountDelegateGlobalDetail)1 IndirectCostRecoveryRateDetail (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryRateDetail)1 OrganizationService (org.kuali.kfs.coa.service.OrganizationService)1