Search in sources :

Example 1 with SubAccountGlobalDetail

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

the class GlobalIndirectCostRecoveryAccountsRuleTest method testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdateTwoSameAccounts_Pass.

@Test
public void testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdateTwoSameAccounts_Pass() {
    LOG.debug("enter testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdateTwoSameAccounts_Pass");
    SubAccountGlobal subAccountGlobal = (SubAccountGlobal) SubAccountGlobalFixture.SUB_ACCT_GLOBAL_1111111_2222222_3333333_98_2_ACTIVE_100_INACTIVE.getSubAccountGlobal();
    SubAccountGlobalDetail subAccountGlobalDetail = SubAccountGlobalDetailFixture.SUB_ACCOUNT_GLOBAL_DETAIL_1111111_98_INACTIVE_98_INACTIVE_3333333_100_PERCENT_ACTIVE.getSubAccountGlobalDetail();
    List<IndirectCostRecoveryAccount> existingIcrAccountsOnDetail = new ArrayList<IndirectCostRecoveryAccount>();
    existingIcrAccountsOnDetail.addAll(subAccountGlobalDetail.getSubAccount().getA21SubAccount().getA21IndirectCostRecoveryAccounts());
    LOG.debug("updates");
    List<IndirectCostRecoveryAccountChange> updates = subAccountGlobal.getIndirectCostRecoveryAccounts();
    logDetailsForIcrAccountChanges(updates);
    LOG.debug("existing");
    logDetailsForIcrAccounts(existingIcrAccountsOnDetail);
    boolean result = globalIndirectCostRecoveryAccountsRule.checkICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate(updates, existingIcrAccountsOnDetail, subAccountGlobalDetail, subAccountGlobal);
    assertTrue("Updated Sub Account Global ICR account distribution should have been 100%", result);
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) IndirectCostRecoveryAccountChange(edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 2 with SubAccountGlobalDetail

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

the class GlobalIndirectCostRecoveryAccountsRuleTest method testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Pass.

@Test
public void testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Pass() {
    LOG.debug("enter testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Pass");
    SubAccountGlobal subAccountGlobal = (SubAccountGlobal) SubAccountGlobalFixture.SUB_ACCT_GLOBAL_3333333_100_ACTIVE_1111111_2222222_98_2_INACTIVE.getSubAccountGlobal();
    SubAccountGlobalDetail subAccountGlobalDetail = SubAccountGlobalDetailFixture.SUB_ACCOUNT_GLOBAL_DETAIL_1111111_2222222_98_2.getSubAccountGlobalDetail();
    List<IndirectCostRecoveryAccount> existingIcrAccountsOnDetail = new ArrayList<IndirectCostRecoveryAccount>();
    existingIcrAccountsOnDetail.addAll(subAccountGlobalDetail.getSubAccount().getA21SubAccount().getA21IndirectCostRecoveryAccounts());
    LOG.debug("updates");
    List<IndirectCostRecoveryAccountChange> updates = subAccountGlobal.getIndirectCostRecoveryAccounts();
    logDetailsForIcrAccountChanges(updates);
    LOG.debug("existing");
    logDetailsForIcrAccounts(existingIcrAccountsOnDetail);
    boolean result = globalIndirectCostRecoveryAccountsRule.checkICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate(updates, existingIcrAccountsOnDetail, subAccountGlobalDetail, subAccountGlobal);
    assertTrue("Updated Sub Account Global ICR account distribution should have been 100%", result);
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) IndirectCostRecoveryAccountChange(edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 3 with SubAccountGlobalDetail

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

the class SubAccountGlobalMaintainableImpl method generateMaintenanceLocks.

/**
 * This creates the particular locking representation for this global document.
 *
 * @see org.kuali.kfs.kns.maintenance.Maintainable#generateMaintenanceLocks()
 */
@Override
public List<MaintenanceLock> generateMaintenanceLocks() {
    SubAccountGlobal subAccountGlobal = (SubAccountGlobal) getBusinessObject();
    List<MaintenanceLock> maintenanceLocks = new ArrayList();
    for (SubAccountGlobalDetail detail : subAccountGlobal.getSubAccountGlobalDetails()) {
        MaintenanceLock maintenanceLock = new MaintenanceLock();
        StringBuffer lockrep = new StringBuffer();
        lockrep.append(Account.class.getName() + KFSConstants.Maintenance.AFTER_CLASS_DELIM);
        lockrep.append(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
        lockrep.append(detail.getChartOfAccountsCode() + KFSConstants.Maintenance.AFTER_VALUE_DELIM);
        lockrep.append(KFSPropertyConstants.ACCOUNT_NUMBER + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
        lockrep.append(detail.getAccountNumber());
        lockrep.append(KFSPropertyConstants.SUB_ACCOUNT_NUMBER + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
        lockrep.append(detail.getSubAccountNumber());
        maintenanceLock.setDocumentNumber(subAccountGlobal.getDocumentNumber());
        maintenanceLock.setLockingRepresentation(lockrep.toString());
        maintenanceLocks.add(maintenanceLock);
    }
    return maintenanceLocks;
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail) ArrayList(java.util.ArrayList) MaintenanceLock(org.kuali.kfs.krad.maintenance.MaintenanceLock)

Example 4 with SubAccountGlobalDetail

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

the class SubAccountGlobalMaintainableImpl method isSubAccountTypeCodeCostShare.

/**
 * @return true when code is CS; otherwise return false
 */
private boolean isSubAccountTypeCodeCostShare() {
    boolean retval = false;
    SubAccountGlobal subAccountGlobal = (SubAccountGlobal) getBusinessObject();
    for (SubAccountGlobalDetail detail : subAccountGlobal.getSubAccountGlobalDetails()) {
        detail.refreshReferenceObject(KFSPropertyConstants.SUB_ACCOUNT);
        SubAccount subAccount = detail.getSubAccount();
        if (subAccount.getA21SubAccount().getSubAccountTypeCode().equals(KFSConstants.SubAccountType.COST_SHARE)) {
            retval = true;
            subAccount.refreshReferenceObject(KFSPropertyConstants.ACCOUNT);
            break;
        }
    }
    return retval;
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail) SubAccount(org.kuali.kfs.coa.businessobject.SubAccount)

Example 5 with SubAccountGlobalDetail

use of edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail 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)

Aggregations

SubAccountGlobalDetail (edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail)9 SubAccountGlobal (edu.cornell.kfs.coa.businessobject.SubAccountGlobal)7 ArrayList (java.util.ArrayList)4 IndirectCostRecoveryAccountChange (edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange)3 Test (org.junit.Test)3 IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount)3 AccountGlobalDetail (org.kuali.kfs.coa.businessobject.AccountGlobalDetail)1 SubAccount (org.kuali.kfs.coa.businessobject.SubAccount)1 MaintenanceLock (org.kuali.kfs.krad.maintenance.MaintenanceLock)1