if (credits != null && credits.length > 0) {
allowedCreditGLAccounts = this.glAccountReadPlatformService.retrieveAccountsByTagId(accountingRule.getId(),
JournalEntryType.CREDIT.getValue());
for (final GLAccountDataForLookup accountDataForLookup : allowedCreditGLAccounts) {
for (int i = 0; i < credits.length; i++) {
final SingleDebitOrCreditEntryCommand credit = credits[i];
if (credit.getGlAccountId().equals(accountDataForLookup.getId())) {
validCredits[i] = credit;
}
}
}
if (credits.length != validCredits.length) { throw new RuntimeException("Invalid credits"); }
}
if (debits != null && debits.length > 0) {
allowedDebitGLAccounts = this.glAccountReadPlatformService.retrieveAccountsByTagId(accountingRule.getId(),
JournalEntryType.DEBIT.getValue());
for (final GLAccountDataForLookup accountDataForLookup : allowedDebitGLAccounts) {
for (int i = 0; i < debits.length; i++) {
final SingleDebitOrCreditEntryCommand debit = debits[i];
if (debit.getGlAccountId().equals(accountDataForLookup.getId())) {
validDebits[i] = debit;
}
}
}
if (debits.length != validDebits.length) { throw new RuntimeException("Invalid debits"); }