use of org.estatio.module.lease.dom.Lease in project estatio by estatio.
the class CommunicationChannelImport 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 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;
}
use of org.estatio.module.lease.dom.Lease in project estatio by estatio.
the class LeaseUpgradeService method upgradeLinkedItems.
public BigInteger upgradeLinkedItems() {
BigInteger numberOfItemsLinkedIfNotAlready = BigInteger.ZERO;
for (Lease lease : leaseRepository.allLeases()) {
for (LeaseItem depositItem : lease.findItemsOfType(LeaseItemType.DEPOSIT)) {
for (LeaseItem rentItem : lease.findItemsOfType(LeaseItemType.RENT)) {
depositItem.findOrCreateSourceItem(rentItem);
numberOfItemsLinkedIfNotAlready = numberOfItemsLinkedIfNotAlready.add(BigInteger.ONE);
}
}
for (LeaseItem trItem : lease.findItemsOfType(LeaseItemType.TURNOVER_RENT)) {
for (LeaseItem rentItem : lease.findItemsOfType(LeaseItemType.RENT)) {
trItem.findOrCreateSourceItem(rentItem);
numberOfItemsLinkedIfNotAlready = numberOfItemsLinkedIfNotAlready.add(BigInteger.ONE);
}
}
for (LeaseItem taxItem : lease.findItemsOfType(LeaseItemType.TAX)) {
for (LeaseItem rentItem : lease.findItemsOfType(LeaseItemType.RENT)) {
taxItem.findOrCreateSourceItem(rentItem);
numberOfItemsLinkedIfNotAlready = numberOfItemsLinkedIfNotAlready.add(BigInteger.ONE);
}
}
}
return numberOfItemsLinkedIfNotAlready;
}
use of org.estatio.module.lease.dom.Lease in project estatio by estatio.
the class BankMandateImport 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 BreakOptionImport method importData.
@Programmatic
@Override
public List<Object> importData(final Object previousRow) {
final Lease lease = fetchLease(leaseReference);
final BreakType breakTypeValue = BreakType.valueOf(breakType);
final BreakExerciseType breakExerciseTypeValue = BreakExerciseType.valueOf(breakExcerciseType);
if (notificationDate != null) {
final Period period = new Period(notificationDate, breakDate);
notificationPeriod = JodaPeriodUtils.asSimpleString(period);
}
BreakOption br = breakOptionRepository.findByLeaseAndTypeAndBreakDateAndExerciseType(lease, breakTypeValue, breakDate, breakExerciseTypeValue);
if (br == null) {
breakOptionRepository.newBreakOption(lease, breakDate, notificationPeriod, breakTypeValue, breakExerciseTypeValue, description);
}
return Lists.newArrayList();
}
Aggregations