Search in sources :

Example 81 with Action

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;
}
Also used : Action(org.apache.isis.applib.annotation.Action) DocumentType(org.incode.module.document.dom.impl.types.DocumentType) PaperclipRepository(org.incode.module.document.dom.impl.paperclips.PaperclipRepository) Paperclip(org.incode.module.document.dom.impl.paperclips.Paperclip) Predicate(java.util.function.Predicate) DocumentTypeRepository(org.incode.module.document.dom.impl.types.DocumentTypeRepository) Objects(java.util.Objects) Inject(javax.inject.Inject) Mixin(org.apache.isis.applib.annotation.Mixin) SemanticsOf(org.apache.isis.applib.annotation.SemanticsOf) List(java.util.List) DocumentService(org.incode.module.document.dom.api.DocumentService) DeriveBlobFromDummyPdfArg0(org.incode.module.base.spi.DeriveBlobFromDummyPdfArg0) BankAccount(org.estatio.module.financial.dom.BankAccount) Parameter(org.apache.isis.applib.annotation.Parameter) Blob(org.apache.isis.applib.value.Blob) DocumentTypeData(org.estatio.module.invoice.dom.DocumentTypeData) Paperclip(org.incode.module.document.dom.impl.paperclips.Paperclip) DocumentType(org.incode.module.document.dom.impl.types.DocumentType) Action(org.apache.isis.applib.annotation.Action)

Example 82 with Action

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;
}
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 83 with Action

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);
}
Also used : IncomingInvoice(org.estatio.module.capex.dom.invoice.IncomingInvoice) BankAccount(org.estatio.module.financial.dom.BankAccount) PaymentBatch(org.estatio.module.capex.dom.payment.PaymentBatch) Action(org.apache.isis.applib.annotation.Action)

Example 84 with Action

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);
}
Also used : ArrayList(java.util.ArrayList) PaymentLineForExcelExportV1(org.estatio.module.capex.app.paymentline.PaymentLineForExcelExportV1) PaymentBatch(org.estatio.module.capex.dom.payment.PaymentBatch) Action(org.apache.isis.applib.annotation.Action)

Example 85 with Action

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();
}
Also used : PaymentBatchManager(org.estatio.module.capex.app.paymentbatch.PaymentBatchManager) Action(org.apache.isis.applib.annotation.Action) MemberOrder(org.apache.isis.applib.annotation.MemberOrder) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Aggregations

Action (org.apache.isis.applib.annotation.Action)117 ActionLayout (org.apache.isis.applib.annotation.ActionLayout)63 MemberOrder (org.apache.isis.applib.annotation.MemberOrder)31 Document (org.incode.module.document.dom.impl.docs.Document)23 IncomingInvoice (org.estatio.module.capex.dom.invoice.IncomingInvoice)12 ArrayList (java.util.ArrayList)11 Blob (org.apache.isis.applib.value.Blob)10 WorksheetSpec (org.isisaddons.module.excel.dom.WorksheetSpec)10 LocalDate (org.joda.time.LocalDate)9 WorksheetContent (org.isisaddons.module.excel.dom.WorksheetContent)8 DomainObject (org.apache.isis.applib.annotation.DomainObject)6 DateTime (org.joda.time.DateTime)6 List (java.util.List)5 SemanticsOf (org.apache.isis.applib.annotation.SemanticsOf)5 PaymentBatch (org.estatio.module.capex.dom.payment.PaymentBatch)5 BankAccount (org.estatio.module.financial.dom.BankAccount)5 Lease (org.estatio.module.lease.dom.Lease)5 Organisation (org.estatio.module.party.dom.Organisation)5 BigDecimal (java.math.BigDecimal)4 Collectors (java.util.stream.Collectors)4