use of org.estatio.module.financial.dom.FinancialAccountTransaction in project estatio by estatio.
the class GuaranteeImport method importData.
@Programmatic
@Override
public List<Object> importData(final Object previousRow) {
counter++;
if (counter == 1) {
System.out.println();
LOG.info("importing");
}
if (amount == null) {
amount = BigDecimal.ZERO;
}
Guarantee guarantee = guaranteeRepository.findByReference(reference);
if (guarantee == null) {
final Lease lease = fetchLease(leaseReference);
guarantee = guaranteeRepository.newGuarantee(lease, reference, name, guaranteeType, startDate, endDate, description, maximumAmount, null);
}
guarantee.setTerminationDate(terminationDate);
guarantee.setDescription(description);
guarantee.setComments(comments);
FinancialAccountTransaction transaction = financialAccountTransactionRepository.findTransaction(guarantee.getFinancialAccount(), transactionDate);
if (transaction == null && ObjectUtils.compare(amount, BigDecimal.ZERO) > 0 && guarantee.getFinancialAccount() != null) {
transaction = financialAccountTransactionRepository.newTransaction(guarantee.getFinancialAccount(), transactionDate, transactionDescription, amount);
}
// LOG.info("guarantee " + counter + " : " + guarantee.getReference() + " - " + guarantee.getLease().getReference());
System.out.print(".");
return Lists.newArrayList(guarantee);
}
use of org.estatio.module.financial.dom.FinancialAccountTransaction in project estatio by estatio.
the class FinancialAccountTransactionBuilder method execute.
@Override
protected void execute(final ExecutionContext ec) {
defaultParam("financialAccount", ec, 0);
checkParam("date", ec, LocalDate.class);
checkParam("amount", ec, BigDecimal.class);
defaultParam("description", ec, "Fixture transaction");
FinancialAccountTransaction financialAccountTransaction = financialAccountTransactionRepository.newTransaction(financialAccount, date, description, amount);
ec.addResult(this, financialAccountTransaction);
object = financialAccountTransaction;
}
Aggregations