Search in sources :

Example 31 with Programmatic

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

the class PaymentBatchApprovalStateSubscriber method on.

@Programmatic
@com.google.common.eventbus.Subscribe
@org.axonframework.eventhandling.annotation.EventHandler
public void on(PaymentBatch.ObjectPersistedEvent ev) {
    // nb: note that the batch at this stage has no lines attached to it,
    // so there is a limit as to what we can safely do.
    // however, it *is* ok to just create the state chart for the domain object.
    final PaymentBatch paymentBatch = ev.getSource();
    PaymentBatchApprovalState approvalState = paymentBatch.getApprovalState();
    if (approvalState == PaymentBatchApprovalStateTransitionType.INSTANTIATE.getToState()) {
        // ie was set in the persisting callback
        stateTransitionService.trigger(paymentBatch, PaymentBatchApprovalStateTransitionType.INSTANTIATE, null, null);
    }
}
Also used : PaymentBatch(org.estatio.module.capex.dom.payment.PaymentBatch) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 32 with Programmatic

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

the class LeaseInvoicingSettingsService method updateEpochDate.

/**
 * @see LeaseInvoicingSettingKey#epochDate
 */
@Programmatic
public void updateEpochDate(final LocalDate newEpochDate) {
    // getApplicationSettings().installDefaultsIfRequired();
    final ApplicationSettingForEstatio setting = (ApplicationSettingForEstatio) applicationSettingsService.find(LeaseInvoicingSettingKey.epochDate);
    if (setting != null) {
        if (newEpochDate != null) {
            setting.updateAsLocalDate(newEpochDate);
        } else {
            setting.delete();
        }
    } else {
        if (newEpochDate != null) {
            applicationSettingsService.newLocalDate(ApplicationSettingCreator.Helper.getKey(LeaseInvoicingSettingKey.epochDate), "Cutover date to Estatio", newEpochDate);
        }
    // else no-op
    }
    cachedEpochDate = null;
}
Also used : ApplicationSettingForEstatio(org.estatio.module.settings.dom.ApplicationSettingForEstatio) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 33 with Programmatic

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

the class InvoiceAttributesVM method getChargeDescriptions.

@Programmatic
public String getChargeDescriptions() {
    final StringBuilder buf = new StringBuilder();
    SortedSet<InvoiceItem> invoiceItems = invoice.getItems();
    Set<String> descriptions = FluentIterable.from(invoiceItems).transform(x -> {
        Charge charge = x.getCharge();
        return charge != null ? charge.getDescription() : null;
    }).filter(Objects::nonNull).toSortedSet(Ordering.natural());
    final List<String> items = Lists.newArrayList(descriptions);
    final int numItems = items.size();
    for (int i = 0; i < numItems; i++) {
        buf.append(items.get(i));
        if (i == numItems - 2) {
            buf.append(" e ");
        } else if (i != numItems - 1) {
            buf.append(", ");
        }
    }
    return buf.toString();
}
Also used : InvoiceItem(org.estatio.module.invoice.dom.InvoiceItem) Charge(org.estatio.module.charge.dom.Charge) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 34 with Programmatic

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

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

the class PartySubscriptions method on.

@Programmatic
@com.google.common.eventbus.Subscribe
@org.axonframework.eventhandling.annotation.EventHandler
public void on(final Party.FixEvent ev) {
    switch(ev.getEventPhase()) {
        case EXECUTING:
            Party sourceParty = (Party) ev.getSource();
            final List<AgreementRole> roles = agreementRoleRepository.findByParty(sourceParty);
            for (AgreementRole role : roles) {
                sourceParty.addRole(role.getType());
            }
            break;
        default:
            break;
    }
}
Also used : Party(org.estatio.module.party.dom.Party) AgreementRole(org.estatio.module.agreement.dom.AgreementRole) 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