Search in sources :

Example 6 with ActionLayout

use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.

the class Lease_DownloadBudgetCalculationsForLease method downloadBudgetCalculationsForLease.

@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa = "fa-download")
@MemberOrder(name = "budgetCalculationRuns", sequence = "1")
public Blob downloadBudgetCalculationsForLease(Budget budget, BudgetCalculationType type) {
    final String fileName = lease.getReference() + " - budget details" + ".xlsx";
    WorksheetSpec spec = new WorksheetSpec(DetailedCalculationResultViewmodel.class, "values for lease");
    WorksheetContent worksheetContent = new WorksheetContent(budgetAssignmentService.getDetailedCalculationResults(lease, budget, type), spec);
    return excelService.toExcelPivot(worksheetContent, fileName);
}
Also used : WorksheetSpec(org.isisaddons.module.excel.dom.WorksheetSpec) WorksheetContent(org.isisaddons.module.excel.dom.WorksheetContent) Action(org.apache.isis.applib.annotation.Action) MemberOrder(org.apache.isis.applib.annotation.MemberOrder) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Example 7 with ActionLayout

use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.

the class Task_reprioritizePushback method act.

@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(contributed = Contributed.AS_ACTION, cssClassFa = "fa-arrow-right")
public Task act(final Integer pushbackByDays) {
    final LocalDateTime newDateTime = task.getCreatedOn().plusDays(pushbackByDays);
    task.setCreatedOn(newDateTime);
    return task;
}
Also used : LocalDateTime(org.joda.time.LocalDateTime) Action(org.apache.isis.applib.annotation.Action) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Example 8 with ActionLayout

use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.

the class T_createAndAttachDocumentAndScheduleRender method $$.

/**
 * Create a {@link Document} and attach using a {@link Paperclip}.
 */
@Action(domainEvent = ActionDomainEvent.class, semantics = SemanticsOf.NON_IDEMPOTENT)
@ActionLayout(contributed = Contributed.AS_ACTION)
@MemberOrder(name = "documents", sequence = "3.2")
public Object $$(final DocumentTemplate template) throws IOException {
    final Document document = documentCreatorService.createDocumentAndAttachPaperclips(domainObject, template);
    render(template, document);
    return document;
}
Also used : Document(org.incode.module.document.dom.impl.docs.Document) Action(org.apache.isis.applib.annotation.Action) MemberOrder(org.apache.isis.applib.annotation.MemberOrder) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Example 9 with ActionLayout

use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.

the class Document_delete method $$.

@Action(semantics = SemanticsOf.IDEMPOTENT_ARE_YOU_SURE, domainEvent = ActionDomainEvent.class)
@ActionLayout(cssClassFa = "trash")
public Object $$() {
    List<Object> attachedToList = Lists.newArrayList();
    // links from this document to other objects
    List<Paperclip> paperclips = paperclipRepository.findByDocument(document);
    for (Paperclip paperclip : paperclips) {
        final Object attachedTo = paperclip.getAttachedTo();
        attachedToList.add(attachedTo);
        paperclipRepository.delete(paperclip);
    }
    // links from other documents to this document
    paperclips = paperclipRepository.findByAttachedTo(document);
    for (Paperclip paperclip : paperclips) {
        paperclipRepository.delete(paperclip);
    }
    documentRepository.delete(document);
    // if was only attached to a single object, then return; otherwise return null.
    return attachedToList.size() == 1 ? attachedToList.get(0) : null;
}
Also used : Paperclip(org.incode.module.document.dom.impl.paperclips.Paperclip) Action(org.apache.isis.applib.annotation.Action) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Example 10 with ActionLayout

use of org.apache.isis.applib.annotation.ActionLayout in project estatio by estatio.

the class DemoInvoice_simulateRenderAsDoc method $$.

@Action(semantics = SemanticsOf.NON_IDEMPOTENT)
@ActionLayout(contributed = Contributed.AS_ACTION)
@MemberOrder(name = "documents", sequence = "1")
public Document $$(@Parameter(fileAccept = "application/pdf") final Blob document, @Parameter(optionality = Optionality.OPTIONAL) @ParameterLayout(named = "File name") final String fileName) throws IOException {
    String name = determineName(document, fileName);
    final DocumentType documentType = findDocumentType(DocumentType_and_DocumentTemplates_createSome.DOC_TYPE_REF_INVOICE);
    final Document receiptDoc = documentRepository.create(documentType, AT_PATH, name, document.getMimeType().getBaseType());
    // unlike documents that are generated from a template (where we call documentTemplate#render), in this case
    // we have the actual bytes; so we just set up the remaining state of the document manually.
    receiptDoc.setRenderedAt(clockService.nowAsDateTime());
    receiptDoc.setState(DocumentState.RENDERED);
    receiptDoc.setSort(DocumentSort.BLOB);
    receiptDoc.setBlobBytes(document.getBytes());
    paperclipRepository.attach(receiptDoc, ROLE_NAME, invoice);
    return receiptDoc;
}
Also used : DocumentType(org.incode.module.document.dom.impl.types.DocumentType) Document(org.incode.module.document.dom.impl.docs.Document) Action(org.apache.isis.applib.annotation.Action) MemberOrder(org.apache.isis.applib.annotation.MemberOrder) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Aggregations

ActionLayout (org.apache.isis.applib.annotation.ActionLayout)62 Action (org.apache.isis.applib.annotation.Action)61 Document (org.incode.module.document.dom.impl.docs.Document)22 MemberOrder (org.apache.isis.applib.annotation.MemberOrder)14 IncomingInvoice (org.estatio.module.capex.dom.invoice.IncomingInvoice)9 WorksheetSpec (org.isisaddons.module.excel.dom.WorksheetSpec)7 Blob (org.apache.isis.applib.value.Blob)6 ArrayList (java.util.ArrayList)5 WorksheetContent (org.isisaddons.module.excel.dom.WorksheetContent)5 DocumentTemplate (org.incode.module.document.dom.impl.docs.DocumentTemplate)3 DomainObject (org.apache.isis.applib.annotation.DomainObject)2 BudgetItem (org.estatio.module.budget.dom.budgetitem.BudgetItem)2 PartitionItem (org.estatio.module.budget.dom.partioning.PartitionItem)2 IncomingDocViewModel (org.estatio.module.capex.app.document.IncomingDocViewModel)2 Invoice (org.estatio.module.invoice.dom.Invoice)2 Lease (org.estatio.module.lease.dom.Lease)2 Organisation (org.estatio.module.party.dom.Organisation)2 DocumentType (org.incode.module.document.dom.impl.types.DocumentType)2 LocalDate (org.joda.time.LocalDate)2 LocalDateTime (org.joda.time.LocalDateTime)2