Search in sources :

Example 46 with Programmatic

use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.

the class BankAccountVerificationStateSubscriber method titleOf.

@Programmatic
@com.google.common.eventbus.Subscribe
@org.axonframework.eventhandling.annotation.EventHandler
public void titleOf(BankAccount.TitleUiEvent ev) {
    final BankAccount bankAccount = ev.getSource();
    final BankAccountVerificationState state = stateTransitionService.currentStateOf(bankAccount, BankAccountVerificationStateTransition.class);
    final String title = String.format("%s - %s (%s)", bankAccount.getName(), bankAccount.getOwner().getReference(), Enums.getFriendlyNameOf(state));
    ev.setTitle(title);
}
Also used : BankAccount(org.estatio.module.financial.dom.BankAccount) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 47 with Programmatic

use of org.apache.isis.applib.annotation.Programmatic 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 48 with Programmatic

use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.

the class LeaseTypeImport method importData.

@Programmatic
@Override
public List<Object> importData(final Object previousRow) {
    final ApplicationTenancy appTenancy = applicationTenancyRepository.findByPath(atPath);
    final LeaseType leaseType = leaseTypeRepository.findOrCreate(reference, name, appTenancy);
    if (ObjectUtils.compare(name, leaseType.getName()) != 0) {
        leaseType.setName(name);
    }
    return Lists.newArrayList(leaseType);
}
Also used : LeaseType(org.estatio.module.lease.dom.LeaseType) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 49 with Programmatic

use of org.apache.isis.applib.annotation.Programmatic 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)

Example 50 with Programmatic

use of org.apache.isis.applib.annotation.Programmatic 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();
}
Also used : BreakOption(org.estatio.module.lease.dom.breaks.BreakOption) Lease(org.estatio.module.lease.dom.Lease) BreakType(org.estatio.module.lease.dom.breaks.BreakType) Period(org.joda.time.Period) BreakExerciseType(org.estatio.module.lease.dom.breaks.BreakExerciseType) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Aggregations

Programmatic (org.apache.isis.applib.annotation.Programmatic)162 Party (org.estatio.module.party.dom.Party)21 Lease (org.estatio.module.lease.dom.Lease)16 DomainObject (org.apache.isis.applib.annotation.DomainObject)11 BankAccount (org.estatio.module.financial.dom.BankAccount)11 Charge (org.estatio.module.charge.dom.Charge)10 ApplicationTenancy (org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)10 LocalDate (org.joda.time.LocalDate)10 BigDecimal (java.math.BigDecimal)9 Bookmark (org.apache.isis.applib.services.bookmark.Bookmark)9 ApplicationException (org.apache.isis.applib.ApplicationException)8 Property (org.estatio.module.asset.dom.Property)8 CommunicationChannel (org.incode.module.communications.dom.impl.commchannel.CommunicationChannel)8 ArrayList (java.util.ArrayList)7 TranslatableString (org.apache.isis.applib.services.i18n.TranslatableString)7 InvoiceItem (org.estatio.module.invoice.dom.InvoiceItem)7 LeaseItem (org.estatio.module.lease.dom.LeaseItem)7 Inject (javax.inject.Inject)6 Unit (org.estatio.module.asset.dom.Unit)6 Document (org.incode.module.document.dom.impl.docs.Document)6