Search in sources :

Example 6 with LeaseItem

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;
}
Also used : LeaseTermForIndexable(org.estatio.module.lease.dom.LeaseTermForIndexable) LeaseItem(org.estatio.module.lease.dom.LeaseItem)

Example 7 with 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);
}
Also used : LocalDate(org.joda.time.LocalDate) LeaseItem(org.estatio.module.lease.dom.LeaseItem) Test(org.junit.Test)

Example 8 with LeaseItem

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);
}
Also used : LeaseTermForTurnoverRent(org.estatio.module.lease.dom.LeaseTermForTurnoverRent) LeaseItem(org.estatio.module.lease.dom.LeaseItem) LeaseTerm(org.estatio.module.lease.dom.LeaseTerm) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 9 with LeaseItem

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;
}
Also used : Lease(org.estatio.module.lease.dom.Lease) Charge(org.estatio.module.charge.dom.Charge) LeaseItemStatus(org.estatio.module.lease.dom.LeaseItemStatus) LeaseItemType(org.estatio.module.lease.dom.LeaseItemType) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy) LeaseItem(org.estatio.module.lease.dom.LeaseItem)

Example 10 with LeaseItem

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;
}
Also used : Lease(org.estatio.module.lease.dom.Lease) Charge(org.estatio.module.charge.dom.Charge) LeaseItemType(org.estatio.module.lease.dom.LeaseItemType) LocalDate(org.joda.time.LocalDate) LeaseItem(org.estatio.module.lease.dom.LeaseItem) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Aggregations

LeaseItem (org.estatio.module.lease.dom.LeaseItem)35 ChargeGroup (org.estatio.module.charge.dom.ChargeGroup)10 ChargeGroup_enum (org.estatio.module.charge.fixtures.chargegroups.enums.ChargeGroup_enum)10 Lease (org.estatio.module.lease.dom.Lease)10 Programmatic (org.apache.isis.applib.annotation.Programmatic)7 Charge (org.estatio.module.charge.dom.Charge)6 LeaseTerm (org.estatio.module.lease.dom.LeaseTerm)6 LocalDate (org.joda.time.LocalDate)6 LeaseItemType (org.estatio.module.lease.dom.LeaseItemType)5 Test (org.junit.Test)5 LeaseTermForIndexable (org.estatio.module.lease.dom.LeaseTermForIndexable)4 LeaseTermForServiceCharge (org.estatio.module.lease.dom.LeaseTermForServiceCharge)4 ApplicationTenancy (org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)4 BudgetCalculationResult (org.estatio.module.budgetassignment.dom.calculationresult.BudgetCalculationResult)3 LeaseItemStatus (org.estatio.module.lease.dom.LeaseItemStatus)3 LeaseTermForDeposit (org.estatio.module.lease.dom.LeaseTermForDeposit)3 LeaseTermForFixed (org.estatio.module.lease.dom.LeaseTermForFixed)3 LeaseTermForTurnoverRent (org.estatio.module.lease.dom.LeaseTermForTurnoverRent)2 LocalDateInterval (org.incode.module.base.dom.valuetypes.LocalDateInterval)2 Expectations (org.jmock.Expectations)2