Search in sources :

Example 1 with LeaseTermForIndexable

use of org.estatio.module.lease.dom.LeaseTermForIndexable 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 2 with LeaseTermForIndexable

use of org.estatio.module.lease.dom.LeaseTermForIndexable in project estatio by estatio.

the class LeaseItemForIndexableBuilder method execute.

@Override
protected void execute(final ExecutionContext ec) {
    defaultParam("charge", ec, Charge_enum.ItServiceChargeIndexable.findUsing(serviceRegistry));
    final ChargeGroup group = getCharge().getGroup();
    final ChargeGroup_enum expectedGroup = ChargeGroup_enum.ServiceChargeIndexable;
    if (group != expectedGroup.findUsing(serviceRegistry)) {
        throw new IllegalArgumentException("Charge's group must be " + expectedGroup.getRef());
    }
    LeaseItem leaseItem = new LeaseItemBuilder().setLease(lease).setCharge(charge).setLeaseItemType(LEASE_ITEM_TYPE).setInvoicingFrequency(INVOICING_FREQUENCY).setInvoicedBy(invoicedBy).setPaymentMethod(paymentMethod).setStatus(status).setSequence(sequence).build(this, ec).getObject();
    for (final LeaseTermForIndexableBuilder.TermSpec termSpec : termSpecs) {
        final LeaseTermForIndexable term = new LeaseTermForIndexableBuilder().setLeaseItem(leaseItem).setStartDate(termSpec.startDate).setEndDate(termSpec.endDate).setLeaseTermFrequency(termSpec.leaseTermFrequency).setBaseValue(termSpec.baseValue).setBaseIndexStartDate(termSpec.baseIndexStartDate).setNextIndexStartDate(termSpec.nextIndexStartDate).setEffectiveDate(termSpec.effectiveDate).setIndex(termSpec.index).build(this, ec).getObject();
        terms.add(term);
    }
    object = leaseItem;
}
Also used : ChargeGroup(org.estatio.module.charge.dom.ChargeGroup) ChargeGroup_enum(org.estatio.module.charge.fixtures.chargegroups.enums.ChargeGroup_enum) LeaseTermForIndexable(org.estatio.module.lease.dom.LeaseTermForIndexable) LeaseItem(org.estatio.module.lease.dom.LeaseItem)

Example 3 with LeaseTermForIndexable

use of org.estatio.module.lease.dom.LeaseTermForIndexable in project estatio by estatio.

the class LeaseItemForRentBuilder method execute.

@Override
protected void execute(final ExecutionContext ec) {
    defaultParam("charge", ec, Charge_enum.ItRent.findUsing(serviceRegistry));
    final ChargeGroup group = getCharge().getGroup();
    final ChargeGroup_enum expectedGroup = ChargeGroup_enum.Rent;
    if (group != expectedGroup.findUsing(serviceRegistry)) {
        throw new IllegalArgumentException("Charge's group must be " + expectedGroup.getRef());
    }
    LeaseItem leaseItem = new LeaseItemBuilder().setLease(lease).setCharge(charge).setLeaseItemType(LEASE_ITEM_TYPE).setInvoicingFrequency(INVOICING_FREQUENCY).setInvoicedBy(invoicedBy).setPaymentMethod(paymentMethod).setStatus(status).setSequence(sequence).build(this, ec).getObject();
    for (LeaseTermForIndexableBuilder.TermSpec termSpec : termSpecs) {
        final LeaseTermForIndexable term = new LeaseTermForIndexableBuilder().setLeaseItem(leaseItem).setStartDate(termSpec.startDate).setEffectiveDate(termSpec.endDate).setBaseValue(termSpec.baseValue).setBaseIndexStartDate(termSpec.baseIndexStartDate).setNextIndexStartDate(termSpec.nextIndexStartDate).setEffectiveDate(termSpec.effectiveDate).setIndex(termSpec.index).build(this, ec).getObject();
        terms.add(term);
    }
    object = leaseItem;
}
Also used : ChargeGroup(org.estatio.module.charge.dom.ChargeGroup) ChargeGroup_enum(org.estatio.module.charge.fixtures.chargegroups.enums.ChargeGroup_enum) LeaseTermForIndexable(org.estatio.module.lease.dom.LeaseTermForIndexable) LeaseItem(org.estatio.module.lease.dom.LeaseItem)

Example 4 with LeaseTermForIndexable

use of org.estatio.module.lease.dom.LeaseTermForIndexable in project estatio by estatio.

the class IndexationCalculationMethod_Test method getIndexableWith.

private static Indexable getIndexableWith(double baseValue, double baseIndexValue, double nextIndexValue, double rebaseFactor, double levellingPercentage) {
    LeaseTermForIndexable indexable;
    indexable = new LeaseTermForIndexable();
    // indexable.setIndex(mockIndex);
    indexable.setBaseValue(BigDecimal.valueOf(baseValue));
    indexable.setBaseIndexValue(BigDecimal.valueOf(baseIndexValue));
    indexable.setNextIndexValue(BigDecimal.valueOf(nextIndexValue));
    indexable.setRebaseFactor(BigDecimal.valueOf(rebaseFactor));
    indexable.setLevellingPercentage(BigDecimal.valueOf(levellingPercentage));
    return indexable;
}
Also used : LeaseTermForIndexable(org.estatio.module.lease.dom.LeaseTermForIndexable)

Example 5 with LeaseTermForIndexable

use of org.estatio.module.lease.dom.LeaseTermForIndexable in project estatio by estatio.

the class LeaseTermForIndexableBuilder method execute.

@Override
protected void execute(final ExecutionContext ec) {
    checkParam("leaseItem", ec, LeaseItem.class);
    defaultParam("startDate", ec, leaseItem.getStartDate());
    defaultParam("leaseTermFrequency", ec, LeaseTermFrequency.YEARLY);
    final Class<?> expectedClass = LeaseTermForIndexable.class;
    if (!leaseItem.getType().isCreate(expectedClass)) {
        throw new IllegalArgumentException(String.format("LeaseItem type must instantiate %s (is %s)", expectedClass, leaseItem.getType()));
    }
    final LeaseTermForIndexable leaseTerm = (LeaseTermForIndexable) leaseItem.newTerm(startDate, endDate);
    leaseTerm.setBaseValue(baseValue);
    leaseTerm.setBaseIndexStartDate(baseIndexStartDate);
    leaseTerm.setNextIndexStartDate(nextIndexStartDate);
    leaseTerm.setEffectiveDate(effectiveDate);
    leaseTerm.setIndex(index);
    leaseTerm.setFrequency(leaseTermFrequency);
    ec.addResult(this, leaseTerm);
    object = leaseTerm;
}
Also used : LeaseTermForIndexable(org.estatio.module.lease.dom.LeaseTermForIndexable)

Aggregations

LeaseTermForIndexable (org.estatio.module.lease.dom.LeaseTermForIndexable)7 LeaseItem (org.estatio.module.lease.dom.LeaseItem)4 Programmatic (org.apache.isis.applib.annotation.Programmatic)2 ChargeGroup (org.estatio.module.charge.dom.ChargeGroup)2 ChargeGroup_enum (org.estatio.module.charge.fixtures.chargegroups.enums.ChargeGroup_enum)2 LeaseTerm (org.estatio.module.lease.dom.LeaseTerm)1 ApplicationTenancy (org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)1