use of org.kuali.kfs.coa.businessobject.Account in project cu-kfs by CU-CommunityApps.
the class AccountGlobalSearchDaoOjb method getAccountsByOrgHierarchy.
public Collection getAccountsByOrgHierarchy(String chartOfAccountsCode, String organizationCode, Map<String, String> parameters) {
Criteria criteria = new Criteria();
Criteria orgCriteria = new Criteria();
orgCriteria.addEqualTo(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, chartOfAccountsCode);
orgCriteria.addEqualTo(KFSPropertyConstants.ORGANIZATION_CODE, organizationCode);
criteria.addOrCriteria(orgCriteria);
List<Organization> reportingOrgs = getReportingOrgs(chartOfAccountsCode, organizationCode, new HashSet<Organization>());
for (Organization reportingOrg : reportingOrgs) {
orgCriteria = new Criteria();
orgCriteria.addEqualTo(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, reportingOrg.getChartOfAccountsCode());
orgCriteria.addEqualTo(KFSPropertyConstants.ORGANIZATION_CODE, reportingOrg.getOrganizationCode());
criteria.addOrCriteria(orgCriteria);
}
// Add the rest of the criteria for the lookup
parameters.remove(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE);
parameters.remove(KFSPropertyConstants.ORGANIZATION_CODE);
criteria.addAndCriteria(lookupDao.getCollectionCriteriaFromMap(new Account(), parameters));
return getPersistenceBrokerTemplate().getCollectionByQuery(QueryFactory.newQuery(Account.class, criteria));
}
use of org.kuali.kfs.coa.businessobject.Account in project cu-kfs by CU-CommunityApps.
the class AmazonWebServicesBillingServiceImpl method buildFromAccountLine.
private SourceAccountingLine buildFromAccountLine(String diDocumentNumber, KualiDecimal amount) {
SourceAccountingLine line = new SourceAccountingLine();
Account fromAccount = findAccountFromAccountNumber(getTransactionFromAccountNumber());
line.setDocumentNumber(diDocumentNumber);
line.setAccountNumber(fromAccount.getAccountNumber());
line.setChartOfAccountsCode(fromAccount.getChartOfAccountsCode());
line.setFinancialObjectCode(getTransactionObjectCode());
line.setAmount(amount);
line.setFinancialDocumentLineDescription(buildAccountingLineDescription());
line.setSequenceNumber(new Integer(1));
return line;
}
use of org.kuali.kfs.coa.businessobject.Account in project cu-kfs by CU-CommunityApps.
the class AmazonWebServicesBillingServiceImpl method updateTransactionDTOChartAccountSubAccount.
private void updateTransactionDTOChartAccountSubAccount(AmazonBillingDistributionOfIncomeTransactionDTO transactionDTO, AmazonBillingCostCenterDTO costCenterDTO, String amazonDetailKFSAccount) {
Account account = retrieveAccount(costCenterDTO.getAccountNumber(), amazonDetailKFSAccount);
if (validAccount(account)) {
transactionDTO.setAccountNumber(account.getAccountNumber());
updateTansactionDTOChart(transactionDTO, costCenterDTO, account);
updateTransactionDTOSubAccount(transactionDTO, costCenterDTO, account);
} else {
LOG.info("updateTransactionDTOChartAccountSubAccount() Invalid account.");
transactionDTO.setTransactionInputError(true);
}
}
use of org.kuali.kfs.coa.businessobject.Account in project cu-kfs by CU-CommunityApps.
the class CuPosterServiceImpl method getAccountWithPotentialContinuation.
/**
* Overridden so that the errors list will not be updated when a continuation account gets used,
* thus allowing the ICR continuation to be processed properly by the Poster.
*
* @see org.kuali.kfs.gl.batch.service.impl.PosterServiceImpl#getAccountWithPotentialContinuation(
* org.kuali.kfs.gl.businessobject.Transaction, java.util.List)
*/
@Override
protected Account getAccountWithPotentialContinuation(Transaction tran, List<Message> errors) {
Account account = accountingCycleCachingService.getAccount(tran.getChartOfAccountsCode(), tran.getAccountNumber());
if (ObjectUtils.isNotNull(account) && account.isClosed()) {
Account contAccount = account;
for (int i = 0; i < CONTINUATION_ACCOUNT_DEPTH_LIMIT && ObjectUtils.isNotNull(contAccount) && contAccount.isClosed(); i++) {
contAccount = accountingCycleCachingService.getAccount(contAccount.getContinuationFinChrtOfAcctCd(), contAccount.getContinuationAccountNumber());
}
if (ObjectUtils.isNull(contAccount) || contAccount == account || contAccount.isClosed()) {
errors.add(new Message(MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_ICRACCOUNT_CONTINUATION_ACCOUNT_CLOSED), tran.getChartOfAccountsCode(), tran.getAccountNumber(), CONTINUATION_ACCOUNT_DEPTH_LIMIT), Message.TYPE_WARNING));
} else {
final String formattedErrorMessage = MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.WARNING_ICRACCOUNT_CONTINUATION_ACCOUNT_USED), tran.getChartOfAccountsCode(), tran.getAccountNumber(), contAccount.getChartOfAccountsCode(), contAccount.getAccountNumber());
LOG.warn(formattedErrorMessage);
account = contAccount;
((OriginEntryInformation) tran).setChartOfAccountsCode(contAccount.getChartOfAccountsCode());
((OriginEntryInformation) tran).setAccountNumber(contAccount.getAccountNumber());
}
}
return account;
}
use of org.kuali.kfs.coa.businessobject.Account in project cu-kfs by CU-CommunityApps.
the class AwsAccountingXmlDocumentAccountingLineServiceImplTest method buildMockAccountService.
private AccountService buildMockAccountService() {
AccountService accountService = mock(AccountService.class);
Account mockedAccount = createMockAccount(AwsAccountFixture.ACCOUNT_1658328);
when(accountService.getByPrimaryId(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_ACCOUNT_NUMBER_1658328)).thenReturn(mockedAccount);
when(accountService.getByPrimaryId(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_ACCOUNT_NUMBER_165833X)).thenReturn(null);
mockedAccount = createMockAccount(AwsAccountFixture.ACCOUNT_R583805);
when(accountService.getByPrimaryId(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_ACCOUNT_NUMBER_R583805)).thenReturn(mockedAccount);
mockedAccount = createMockAccount(AwsAccountFixture.ACCOUNT_R589966);
when(accountService.getByPrimaryId(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_ACCOUNT_NUMBER_R589966)).thenReturn(mockedAccount);
mockedAccount = createMockAccount(AwsAccountFixture.ACCOUNT_R589966);
when(accountService.getByPrimaryId(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_ACCOUNT_NUMBER_1023715)).thenReturn(mockedAccount);
mockedAccount = createMockAccount(AwsAccountFixture.ACCOUNT_CS_J801000);
when(accountService.getByPrimaryId(CuFPTestConstants.TEST_AWS_BILLING_CHART_CODE_CS, CuFPTestConstants.TEST_ACCOUNT_NUMBER_J801000)).thenReturn(mockedAccount);
when(accountService.getByPrimaryId(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_ACCOUNT_NUMBER_J80100X)).thenReturn(null);
when(accountService.getByPrimaryId(CuFPTestConstants.TEST_AWS_BILLING_DEFAULT_CHART_CODE, CuFPTestConstants.TEST_INVALID_STAR_ACCOUNT_STRING)).thenReturn(null);
return accountService;
}
Aggregations