Search in sources :

Example 1 with DemoObjectWithNotes

use of org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes in project estatio by estatio.

the class CommunicationChannelSubscription_Integtest method replacement_provided.

@Test
public void replacement_provided() throws Exception {
    // Given
    final DemoObjectWithNotes owner = customerMenu.findDemoObjectsWithNotesByName(DemoObjectWithNote_and_DemoInvoice_create3.FRED_HAS_EMAIL_AND_PHONE).get(0);
    final PostalAddress postalAddress = communicationChannelRepository.newPostal(owner, CommunicationChannelType.POSTAL_ADDRESS, "Some address", null, null, null, null, null, null);
    final PostalAddress replaceWith = communicationChannelRepository.newPostal(owner, CommunicationChannelType.POSTAL_ADDRESS, "Replacement Address", null, null, null, null, null, null);
    final Communication communication = communicationRepository.createPostal("Subject", "/", postalAddress);
    final int size = communicationChannelRepository.findByOwner(owner).size();
    // When
    wrapperFactory.wrap(postalAddress).remove(replaceWith);
    // Then
    Assertions.assertThat(communicationChannelRepository.findByOwner(owner).size()).isEqualTo(size - 1);
}
Also used : PostalAddress(org.incode.module.communications.dom.impl.commchannel.PostalAddress) DemoObjectWithNotes(org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes) Communication(org.incode.module.communications.dom.impl.comms.Communication) Test(org.junit.Test)

Example 2 with DemoObjectWithNotes

use of org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes in project estatio by estatio.

the class CommunicationChannelSubscription_Integtest method validate_fails_when_no_replacement_is_provided.

@Test
public void validate_fails_when_no_replacement_is_provided() throws Exception {
    // Given
    final DemoObjectWithNotes owner = customerMenu.findDemoObjectsWithNotesByName(DemoObjectWithNote_and_DemoInvoice_create3.FRED_HAS_EMAIL_AND_PHONE).get(0);
    final PostalAddress postalAddress = communicationChannelRepository.newPostal(owner, CommunicationChannelType.POSTAL_ADDRESS, "Some address", null, null, null, null, null, null);
    final Communication communication = communicationRepository.createPostal("Subject", "/", postalAddress);
    // Expect
    expectedExceptions.expectMessage("Communication channel is being used");
    // When
    wrap(postalAddress).remove(null);
}
Also used : PostalAddress(org.incode.module.communications.dom.impl.commchannel.PostalAddress) DemoObjectWithNotes(org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes) Communication(org.incode.module.communications.dom.impl.comms.Communication) Test(org.junit.Test)

Example 3 with DemoObjectWithNotes

use of org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes 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 DemoObjectWithNotes

use of org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes 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)

Example 5 with DemoObjectWithNotes

use of org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes in project estatio by estatio.

the class CommunicationChannelSubscription_Integtest method setUp.

@Before
public void setUp() throws Exception {
    // given
    fixtureScripts.runFixtureScript(new DemoObjectWithNotes_and_DemoInvoice_and_docs_and_comms_recreate(), null);
    transactionService.nextTransaction();
    // and so given customer with an email
    final DemoObjectWithNotes fred = customerMenu.findDemoObjectsWithNotesByName(DemoObjectWithNote_and_DemoInvoice_create3.FRED_HAS_EMAIL_AND_PHONE).get(0);
    final EmailAddress fredEmail = (EmailAddress) linkRepository.findByOwnerAndCommunicationChannelType(fred, CommunicationChannelType.EMAIL_ADDRESS).get(0).getCommunicationChannel();
}
Also used : DemoObjectWithNotes_and_DemoInvoice_and_docs_and_comms_recreate(org.incode.platform.dom.communications.integtests.dom.communications.fixture.DemoObjectWithNotes_and_DemoInvoice_and_docs_and_comms_recreate) EmailAddress(org.incode.module.communications.dom.impl.commchannel.EmailAddress) DemoObjectWithNotes(org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes) Before(org.junit.Before)

Aggregations

DemoObjectWithNotes (org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes)7 Communication (org.incode.module.communications.dom.impl.comms.Communication)4 DemoInvoice (org.incode.platform.dom.communications.integtests.demo.dom.invoice.DemoInvoice)4 Test (org.junit.Test)4 CommunicationChannel (org.incode.module.communications.dom.impl.commchannel.CommunicationChannel)3 PostalAddress (org.incode.module.communications.dom.impl.commchannel.PostalAddress)3 Paperclip (org.incode.module.document.dom.impl.paperclips.Paperclip)3 EmailAddress (org.incode.module.communications.dom.impl.commchannel.EmailAddress)2 CommChannelRole (org.incode.module.communications.dom.impl.comms.CommChannelRole)2 DocumentAbstract (org.incode.module.document.dom.impl.docs.DocumentAbstract)2 DemoObjectWithNotes_and_DemoInvoice_and_docs_and_comms_recreate (org.incode.platform.dom.communications.integtests.dom.communications.fixture.DemoObjectWithNotes_and_DemoInvoice_and_docs_and_comms_recreate)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 Communication_downloadPdfForPosting (org.incode.module.communications.dom.impl.comms.Communication_downloadPdfForPosting)1