use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.
the class Order_recategorize method act.
@Action(semantics = SemanticsOf.IDEMPOTENT_ARE_YOU_SURE)
@ActionLayout(cssClassFa = "mail-reply", cssClass = "btn-danger")
public Document act(@Nullable final String comment) {
Document document = lookupPdf();
document.setType(DocumentTypeData.INCOMING.findUsing(documentTypeRepository));
stateTransitionService.trigger(document, IncomingDocumentCategorisationStateTransition.class, IncomingDocumentCategorisationStateTransitionType.RESET, comment, null);
// use events to cascade delete, eg paperclips and state transitions/tasks
orderRepository.delete(order);
return document;
}
use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.
the class InvoiceSummaryForPropertyDueDateStatus_sendByPostAbstract method $$.
@Action(semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
@ActionLayout(contributed = Contributed.AS_ACTION)
public Blob $$(final String fileName) throws IOException {
final List<byte[]> pdfBytes = Lists.newArrayList();
for (final InvoiceAndDocument invoiceAndDocument : invoiceAndDocumentsToSend()) {
final Invoice invoice = invoiceAndDocument.getInvoice();
final Document prelimLetterOrInvoiceNote = invoiceAndDocument.getDocument();
final InvoiceForLease_sendByPost invoice_sendByPost = invoice_sendByPost(invoice);
final PostalAddress postalAddress = invoice_sendByPost.default1$$(prelimLetterOrInvoiceNote);
invoice_sendByPost.createPostalCommunicationAsSent(prelimLetterOrInvoiceNote, postalAddress);
invoice_sendByPost.appendPdfBytes(prelimLetterOrInvoiceNote, pdfBytes);
}
final byte[] mergedBytes = pdfBoxService.merge(pdfBytes.toArray(new byte[][] {}));
return new Blob(fileName, DocumentConstants.MIME_TYPE_APPLICATION_PDF, mergedBytes);
}
use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.
the class DocAndCommAbstract_download method act.
@Action(semantics = SemanticsOf.SAFE, invokeOn = InvokeOn.OBJECT_ONLY)
@ActionLayout(contributed = Contributed.AS_ACTION)
public Blob act() throws IOException {
final List<byte[]> pdfBytes = Lists.newArrayList();
final Document document = getDocument();
appendBytes(document, pdfBytes);
final List<Document> supportingDocs = attachmentsProvider.attachmentsFor(document);
for (Document supportingDoc : supportingDocs) {
appendBytes(supportingDoc, pdfBytes);
}
final byte[] mergedBytes = pdfBoxService.merge(pdfBytes.toArray(new byte[][] {}));
return new Blob(fileName, MIME_TYPE_APPLICATION_PDF, mergedBytes);
}
use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.
the class DocAndCommAbstract_downloadSelected method act.
@Action(semantics = SemanticsOf.SAFE, invokeOn = InvokeOn.COLLECTION_ONLY)
@ActionLayout(contributed = Contributed.AS_ACTION)
public Object act() throws IOException {
final List<byte[]> pdfBytes = createOrLookupPdfBytes();
final Document document = getDocument();
// we just ignore those that do not
if (document != null) {
appendBytes(document, pdfBytes);
final List<Document> supportingDocs = attachmentsProvider.attachmentsFor(document);
for (Document supportingDoc : supportingDocs) {
appendBytes(supportingDoc, pdfBytes);
}
}
if (interactionContext.isLast()) {
if (pdfBytes.isEmpty()) {
messageService.warnUser("No documents to be merged");
return null;
}
final byte[] mergedBytes = pdfBoxService.merge(pdfBytes.toArray(new byte[][] {}));
return new Blob(fileName, MIME_TYPE_APPLICATION_PDF, mergedBytes);
}
return null;
}
use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.
the class InvoiceSummaryForPropertyDueDateStatus_backgroundPrepareAbstract method $$.
@Action(semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
@ActionLayout(contributed = Contributed.AS_ACTION)
public InvoiceSummaryForPropertyDueDateStatus $$() throws IOException {
final List<InvoiceForLease> invoices = invoicesToPrepare();
for (Invoice invoice : invoices) {
final DocumentTemplate documentTemplate = documentTemplateFor(invoice);
factoryService.mixin(InvoiceForLease_backgroundPrepare.class, invoice).$$(documentTemplate);
}
return this.invoiceSummary;
}
Aggregations