Search in sources :

Example 1 with FinancialAccountTransaction

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);
}
Also used : Lease(org.estatio.module.lease.dom.Lease) Guarantee(org.estatio.module.guarantee.dom.Guarantee) FinancialAccountTransaction(org.estatio.module.financial.dom.FinancialAccountTransaction) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 2 with FinancialAccountTransaction

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;
}
Also used : FinancialAccountTransaction(org.estatio.module.financial.dom.FinancialAccountTransaction)

Aggregations

FinancialAccountTransaction (org.estatio.module.financial.dom.FinancialAccountTransaction)2 Programmatic (org.apache.isis.applib.annotation.Programmatic)1 Guarantee (org.estatio.module.guarantee.dom.Guarantee)1 Lease (org.estatio.module.lease.dom.Lease)1