Search in sources :

Example 26 with ReasonBuffer2

use of org.estatio.module.base.platform.applib.ReasonBuffer2 in project estatio by estatio.

the class Order_discard method disableAct.

public String disableAct() {
    ReasonBuffer2 buf = ReasonBuffer2.forSingle();
    buf.append(!linkRepository.findByOrder(order).isEmpty(), "One or more items have been linked to an invoice");
    buf.append(reasonGuardNotSatisified());
    return buf.getReason();
}
Also used : ReasonBuffer2(org.estatio.module.base.platform.applib.ReasonBuffer2)

Example 27 with ReasonBuffer2

use of org.estatio.module.base.platform.applib.ReasonBuffer2 in project estatio by estatio.

the class IncomingInvoiceItem_createOrderItemLink method validate0Act.

public String validate0Act(final OrderItem orderItem) {
    ReasonBuffer2 buf = ReasonBuffer2.forAll("Cannot link to this order item");
    buf.append(() -> mixee.getCharge() != orderItem.getCharge(), "charge is different");
    buf.append(() -> mixee.getProject() != orderItem.getProject(), "project is different");
    buf.append(() -> mixee.getFixedAsset() != orderItem.getProperty(), "property is different");
    return buf.getReason();
}
Also used : ReasonBuffer2(org.estatio.module.base.platform.applib.ReasonBuffer2)

Example 28 with ReasonBuffer2

use of org.estatio.module.base.platform.applib.ReasonBuffer2 in project estatio by estatio.

the class IncomingInvoiceItem_createOrderItemLink method disableAct.

public String disableAct() {
    ReasonBuffer2 buf = ReasonBuffer2.forSingle();
    buf.append(() -> orderItemInvoiceItemLinkRepository.findByInvoiceItem(mixee).isPresent(), "Already linked to an order item");
    buf.append(() -> mixee.getInvoice().getSeller() == null, "Invoice's seller is required before items can be linked");
    return buf.getReason();
}
Also used : ReasonBuffer2(org.estatio.module.base.platform.applib.ReasonBuffer2)

Example 29 with ReasonBuffer2

use of org.estatio.module.base.platform.applib.ReasonBuffer2 in project estatio by estatio.

the class IncomingInvoiceItem_removeOrderItemLink method disableAct.

public String disableAct() {
    ReasonBuffer2 buf = ReasonBuffer2.forSingle();
    buf.append(() -> !orderItemIfAny().isPresent(), "Not linked to an order item");
    buf.append(() -> mixee.getReportedDate() != null, "Invoice item has been reported");
    buf.append(() -> mixee.getReversalOf() != null, "Invoice item is a reversal");
    return buf.getReason();
}
Also used : ReasonBuffer2(org.estatio.module.base.platform.applib.ReasonBuffer2)

Example 30 with ReasonBuffer2

use of org.estatio.module.base.platform.applib.ReasonBuffer2 in project estatio by estatio.

the class IncomingInvoice method disableEditBuyer.

public String disableEditBuyer() {
    final ReasonBuffer2 buf = ReasonBuffer2.forSingle("Cannot edit buyer because");
    final Object viewContext = this;
    reasonDisabledDueToApprovalStateIfAny(viewContext, buf);
    return buf.getReason();
}
Also used : DomainObject(org.apache.isis.applib.annotation.DomainObject) ReasonBuffer2(org.estatio.module.base.platform.applib.ReasonBuffer2)

Aggregations

ReasonBuffer2 (org.estatio.module.base.platform.applib.ReasonBuffer2)40 Test (org.junit.Test)10 DomainObject (org.apache.isis.applib.annotation.DomainObject)7 IncomingInvoice (org.estatio.module.capex.dom.invoice.IncomingInvoice)1 IncomingInvoiceItem (org.estatio.module.capex.dom.invoice.IncomingInvoiceItem)1 InvoiceItem (org.estatio.module.invoice.dom.InvoiceItem)1