use of org.incode.module.document.dom.impl.docs.Document in project estatio by estatio.
the class InvoiceForLease_prepareAbstract method $$.
@Action(domainEvent = ActionDomainEvent.class, semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
@ActionLayout(contributed = Contributed.AS_ACTION)
public Invoice $$() throws IOException {
final DocumentTemplate template = documentTemplateFor(invoiceForLease);
final Document document = documentCreatorService.createDocumentAndAttachPaperclips(invoiceForLease, template);
document.render(template, invoiceForLease);
return invoiceForLease;
}
use of org.incode.module.document.dom.impl.docs.Document in project estatio by estatio.
the class InvoiceForLease_sendAbstract method appendPdfBytes.
@Programmatic
public void appendPdfBytes(final Document prelimLetterOrInvoiceDoc, final List<byte[]> pdfBytes) {
// this one should be a PDF
appendBytesIfPdf(prelimLetterOrInvoiceDoc, pdfBytes);
// and any attachments that are PDFs are also merged in
final List<Paperclip> paperclips = paperclipRepository.findByDocument(prelimLetterOrInvoiceDoc);
for (Paperclip paperclip : paperclips) {
final Object objAttachedToDocument = paperclip.getAttachedTo();
if (objAttachedToDocument instanceof Document) {
final Document docAttachedToDocument = (Document) objAttachedToDocument;
appendBytesIfPdf(docAttachedToDocument, pdfBytes);
}
}
}
use of org.incode.module.document.dom.impl.docs.Document in project estatio by estatio.
the class InvoiceForLease_sendByEmail method choices0$$.
public List<Document> choices0$$() {
final List<Paperclip> paperclips = paperclipRepository.findByAttachedTo(invoice);
final List<Document> documents = Lists.newArrayList();
for (Paperclip paperclip : paperclips) {
final DocumentAbstract documentAbs = paperclip.getDocument();
if (!(documentAbs instanceof Document)) {
continue;
}
final Document document = (Document) documentAbs;
if (document.getState() != DocumentState.RENDERED) {
continue;
}
if (!DocumentTypeData.isPrimaryType(document)) {
continue;
}
final Document_sendByEmail document_email = document_sendByEmail(document);
if (document_email.disableAct() != null) {
continue;
}
documents.add(document);
}
return documents;
}
use of org.incode.module.document.dom.impl.docs.Document in project estatio by estatio.
the class InvoiceForLease_sendByEmailPrelimLetterOrInvoiceDocAbstract method $$.
@Action(semantics = SemanticsOf.NON_IDEMPOTENT, domainEvent = DomainEvent.class)
@ActionLayout(cssClassFa = "at", contributed = Contributed.AS_ACTION)
public Invoice $$(@ParameterLayout(named = "to:") final EmailAddress toChannel, @Parameter(optionality = Optionality.OPTIONAL, maxLength = CommunicationChannel.EmailType.Meta.MAX_LEN, regexPattern = CommunicationChannel.EmailType.Meta.REGEX, regexPatternReplacement = CommunicationChannel.EmailType.Meta.REGEX_DESC) @ParameterLayout(named = "cc:") final String cc, @Parameter(optionality = Optionality.OPTIONAL, maxLength = CommunicationChannel.EmailType.Meta.MAX_LEN, regexPattern = CommunicationChannel.EmailType.Meta.REGEX, regexPatternReplacement = CommunicationChannel.EmailType.Meta.REGEX_DESC) @ParameterLayout(named = "cc (2):") final String cc2, @Parameter(optionality = Optionality.OPTIONAL, maxLength = CommunicationChannel.EmailType.Meta.MAX_LEN, regexPattern = CommunicationChannel.EmailType.Meta.REGEX, regexPatternReplacement = CommunicationChannel.EmailType.Meta.REGEX_DESC) @ParameterLayout(named = "cc (3):") final String cc3, @Parameter(optionality = Optionality.OPTIONAL, maxLength = CommunicationChannel.EmailType.Meta.MAX_LEN, regexPattern = CommunicationChannel.EmailType.Meta.REGEX, regexPatternReplacement = CommunicationChannel.EmailType.Meta.REGEX_DESC) @ParameterLayout(named = "bcc:") final String bcc, @Parameter(optionality = Optionality.OPTIONAL, maxLength = CommunicationChannel.EmailType.Meta.MAX_LEN, regexPattern = CommunicationChannel.EmailType.Meta.REGEX, regexPatternReplacement = CommunicationChannel.EmailType.Meta.REGEX_DESC) @ParameterLayout(named = "bcc (2):") final String bcc2) throws IOException {
final Document document = findDocument();
createEmailCommunication(document, toChannel, cc, cc2, cc3, bcc, bcc2);
return invoice;
}
use of org.incode.module.document.dom.impl.docs.Document in project estatio by estatio.
the class BuyerFinder_Test method testWhenParamIsDocument.
private void testWhenParamIsDocument(final String documentName, final String derivedPartyReference) {
// given
Document document = new Document(null, null, documentName, null, null);
BuyerFinder finder = new BuyerFinder();
finder.partyRepository = mockPartyRepository;
// expect
context.checking(new Expectations() {
{
oneOf(mockPartyRepository).findPartyByReference(derivedPartyReference);
}
});
// when
finder.buyerDerivedFromDocumentName(document);
}
Aggregations