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);
}
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);
}
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;
}
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;
}
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();
}
Aggregations