Search in sources :

Example 26 with Document

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;
}
Also used : DocumentTemplate(org.incode.module.document.dom.impl.docs.DocumentTemplate) Document(org.incode.module.document.dom.impl.docs.Document) Action(org.apache.isis.applib.annotation.Action) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Example 27 with Document

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);
        }
    }
}
Also used : Paperclip(org.incode.module.document.dom.impl.paperclips.Paperclip) Document(org.incode.module.document.dom.impl.docs.Document) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 28 with Document

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;
}
Also used : Paperclip(org.incode.module.document.dom.impl.paperclips.Paperclip) DocumentAbstract(org.incode.module.document.dom.impl.docs.DocumentAbstract) Document(org.incode.module.document.dom.impl.docs.Document) Document_sendByEmail(org.incode.module.communications.dom.mixins.Document_sendByEmail)

Example 29 with Document

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;
}
Also used : Document(org.incode.module.document.dom.impl.docs.Document) Action(org.apache.isis.applib.annotation.Action) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Example 30 with Document

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);
}
Also used : Expectations(org.jmock.Expectations) BuyerFinder(org.estatio.module.capex.dom.documents.BuyerFinder) Document(org.incode.module.document.dom.impl.docs.Document)

Aggregations

Document (org.incode.module.document.dom.impl.docs.Document)57 Action (org.apache.isis.applib.annotation.Action)23 ActionLayout (org.apache.isis.applib.annotation.ActionLayout)22 Programmatic (org.apache.isis.applib.annotation.Programmatic)8 Blob (org.apache.isis.applib.value.Blob)7 IncomingInvoice (org.estatio.module.capex.dom.invoice.IncomingInvoice)7 DocumentAbstract (org.incode.module.document.dom.impl.docs.DocumentAbstract)7 MemberOrder (org.apache.isis.applib.annotation.MemberOrder)5 Paperclip (org.incode.module.document.dom.impl.paperclips.Paperclip)5 IncomingDocumentCategorisationStateTransition (org.estatio.module.capex.dom.documents.categorisation.IncomingDocumentCategorisationStateTransition)4 Bookmark (org.apache.isis.applib.services.bookmark.Bookmark)3 BuyerFinder (org.estatio.module.capex.dom.documents.BuyerFinder)3 Communication (org.incode.module.communications.dom.impl.comms.Communication)3 DocumentTemplate (org.incode.module.document.dom.impl.docs.DocumentTemplate)3 Expectations (org.jmock.Expectations)3 TitleBuffer (org.apache.isis.applib.util.TitleBuffer)2 IncomingDocAsOrderViewModel (org.estatio.module.capex.app.order.IncomingDocAsOrderViewModel)2 Order (org.estatio.module.capex.dom.order.Order)2 BankAccount (org.estatio.module.financial.dom.BankAccount)2 DocumentTypeData (org.estatio.module.invoice.dom.DocumentTypeData)2