use of org.estatio.module.lease.dom.Lease in project estatio by estatio.
the class BreakOptionImport method fetchLease.
private Lease fetchLease(final String leaseReference) {
final Lease lease;
lease = leaseRepository.findLeaseByReference(leaseReference.trim().replaceAll("~", "+"));
if (lease == null) {
throw new ApplicationException(String.format("Lease with reference %s not found.", leaseReference));
}
return lease;
}
use of org.estatio.module.lease.dom.Lease in project estatio by estatio.
the class GuaranteeImport method fetchLease.
private Lease fetchLease(final String leaseReference) {
final Lease lease;
lease = leaseRepository.findLeaseByReference(leaseReference.trim().replaceAll("~", "+"));
if (lease == null) {
throw new ApplicationException(String.format("Lease with reference %s not found.", leaseReference));
}
return lease;
}
use of org.estatio.module.lease.dom.Lease 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.lease.dom.Lease in project estatio by estatio.
the class InvoiceRepository_Test method setup.
@Before
public void setup() {
seller = new PartyForTesting();
buyer = new PartyForTesting();
paymentMethod = PaymentMethod.BANK_TRANSFER;
lease = new Lease() {
@Override
public Property getProperty() {
return null;
}
};
invoiceStatus = InvoiceStatus.APPROVED;
dueDate = new LocalDate(2013, 4, 1);
invoiceRepository = new InvoiceRepository() {
@Override
protected <T> T firstMatch(Query<T> query) {
finderInteraction = new FinderInteraction(query, FinderMethod.FIRST_MATCH);
return null;
}
@Override
protected List<Invoice> allInstances() {
finderInteraction = new FinderInteraction(null, FinderMethod.ALL_INSTANCES);
return null;
}
@Override
protected <T> List<T> allMatches(Query<T> query) {
finderInteraction = new FinderInteraction(query, FinderMethod.ALL_MATCHES);
return null;
}
};
invoiceForLeaseRepository = new InvoiceForLeaseRepository() {
@Override
protected <T> T firstMatch(Query<T> query) {
finderInteraction = new FinderInteraction(query, FinderMethod.FIRST_MATCH);
return null;
}
@Override
protected List<InvoiceForLease> allInstances() {
finderInteraction = new FinderInteraction(null, FinderMethod.ALL_INSTANCES);
return null;
}
@Override
protected <T> List<T> allMatches(Query<T> query) {
finderInteraction = new FinderInteraction(query, FinderMethod.ALL_MATCHES);
return null;
}
};
estatioNumeratorRepository = new NumeratorForCollectionRepository();
}
use of org.estatio.module.lease.dom.Lease in project estatio by estatio.
the class NumeratorCollectionRepository_Test method setup.
@Before
public void setup() {
seller = new PartyForTesting();
buyer = new PartyForTesting();
paymentMethod = PaymentMethod.BANK_TRANSFER;
lease = new Lease() {
@Override
public Property getProperty() {
return null;
}
};
invoiceStatus = InvoiceStatus.APPROVED;
dueDate = new LocalDate(2013, 4, 1);
invoiceRepository = new InvoiceRepository() {
@Override
protected <T> T firstMatch(Query<T> query) {
finderInteraction = new FinderInteraction(query, FinderInteraction.FinderMethod.FIRST_MATCH);
return null;
}
@Override
protected List<Invoice> allInstances() {
finderInteraction = new FinderInteraction(null, FinderInteraction.FinderMethod.ALL_INSTANCES);
return null;
}
@Override
protected <T> List<T> allMatches(Query<T> query) {
finderInteraction = new FinderInteraction(query, FinderInteraction.FinderMethod.ALL_MATCHES);
return null;
}
};
invoiceForLeaseRepository = new InvoiceForLeaseRepository() {
};
estatioNumeratorRepository = new NumeratorForCollectionRepository();
}
Aggregations