Search in sources :

Example 96 with Action

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

the class IncomingInvoice_reject method act.

@Action(domainEvent = IncomingInvoice_next.ActionDomainEvent.class, semantics = SemanticsOf.IDEMPOTENT)
@ActionLayout(cssClassFa = "fa-thumbs-o-down", cssClass = "btn-warning")
public Object act(final String role, @Nullable final Person personToAssignNextTo, final String reason) {
    final List<PaymentLine> paymentLines = paymentLineRepository.findByInvoice(incomingInvoice);
    // because of the disableXxx guard, this should return either 0 or 1 lines.
    for (PaymentLine paymentLine : paymentLines) {
        final PaymentBatch paymentBatch = paymentLine.getBatch();
        paymentBatch.removeLineFor(incomingInvoice);
    }
    trigger(personToAssignNextTo, reason, reason);
    return objectToReturn();
}
Also used : PaymentLine(org.estatio.module.capex.dom.payment.PaymentLine) PaymentBatch(org.estatio.module.capex.dom.payment.PaymentBatch) Action(org.apache.isis.applib.annotation.Action) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Example 97 with Action

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

the class ProjectItem method amendAmount.

@Action(semantics = SemanticsOf.IDEMPOTENT)
public ProjectItem amendAmount(@Parameter(optionality = Optionality.OPTIONAL) final BigDecimal add, @Parameter(optionality = Optionality.OPTIONAL) final BigDecimal subtract) {
    BigDecimal newAmount = getBudgetedAmount() != null ? getBudgetedAmount() : BigDecimal.ZERO;
    if (add != null) {
        newAmount = newAmount.add(add);
    }
    if (subtract != null) {
        newAmount = newAmount.subtract(subtract);
    }
    setBudgetedAmount(newAmount);
    return this;
}
Also used : BigDecimal(java.math.BigDecimal) Action(org.apache.isis.applib.annotation.Action)

Example 98 with Action

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

the class InvoiceImportManager method getLines.

@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(contributed = Contributed.AS_ASSOCIATION)
public List<InvoiceImportLine> getLines() {
    List<InvoiceImportLine> result = new ArrayList<>();
    for (Lease lease : leaseRepository.findByAssetAndActiveOnDate(getProperty(), clockService.now())) {
        PaymentMethod paymentMethod = null;
        Unit unit = lease.primaryOccupancy().get().getUnit();
        if (lease.getItems().size() > 0) {
            if (leaseItemRepository.findLeaseItemsByType(lease, LeaseItemType.RENT).size() > 0) {
                paymentMethod = leaseItemRepository.findLeaseItemsByType(lease, LeaseItemType.RENT).get(0).getPaymentMethod();
            } else {
                paymentMethod = lease.getItems().first().getPaymentMethod();
            }
            result.add(new InvoiceImportLine(lease.getReference(), null, paymentMethod.name(), null, null, null, null, null, unit.getReference()));
        } else {
            result.add(new InvoiceImportLine(lease.getReference(), null, null, null, null, null, null, null, unit.getReference()));
        }
    }
    return result;
}
Also used : Lease(org.estatio.module.lease.dom.Lease) ArrayList(java.util.ArrayList) PaymentMethod(org.estatio.module.invoice.dom.PaymentMethod) Unit(org.estatio.module.asset.dom.Unit) Action(org.apache.isis.applib.annotation.Action) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Example 99 with Action

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

the class InvoiceImportManager method downloadTemplate.

@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa = "fa-download")
public Blob downloadTemplate() {
    final String fileName = "template.xlsx";
    WorksheetSpec spec = new WorksheetSpec(InvoiceImportLine.class, "invoiceImportLine");
    WorksheetContent worksheetContent = new WorksheetContent(getLines(), spec);
    return excelService.toExcel(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) ActionLayout(org.apache.isis.applib.annotation.ActionLayout)

Example 100 with Action

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

the class Object_links method $$.

// endregion
@Action(semantics = SemanticsOf.SAFE)
public URL $$(final Link link) throws MalformedURLException {
    final Root root = new Root(domainObject) {

        @SuppressWarnings("unused")
        public String getReportServerBaseUrl() {
            return reportServerSettingsService.fetchReportServerBaseUrl();
        }
    };
    final String urlStr = stringInterpolator.interpolate(root, link.getUrlTemplate());
    return new URL(urlStr);
}
Also used : Root(org.isisaddons.module.stringinterpolator.dom.StringInterpolatorService.Root) URL(java.net.URL) Action(org.apache.isis.applib.annotation.Action)

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