Search in sources :

Example 6 with Lease

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

the class Occupancy method remove.

@Action(semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE, domainEvent = Occupancy.RemoveEvent.class)
public Object remove() {
    Lease lease = getLease();
    remove(this);
    return lease;
}
Also used : Lease(org.estatio.module.lease.dom.Lease) Action(org.apache.isis.applib.annotation.Action)

Example 7 with Lease

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

the class InvoiceAttributesVM method getLeasePropertyName.

@Programmatic
public String getLeasePropertyName() {
    Lease lease = invoice.getLease();
    if (lease == null) {
        return null;
    }
    Property property = lease.getProperty();
    if (property == null) {
        return null;
    }
    return property.getName();
}
Also used : Lease(org.estatio.module.lease.dom.Lease) InvoiceForLease(org.estatio.module.lease.dom.invoicing.InvoiceForLease) InvoiceItemForLease(org.estatio.module.lease.dom.invoicing.InvoiceItemForLease) Property(org.estatio.module.asset.dom.Property) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 8 with Lease

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

the class LeaseTermForServiceChargeImport 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;
}
Also used : ApplicationException(org.apache.isis.applib.ApplicationException) Lease(org.estatio.module.lease.dom.Lease)

Example 9 with Lease

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

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

the class LeaseTermImportAbstract 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;
}
Also used : ApplicationException(org.apache.isis.applib.ApplicationException) Lease(org.estatio.module.lease.dom.Lease)

Aggregations

Lease (org.estatio.module.lease.dom.Lease)57 LocalDate (org.joda.time.LocalDate)17 Programmatic (org.apache.isis.applib.annotation.Programmatic)16 ApplicationException (org.apache.isis.applib.ApplicationException)11 Charge (org.estatio.module.charge.dom.Charge)11 Test (org.junit.Test)11 LeaseItem (org.estatio.module.lease.dom.LeaseItem)10 Occupancy (org.estatio.module.lease.dom.occupancy.Occupancy)10 Unit (org.estatio.module.asset.dom.Unit)9 InvoiceForLease (org.estatio.module.lease.dom.invoicing.InvoiceForLease)9 Property (org.estatio.module.asset.dom.Property)7 Party (org.estatio.module.party.dom.Party)6 Action (org.apache.isis.applib.annotation.Action)5 ApplicationTenancy (org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)5 Before (org.junit.Before)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 PaymentMethod (org.estatio.module.invoice.dom.PaymentMethod)4 InvoiceItemForLease (org.estatio.module.lease.dom.invoicing.InvoiceItemForLease)4 BigDecimal (java.math.BigDecimal)3