Search in sources :

Example 21 with CommunicationChannel

use of org.incode.module.communications.dom.impl.commchannel.CommunicationChannel in project estatio by estatio.

the class InvoiceForLeaseRepository method newInvoice.

@Programmatic
public InvoiceForLease newInvoice(final ApplicationTenancy applicationTenancy, final Party seller, final Party buyer, final PaymentMethod paymentMethod, final Currency currency, final LocalDate dueDate, final Lease lease, final String interactionId) {
    InvoiceForLease invoice = newTransientInstance();
    invoice.setApplicationTenancyPath(applicationTenancy.getPath());
    invoice.setBuyer(buyer);
    invoice.setSeller(seller);
    invoice.setPaymentMethod(paymentMethod);
    invoice.setStatus(InvoiceStatus.NEW);
    invoice.setCurrency(currency);
    invoice.setLease(lease);
    invoice.setDueDate(dueDate);
    invoice.setRunId(interactionId);
    // copy down form the agreement, we require all invoice items to relate
    // back to this (root) fixed asset
    invoice.setPaidBy(lease.getPaidBy());
    invoice.setFixedAsset(lease.getProperty());
    // copy over the current invoice address (if any)
    final CommunicationChannel sendTo = firstCurrentTenantInvoiceAddress(lease);
    invoice.setSendTo(sendTo);
    invoice.updateDescriptions();
    persistIfNotAlready(invoice);
    getContainer().flush();
    return invoice;
}
Also used : CommunicationChannel(org.incode.module.communications.dom.impl.commchannel.CommunicationChannel) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Aggregations

CommunicationChannel (org.incode.module.communications.dom.impl.commchannel.CommunicationChannel)21 Programmatic (org.apache.isis.applib.annotation.Programmatic)8 Party (org.estatio.module.party.dom.Party)7 AgreementRoleType (org.estatio.module.agreement.dom.role.AgreementRoleType)5 List (java.util.List)4 Inject (javax.inject.Inject)4 AgreementRole (org.estatio.module.agreement.dom.AgreementRole)4 AgreementRoleCommunicationChannelType (org.estatio.module.agreement.dom.AgreementRoleCommunicationChannelType)4 Lease (org.estatio.module.lease.dom.Lease)4 CommunicationChannelType (org.incode.module.communications.dom.impl.commchannel.CommunicationChannelType)4 Before (org.junit.Before)4 Optional (java.util.Optional)3 AgreementRoleCommunicationChannel (org.estatio.module.agreement.dom.AgreementRoleCommunicationChannel)3 Document (org.incode.module.document.dom.impl.docs.Document)3 Paperclip (org.incode.module.document.dom.impl.paperclips.Paperclip)3 DemoObjectWithNotes (org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes)3 DemoInvoice (org.incode.platform.dom.communications.integtests.demo.dom.invoice.DemoInvoice)3 Test (org.junit.Test)3 SortedSet (java.util.SortedSet)2 DomainService (org.apache.isis.applib.annotation.DomainService)2