use of org.apache.isis.applib.annotation.Action in project estatio by estatio.
the class BankAccount_attachPdfAsIbanProof method act.
@Action(semantics = SemanticsOf.IDEMPOTENT, commandDtoProcessor = DeriveBlobFromDummyPdfArg0.class)
public BankAccount act(@Parameter(fileAccept = "application/pdf") final Blob document) {
final DocumentType ibanProofDocType = DocumentTypeData.IBAN_PROOF.findUsing(documentTypeRepository);
final List<Paperclip> ibanProofPaperclips = paperclipRepository.findByAttachedToAndRoleName(bankAccount, ROLE_NAME_FOR_IBAN_PROOF);
// delete all existing paperclips for this role whose type is also not IBAN_PROOF
// (ie any incoming invoices that were automatically attached as candidate iban proofs)
final Predicate<Paperclip> hasIbanProofDocType = paperclip -> Objects.equals(ibanProofDocType, paperclip.getDocument().getType());
final Predicate<Paperclip> doesNotHaveIbanProofDocType = hasIbanProofDocType.negate();
ibanProofPaperclips.stream().filter(doesNotHaveIbanProofDocType).forEach(paperclip -> paperclipRepository.delete(paperclip));
final String name = document.getName();
documentService.createAndAttachDocumentForBlob(ibanProofDocType, bankAccount.getAtPath(), name, document, ROLE_NAME_FOR_IBAN_PROOF, bankAccount);
return bankAccount;
}
use of org.apache.isis.applib.annotation.Action in project estatio by estatio.
the class Order_switchView method act.
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(contributed = Contributed.AS_ACTION, // not sure why this isn't being picked up from isis-non-changing.properties
cssClassFa = "fa-exchange")
@MemberOrder(sequence = "1")
public IncomingDocAsOrderViewModel act() {
Optional<Document> documentIfAny = lookupAttachedPdfService.lookupOrderPdfFrom(order);
Document document = documentIfAny.get();
final IncomingDocAsOrderViewModel viewModel = new IncomingDocAsOrderViewModel(order, document);
serviceRegistry2.injectServicesInto(viewModel);
viewModel.init();
return viewModel;
}
use of org.apache.isis.applib.annotation.Action in project estatio by estatio.
the class PaymentBatchManager method autoCreateBatches.
@Action(semantics = SemanticsOf.IDEMPOTENT, publishing = Publishing.DISABLED)
public PaymentBatchManager autoCreateBatches(@Nullable final List<IncomingInvoice> payableInvoices) {
for (final IncomingInvoice payableInvoice : payableInvoices) {
final BankAccount uniqueBankAccountIfAny = debtorBankAccountService.uniqueDebtorAccountToPay(payableInvoice);
if (uniqueBankAccountIfAny != null && uniqueBankAccountIfAny.getBic() != null) {
// should be true, because those that don't pass this are filtered out in choicesXxx anyway.
PaymentBatch paymentBatch = paymentBatchRepository.findOrCreateNewByDebtorBankAccount(uniqueBankAccountIfAny);
paymentBatch.addLineIfRequired(payableInvoice);
}
}
final List<PaymentBatch> newBatches = getNewBatches();
for (final PaymentBatch paymentBatch : newBatches) {
removeNegativeTransfers(paymentBatch);
}
return new PaymentBatchManager(newBatches.isEmpty() ? null : 0);
}
use of org.apache.isis.applib.annotation.Action in project estatio by estatio.
the class PaymentBatchManager method downloadExcelExportForNewBatches.
@Action(semantics = SemanticsOf.SAFE, commandPersistence = CommandPersistence.NOT_PERSISTED, publishing = Publishing.DISABLED)
public Blob downloadExcelExportForNewBatches(@Nullable final String documentName, @Nullable final List<PaymentBatch> newPaymentBatches) {
List<PaymentLineForExcelExportV1> lineVms = new ArrayList<>();
for (PaymentBatch batch : newPaymentBatches) {
lineVms.addAll(batch.paymentLinesForExcelExport());
}
String name = documentName != null ? documentName.concat(".xlsx") : "export.xlsx";
return excelService.toExcel(lineVms, PaymentLineForExcelExportV1.class, "export", name);
}
use of org.apache.isis.applib.annotation.Action in project estatio by estatio.
the class PaymentBatchMenu method preparePaymentBatches.
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa = "fa-magic")
@MemberOrder(sequence = "300.10")
public PaymentBatchManager preparePaymentBatches() {
final PaymentBatchManager paymentBatchManager = new PaymentBatchManager();
serviceRegistry2.injectServicesInto(paymentBatchManager);
return new PaymentBatchManager();
}
Aggregations