if (associationParametersData.isRunningBalanceRequired()) {
officeRunningBalance = rs.getBigDecimal("officeRunningBalance");
organizationRunningBalance = rs.getBigDecimal("organizationRunningBalance");
runningBalanceComputed = rs.getBoolean("runningBalanceComputed");
}
TransactionDetailData transactionDetailData = null;
if (associationParametersData.isTransactionDetailsRequired()) {
PaymentDetailData paymentDetailData = null;
final Long paymentTypeId = JdbcSupport.getLong(rs, "paymentTypeId");
if (paymentTypeId != null) {
final String typeName = rs.getString("paymentTypeName");
final CodeValueData paymentType = CodeValueData.instance(paymentTypeId, typeName);
final String accountNumber = rs.getString("accountNumber");
final String checkNumber = rs.getString("checkNumber");
final String routingCode = rs.getString("routingCode");
final String receiptNumber = rs.getString("receiptNumber");
final String bankNumber = rs.getString("bankNumber");
paymentDetailData = new PaymentDetailData(id, paymentType, accountNumber, checkNumber, routingCode, receiptNumber,
bankNumber);
}
NoteData noteData = null;
final Long noteId = JdbcSupport.getLong(rs, "noteId");
if (noteId != null) {
final String note = rs.getString("transactionNote");
noteData = new NoteData(noteId, null, null, null, null, null, null, null, note, null, null, null, null, null, null);
}
Long transaction = null;
if (entityType != null) {
transaction = Long.parseLong(transactionId.substring(1).trim());
}
TransactionTypeEnumData transactionTypeEnumData = null;
if (PortfolioAccountType.fromInt(entityTypeId).isLoanAccount()) {
final LoanTransactionEnumData loanTransactionType = LoanEnumerations.transactionType(JdbcSupport.getInteger(rs,
"loanTransactionType"));
transactionTypeEnumData = new TransactionTypeEnumData(loanTransactionType.id(), loanTransactionType.getCode(),
loanTransactionType.getValue());
} else if (PortfolioAccountType.fromInt(entityTypeId).isSavingsAccount()) {
final SavingsAccountTransactionEnumData savingsTransactionType = SavingsEnumerations.transactionType(JdbcSupport
.getInteger(rs, "savingsTransactionType"));
transactionTypeEnumData = new TransactionTypeEnumData(savingsTransactionType.getId(), savingsTransactionType.getCode(),
savingsTransactionType.getValue());
}
transactionDetailData = new TransactionDetailData(transaction, paymentDetailData, noteData, transactionTypeEnumData);
}
return new JournalEntryData(id, officeId, officeName, glAccountName, glAccountId, glCode, accountType, transactionDate,
entryType, amount, transactionId, manualEntry, entityType, entityId, createdByUserId, createdDate, createdByUserName,
comments, reversed, referenceNumber, officeRunningBalance, organizationRunningBalance, runningBalanceComputed,
transactionDetailData, currency);