Search in sources :

Example 1 with DemoInvoice

use of org.incode.platform.dom.communications.integtests.demo.dom.invoice.DemoInvoice in project estatio by estatio.

the class DocumentCommunicationSupportForDocumentsAttachedToDemoInvoice method emailCoverNoteDocumentTypeFor.

@Override
public DocumentType emailCoverNoteDocumentTypeFor(final Document document) {
    final DemoInvoice invoice = paperclipRepository.paperclipAttaches(document, DemoInvoice.class);
    if (invoice == null) {
        return null;
    }
    final DocumentType documentType = documentTypeRepository.findByReference(DocumentType_and_DocumentTemplates_createSome.DOC_TYPE_REF_FREEMARKER_HTML);
    return documentType;
}
Also used : DemoInvoice(org.incode.platform.dom.communications.integtests.demo.dom.invoice.DemoInvoice) DocumentType(org.incode.module.document.dom.impl.types.DocumentType)

Example 2 with DemoInvoice

use of org.incode.platform.dom.communications.integtests.demo.dom.invoice.DemoInvoice in project estatio by estatio.

the class RenderModelFactoryOfDocumentAttachedToDemoInvoice method doNewRendererModel.

@Override
protected Object doNewRendererModel(final DocumentTemplate documentTemplate, final Document document) {
    final List<Paperclip> paperclips = paperclipRepository.findByDocument(document);
    final DemoInvoice demoInvoice = paperclips.stream().map(Paperclip::getAttachedTo).filter(DemoInvoice.class::isInstance).map(DemoInvoice.class::cast).findFirst().get();
    return new DataModel(demoInvoice.getCustomer(), demoInvoice);
}
Also used : Paperclip(org.incode.module.document.dom.impl.paperclips.Paperclip) DemoInvoice(org.incode.platform.dom.communications.integtests.demo.dom.invoice.DemoInvoice)

Example 3 with DemoInvoice

use of org.incode.platform.dom.communications.integtests.demo.dom.invoice.DemoInvoice in project estatio by estatio.

the class DocumentCommunicationSupportForDocumentsAttachedToDemoInvoice method addTo.

private <T extends CommunicationChannel> void addTo(final DemoInvoice invoice, final CommHeaderAbstract<T> header, final CommunicationChannelType channelType) {
    final DemoObjectWithNotes customer = invoice.getCustomer();
    final List<CommunicationChannelOwnerLink> links = communicationChannelOwnerLinkRepository.findByOwner(customer);
    final List channels = links.stream().map(CommunicationChannelOwnerLink::getCommunicationChannel).filter(cc -> cc.getType() == channelType).collect(Collectors.toList());
    header.getToChoices().addAll(channels);
}
Also used : NatureOfService(org.apache.isis.applib.annotation.NatureOfService) DocumentType(org.incode.module.document.dom.impl.types.DocumentType) PaperclipRepository(org.incode.module.document.dom.impl.paperclips.PaperclipRepository) CommunicationChannel(org.incode.module.communications.dom.impl.commchannel.CommunicationChannel) Paperclip(org.incode.module.document.dom.impl.paperclips.Paperclip) CommunicationChannelType(org.incode.module.communications.dom.impl.commchannel.CommunicationChannelType) Document(org.incode.module.document.dom.impl.docs.Document) DocumentTypeRepository(org.incode.module.document.dom.impl.types.DocumentTypeRepository) DemoObjectWithNotes(org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes) CommHeaderForEmail(org.incode.module.communications.dom.spi.CommHeaderForEmail) DomainService(org.apache.isis.applib.annotation.DomainService) CommHeaderAbstract(org.incode.module.communications.dom.spi.CommHeaderAbstract) Collectors(java.util.stream.Collectors) DocumentType_and_DocumentTemplates_createSome(org.incode.platform.dom.communications.integtests.dom.communications.fixture.data.doctypes.DocumentType_and_DocumentTemplates_createSome) Inject(javax.inject.Inject) List(java.util.List) DemoInvoice(org.incode.platform.dom.communications.integtests.demo.dom.invoice.DemoInvoice) CommunicationChannelOwnerLink(org.incode.module.communications.dom.impl.commchannel.CommunicationChannelOwnerLink) DocumentCommunicationSupport(org.incode.module.communications.dom.spi.DocumentCommunicationSupport) CommunicationChannelOwnerLinkRepository(org.incode.module.communications.dom.impl.commchannel.CommunicationChannelOwnerLinkRepository) CommHeaderForPost(org.incode.module.communications.dom.spi.CommHeaderForPost) List(java.util.List) CommunicationChannelOwnerLink(org.incode.module.communications.dom.impl.commchannel.CommunicationChannelOwnerLink) DemoObjectWithNotes(org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes)

Example 4 with DemoInvoice

use of org.incode.platform.dom.communications.integtests.demo.dom.invoice.DemoInvoice in project estatio by estatio.

the class DocumentCommunicationSupportForDocumentsAttachedToDemoInvoice method inferToHeader.

private <T extends CommunicationChannel> void inferToHeader(final Document document, final CommHeaderAbstract<T> header, final CommunicationChannelType channelType) {
    final List<Paperclip> paperclips = paperclipRepository.findByDocument(document);
    for (final Paperclip paperclip : paperclips) {
        final Object attachedTo = paperclip.getAttachedTo();
        if (attachedTo instanceof DemoInvoice) {
            final DemoInvoice invoice = (DemoInvoice) attachedTo;
            addTo(invoice, header, channelType);
        }
    }
}
Also used : Paperclip(org.incode.module.document.dom.impl.paperclips.Paperclip) DemoInvoice(org.incode.platform.dom.communications.integtests.demo.dom.invoice.DemoInvoice)

Example 5 with DemoInvoice

use of org.incode.platform.dom.communications.integtests.demo.dom.invoice.DemoInvoice in project estatio by estatio.

the class DemoObjectWithNote_and_DemoInvoice_create3 method execute.

@Override
protected void execute(final ExecutionContext executionContext) {
    final Country gbrCountry = countryRepository.findCountry(CountriesRefData.GBR);
    final DemoObjectWithNotes custA = wrap(demoCustomerMenu).createDemoObjectWithNotes(FRED_HAS_EMAIL_AND_PHONE);
    addEmailAddress(custA, "fred@gmail.com");
    addEmailAddress(custA, "freddy@msn.com");
    addPhoneOrFaxNumber(custA, CommunicationChannelType.PHONE_NUMBER, "555 1234");
    addPhoneOrFaxNumber(custA, CommunicationChannelType.FAX_NUMBER, "555 4321");
    final DemoInvoice custA_1 = demoInvoiceRepository.create("1", custA);
    attachReceipt(custA_1, "Sample4.PDF");
    final DemoInvoice custA_2 = demoInvoiceRepository.create("2", custA);
    attachReceipt(custA_2, "Sample5.PDF");
    final DemoObjectWithNotes custB = wrap(demoCustomerMenu).createDemoObjectWithNotes(MARY_HAS_PHONE_AND_POST);
    addPhoneOrFaxNumber(custB, CommunicationChannelType.PHONE_NUMBER, "777 0987");
    addPhoneOrFaxNumber(custB, CommunicationChannelType.FAX_NUMBER, "777 7890");
    addPostalAddress(custB, gbrCountry, null, "45", "High Street", null, "OX1 4BJ", "Oxford");
    addPostalAddress(custB, gbrCountry, null, "23", "Railway Road", null, "WN7 4AA", "Leigh");
    final DemoInvoice custB_1 = demoInvoiceRepository.create("1", custB);
    attachReceipt(custB_1, "xlsdemo1.pdf");
    final DemoInvoice custB_2 = demoInvoiceRepository.create("2", custB);
    attachReceipt(custB_2, "xlsdemo2.pdf");
    final DemoObjectWithNotes custC = wrap(demoCustomerMenu).createDemoObjectWithNotes(JOE_HAS_EMAIL_AND_POST);
    addEmailAddress(custC, "joe@yahoo.com");
    addEmailAddress(custC, "joey@friends.com");
    addPostalAddress(custC, gbrCountry, null, "5", "Witney Gardens", null, "WA4 5HT", "Warrington");
    addPostalAddress(custC, gbrCountry, null, "3", "St. Nicholas Street Road", null, "YO11 2HF", "Scarborough");
    final DemoInvoice custC_1 = demoInvoiceRepository.create("1", custC);
    attachReceipt(custC_1, "pptdemo1.pdf");
    final DemoInvoice custC_2 = demoInvoiceRepository.create("2", custC);
    attachReceipt(custC_2, "pptdemo2.pdf");
}
Also used : DemoInvoice(org.incode.platform.dom.communications.integtests.demo.dom.invoice.DemoInvoice) Country(org.incode.module.country.dom.impl.Country) DemoObjectWithNotes(org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes)

Aggregations

DemoInvoice (org.incode.platform.dom.communications.integtests.demo.dom.invoice.DemoInvoice)7 Paperclip (org.incode.module.document.dom.impl.paperclips.Paperclip)5 DemoObjectWithNotes (org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes)4 CommunicationChannel (org.incode.module.communications.dom.impl.commchannel.CommunicationChannel)3 CommChannelRole (org.incode.module.communications.dom.impl.comms.CommChannelRole)2 Communication (org.incode.module.communications.dom.impl.comms.Communication)2 DocumentAbstract (org.incode.module.document.dom.impl.docs.DocumentAbstract)2 DocumentType (org.incode.module.document.dom.impl.types.DocumentType)2 Test (org.junit.Test)2 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Inject (javax.inject.Inject)1 DomainService (org.apache.isis.applib.annotation.DomainService)1 NatureOfService (org.apache.isis.applib.annotation.NatureOfService)1 CommunicationChannelOwnerLink (org.incode.module.communications.dom.impl.commchannel.CommunicationChannelOwnerLink)1 CommunicationChannelOwnerLinkRepository (org.incode.module.communications.dom.impl.commchannel.CommunicationChannelOwnerLinkRepository)1 CommunicationChannelType (org.incode.module.communications.dom.impl.commchannel.CommunicationChannelType)1 EmailAddress (org.incode.module.communications.dom.impl.commchannel.EmailAddress)1 PostalAddress (org.incode.module.communications.dom.impl.commchannel.PostalAddress)1 Communication_downloadPdfForPosting (org.incode.module.communications.dom.impl.comms.Communication_downloadPdfForPosting)1