Search in sources :

Example 11 with DocumentType

use of org.incode.module.document.dom.impl.types.DocumentType in project estatio by estatio.

the class Invoice_DocumentManagement_IntegTest method receiptAttachedToInvoice.

void receiptAttachedToInvoice(final Invoice invoice, final String fileName) throws IOException {
    final InvoiceForLease_attachSupportingDocument invoice_attachSupportingDocument = mixin(InvoiceForLease_attachSupportingDocument.class, invoice);
    final List<DocumentType> documentTypes = invoice_attachSupportingDocument.choices0$$();
    assertThat(documentTypes).hasSize(2);
    final DocumentType documentType = documentTypes.get(0);
    final List<String> roleNames = invoice_attachSupportingDocument.choices3$$();
    assertThat(roleNames).hasSize(1);
    final String roleName = roleNames.get(0);
    final Blob blob = asBlob(fileName);
    wrap(invoice_attachSupportingDocument).$$(documentType, blob, null, roleName);
}
Also used : Blob(org.apache.isis.applib.value.Blob) InvoiceForLease_attachSupportingDocument(org.estatio.module.lease.dom.invoicing.comms.InvoiceForLease_attachSupportingDocument) DocumentType(org.incode.module.document.dom.impl.types.DocumentType)

Example 12 with DocumentType

use of org.incode.module.document.dom.impl.types.DocumentType in project estatio by estatio.

the class InvoiceForLease_attachSupportingDocument method findUnsentDocumentsFor.

private List<DocumentAbstract> findUnsentDocumentsFor(final InvoiceForLease invoice, final DocumentTypeData docTypeData) {
    final DocumentType documentType = docTypeData.findUsing(documentTypeRepository, queryResultsCache);
    final List<DocumentAbstract> unsentDocuments = Lists.newArrayList();
    final List<Paperclip> existingInvoicePaperclips = paperclipRepository.findByAttachedTo(invoice);
    for (Paperclip paperclip : existingInvoicePaperclips) {
        final DocumentAbstract document = paperclip.getDocument();
        if (document.getType() == documentType) {
            boolean sent = whetherSent(document);
            if (!sent) {
                unsentDocuments.add(document);
            }
        }
    }
    return unsentDocuments;
}
Also used : DocumentAbstract(org.incode.module.document.dom.impl.docs.DocumentAbstract) Paperclip(org.incode.module.document.dom.impl.paperclips.Paperclip) DocumentType(org.incode.module.document.dom.impl.types.DocumentType)

Example 13 with DocumentType

use of org.incode.module.document.dom.impl.types.DocumentType in project estatio by estatio.

the class DocumentTemplateRepository method removeTemplatesWithSameDocumentType.

protected void removeTemplatesWithSameDocumentType(final List<DocumentTemplate> templates) {
    final Set<DocumentType> documentTypes = Sets.newHashSet();
    for (Iterator<DocumentTemplate> iterator = templates.iterator(); iterator.hasNext(); ) {
        final DocumentTemplate template = iterator.next();
        final DocumentType documentType = template.getType();
        if (documentTypes.contains(documentType)) {
            iterator.remove();
        } else {
            documentTypes.add(documentType);
        }
    }
}
Also used : DocumentType(org.incode.module.document.dom.impl.types.DocumentType)

Aggregations

DocumentType (org.incode.module.document.dom.impl.types.DocumentType)13 Action (org.apache.isis.applib.annotation.Action)4 Blob (org.apache.isis.applib.value.Blob)3 RenderingStrategy (org.incode.module.document.dom.impl.rendering.RenderingStrategy)3 ActionLayout (org.apache.isis.applib.annotation.ActionLayout)2 MemberOrder (org.apache.isis.applib.annotation.MemberOrder)2 Clob (org.apache.isis.applib.value.Clob)2 DocumentTemplate (org.incode.module.document.dom.impl.docs.DocumentTemplate)2 Paperclip (org.incode.module.document.dom.impl.paperclips.Paperclip)2 LocalDate (org.joda.time.LocalDate)2 List (java.util.List)1 Objects (java.util.Objects)1 Predicate (java.util.function.Predicate)1 Inject (javax.inject.Inject)1 Mixin (org.apache.isis.applib.annotation.Mixin)1 Parameter (org.apache.isis.applib.annotation.Parameter)1 SemanticsOf (org.apache.isis.applib.annotation.SemanticsOf)1 TranslatableString (org.apache.isis.applib.services.i18n.TranslatableString)1 BankAccount (org.estatio.module.financial.dom.BankAccount)1 DocumentTypeData (org.estatio.module.invoice.dom.DocumentTypeData)1