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