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);
}
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);
}
Aggregations