Search in sources :

Example 1 with Guarantee

use of org.estatio.module.guarantee.dom.Guarantee 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 Guarantee

use of org.estatio.module.guarantee.dom.Guarantee in project estatio by estatio.

the class GuaranteeBuilder method execute.

@Override
protected void execute(ExecutionContext ec) {
    checkParam("lease", ec, Lease.class);
    checkParam("reference", ec, String.class);
    defaultParam("name", ec, getReference());
    checkParam("guaranteeType", ec, GuaranteeType.class);
    checkParam("startDate", ec, LocalDate.class);
    checkParam("endDate", ec, LocalDate.class);
    checkParam("description", ec, String.class);
    checkParam("contractualAmount", ec, BigDecimal.class);
    final Guarantee guarantee = guaranteeRepository.newGuarantee(lease, reference, name, guaranteeType, startDate, endDate, description, contractualAmount, startAmount);
    ec.addResult(this, guarantee);
    object = guarantee;
    final AgreementRoleType bankRoleType = agreementRoleTypeRepository.find(GuaranteeAgreementRoleTypeEnum.BANK);
    this.bankRole = guarantee.createRole(bankRoleType, bank, bankRoleStartDate, bankRoleEndDate);
}
Also used : AgreementRoleType(org.estatio.module.agreement.dom.role.AgreementRoleType) Guarantee(org.estatio.module.guarantee.dom.Guarantee)

Aggregations

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