/** * @see * org.kuali.rice.krad.bo.AccountingLineParserBase#performCustomSourceAccountingLinePopulation(java.util.Map, * org.kuali.rice.krad.bo.SourceAccountingLine, java.lang.String) */ @Override protected void performCustomSourceAccountingLinePopulation( Map<String, String> attributeValueMap, SourceAccountingLine sourceAccountingLine, String accountingLineAsString) { // chose debit/credit String debitValue = attributeValueMap.remove(DEBIT); String creditValue = attributeValueMap.remove(CREDIT); KualiDecimal debitAmount = null; try { if (StringUtils.isNotBlank(debitValue)) { debitAmount = new KualiDecimal(debitValue); } } catch (NumberFormatException e) { String[] errorParameters = { debitValue, retrieveAttributeLabel(sourceAccountingLine.getClass(), DEBIT), accountingLineAsString }; throw new AccountingLineParserException( "invalid (NaN) '" + DEBIT + "=" + debitValue + " for " + accountingLineAsString, ERROR_INVALID_PROPERTY_VALUE, errorParameters); } KualiDecimal creditAmount = null; try { if (StringUtils.isNotBlank(creditValue)) { creditAmount = new KualiDecimal(creditValue); } } catch (NumberFormatException e) { String[] errorParameters = { creditValue, retrieveAttributeLabel(sourceAccountingLine.getClass(), CREDIT), accountingLineAsString }; throw new AccountingLineParserException( "invalid (NaN) '" + CREDIT + "=" + creditValue + " for " + accountingLineAsString, ERROR_INVALID_PROPERTY_VALUE, errorParameters); } KualiDecimal amount = null; String debitCreditCode = null; if (debitAmount != null && debitAmount.isNonZero()) { amount = debitAmount; debitCreditCode = KFSConstants.GL_DEBIT_CODE; } if (creditAmount != null && creditAmount.isNonZero()) { amount = creditAmount; debitCreditCode = KFSConstants.GL_CREDIT_CODE; } sourceAccountingLine.setAmount(amount); sourceAccountingLine.setDebitCreditCode(debitCreditCode); boolean isFinancialOffsetGeneration = SpringContext.getBean(BalanceTypeService.class) .getBalanceTypeByCode(balanceTypeCode) .isFinancialOffsetGenerationIndicator(); if (isFinancialOffsetGeneration || StringUtils.equals(balanceTypeCode, KFSConstants.BALANCE_TYPE_EXTERNAL_ENCUMBRANCE)) { super.performCustomSourceAccountingLinePopulation( attributeValueMap, sourceAccountingLine, accountingLineAsString); } sourceAccountingLine.setBalanceTypeCode(balanceTypeCode); }