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