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;
}
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);
}
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);
}
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);
}
}
}
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");
}
Aggregations