use of org.estatio.module.lease.dom.LeaseItem in project estatio by estatio.
the class InvoiceCalculationForDeposit_IntegTest method setUpRentItem.
private LeaseItem setUpRentItem(final Lease lease, final LocalDate effectiveIndexationDate) {
LeaseItem leaseItem = wrap(lease).newItem(LeaseItemType.RENT, LeaseAgreementRoleTypeEnum.LANDLORD, chargeForRent, InvoicingFrequency.QUARTERLY_IN_ADVANCE, PaymentMethod.DIRECT_DEBIT, effectiveIndexationDate);
LeaseTermForIndexable rentTerm1 = (LeaseTermForIndexable) wrap(leaseItem).newTerm(startDateForItems, endOf2011);
wrap(rentTerm1).changeValues(VT.bd("10000.00"), null);
wrap(rentTerm1).changeParameters(IndexationMethod.LAST_KNOWN_INDEX, Index_enum.IStatFoi.findUsing(serviceRegistry), startOf2011, startOf2012, BigDecimal.ONE, effectiveIndexationDate);
return leaseItem;
}
use of org.estatio.module.lease.dom.LeaseItem in project estatio by estatio.
the class LeaseItemSourceRepository_IntegTest method findByItemTest.
@Test
public void findByItemTest() throws Exception {
// given
LeaseItem newDeposit = lease.newItem(LeaseItemType.DEPOSIT, LeaseAgreementRoleTypeEnum.LANDLORD, Charge_enum.GbDeposit.findUsing(serviceRegistry), InvoicingFrequency.QUARTERLY_IN_ADVANCE, PaymentMethod.DIRECT_DEBIT, new LocalDate(2016, 1, 1));
// when
newDeposit.newSourceItem(serviceChargeItem);
// then
Assertions.assertThat(leaseItemSourceRepository.findByItem(newDeposit).size()).isEqualTo(1);
}
use of org.estatio.module.lease.dom.LeaseItem in project estatio by estatio.
the class LeaseTermForTurnoverRentImport method importData.
@Programmatic
@Override
public List<Object> importData(Object previousRow) {
LeaseItem item = initLeaseItem();
// create term
LeaseTermForTurnoverRent term = (LeaseTermForTurnoverRent) item.findTermWithSequence(getSequence());
if (term == null) {
if (getStartDate() == null) {
throw new IllegalArgumentException("startDate cannot be empty");
}
if (getSequence().equals(BigInteger.ONE)) {
term = (LeaseTermForTurnoverRent) item.newTerm(getStartDate(), getEndDate());
} else {
final LeaseTerm previousTerm = item.findTermWithSequence(getSequence().subtract(BigInteger.ONE));
if (previousTerm == null) {
throw new IllegalArgumentException("Previous term not found");
}
term = (LeaseTermForTurnoverRent) previousTerm.createNext(getStartDate(), getEndDate());
}
term.setSequence(getSequence());
}
term.setStatus(LeaseTermStatus.valueOf(getStatus()));
// set turnover rent term values
term.setTurnoverRentRule(turnoverRentRule);
term.setAuditedTurnover(auditedTurnover);
term.setAuditedTurnoverRent(auditedTurnoverRent);
return Lists.newArrayList(term);
}
use of org.estatio.module.lease.dom.LeaseItem in project estatio by estatio.
the class LeaseTermImportAbstract method initLeaseItem.
protected LeaseItem initLeaseItem() {
// find or create leaseItem
final Lease lease = fetchLease(getLeaseReference());
final ApplicationTenancy leaseItemApplicationTenancy = ObjectUtils.firstNonNull(securityApplicationTenancyRepository.findByPath(getLeaseItemAtPath()), lease.getApplicationTenancy());
final Charge charge = fetchCharge(getItemChargeReference());
final LeaseItemType itemType = fetchLeaseItemType(getItemTypeName());
LeaseItem item = lease.findItem(itemType, getItemStartDate(), getItemSequence());
if (item == null) {
item = lease.newItem(itemType, LeaseAgreementRoleTypeEnum.LANDLORD, charge, InvoicingFrequency.valueOf(getItemInvoicingFrequency()), PaymentMethod.valueOf(getItemPaymentMethod()), getItemStartDate());
item.setSequence(getItemSequence());
}
item.setEpochDate(getItemEpochDate());
item.setNextDueDate(getItemNextDueDate());
final LeaseItemStatus leaseItemStatus = LeaseItemStatus.valueOfElse(getItemStatus(), LeaseItemStatus.ACTIVE);
item.setStatus(leaseItemStatus);
// Find source item and create source link
if (getSourceItemTypeName() != null) {
final LeaseItemType sourceItemType = LeaseItemType.valueOf(sourceItemTypeName);
LeaseItem sourceItem = item.getLease().findItem(sourceItemType, sourceItemStartDate, sourceItemSequence);
if (sourceItem != null) {
item.findOrCreateSourceItem(sourceItem);
}
}
return item;
}
use of org.estatio.module.lease.dom.LeaseItem in project estatio by estatio.
the class LeaseItemImport method importItem.
@Programmatic
public LeaseItem importItem(boolean updateExisting) {
final Lease lease = fetchLease(leaseReference);
final Charge charge = fetchCharge(chargeReference);
final LeaseItemType itemType = fetchLeaseItemType(itemTypeName);
// for deposit items the start date defaults to the start date of the lease
LocalDate startDateOrDefault;
if (itemType == LeaseItemType.DEPOSIT) {
startDateOrDefault = ObjectUtils.firstNonNull(startDate, lease.getStartDate());
} else {
startDateOrDefault = startDate;
}
LeaseItem item = lease.findItem(itemType, startDateOrDefault, sequence);
if (item == null) {
item = lease.newItem(itemType, LeaseAgreementRoleTypeEnum.LANDLORD, charge, InvoicingFrequency.valueOf(invoicingFrequency), PaymentMethod.valueOf(paymentMethod), startDateOrDefault);
item.setSequence(sequence);
}
if (updateExisting) {
item.setApplicationTenancyPath(atPath);
item.setEpochDate(epochDate);
item.setNextDueDate(nextDueDate);
item.setStatus(LeaseItemStatus.valueOfElse(status, LeaseItemStatus.ACTIVE));
}
return item;
}
Aggregations