use of org.estatio.module.lease.dom.LeaseItemType in project estatio by estatio.
the class BudgetAssignmentService_Test method findOrCreateLeaseItemForServiceChargeBudgeted_returns_active_item_when_found.
@Test
public void findOrCreateLeaseItemForServiceChargeBudgeted_returns_active_item_when_found() throws Exception {
// given
LeaseItem itemToBeFound = new LeaseItem();
Lease lease = new Lease() {
@Override
public LeaseItem findFirstActiveItemOfTypeAndChargeOnDate(final LeaseItemType leaseItemType, final Charge charge, final LocalDate date) {
return itemToBeFound;
}
};
BudgetCalculationResult budgetCalculationResult = new BudgetCalculationResult();
LocalDate termStartDate = new LocalDate(2018, 1, 1);
// when
LeaseItem itemFound = budgetAssignmentService.findOrCreateLeaseItemForServiceChargeBudgeted(lease, budgetCalculationResult, termStartDate);
// then
assertThat(itemFound).isEqualTo(itemToBeFound);
}
use of org.estatio.module.lease.dom.LeaseItemType 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.LeaseItemType 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.LeaseItemType in project estatio by estatio.
the class LeaseTermForServiceChargeBudgetAuditManager_Test method TypesToStringTest.
@Test
public void TypesToStringTest() {
// given
LeaseTermForServiceChargeBudgetAuditManager manager = new LeaseTermForServiceChargeBudgetAuditManager();
// when
List<LeaseItemType> listToConvert = Arrays.asList(LeaseItemType.SERVICE_CHARGE, LeaseItemType.MARKETING, LeaseItemType.PROPERTY_TAX);
String result = manager.typesToString(listToConvert);
// then
assertThat(result).isEqualTo("SERVICE_CHARGE, MARKETING, PROPERTY_TAX");
// and when
listToConvert = Arrays.asList(LeaseItemType.SERVICE_CHARGE);
result = manager.typesToString(listToConvert);
// then
assertThat(result).isEqualTo("SERVICE_CHARGE");
}
use of org.estatio.module.lease.dom.LeaseItemType in project estatio by estatio.
the class LeaseTermForServiceChargeBudgetAuditManager_Test method TypesFromStringTest.
@Test
public void TypesFromStringTest() {
// given
LeaseTermForServiceChargeBudgetAuditManager manager = new LeaseTermForServiceChargeBudgetAuditManager();
// when
String stringToConvert = "SERVICE_CHARGE, MARKETING, PROPERTY_TAX";
List<LeaseItemType> result = manager.typesFromString(stringToConvert);
// then
assertThat(result.size()).isEqualTo(3);
assertThat(result.get(0)).isEqualTo(LeaseItemType.SERVICE_CHARGE);
// and when
stringToConvert = "MARKETING";
result = manager.typesFromString(stringToConvert);
// then
assertThat(result.size()).isEqualTo(1);
assertThat(result.get(0)).isEqualTo(LeaseItemType.MARKETING);
}
Aggregations