use of org.estatio.module.base.platform.applib.ReasonBuffer2 in project estatio by estatio.
the class IncomingInvoiceItem method projectIsImmutableReason.
String projectIsImmutableReason() {
// nb: dimensions *are* allowed to change irrespective of state,
// so we don't check IncomingInvoice#isImmutableDueToState()
final ReasonBuffer2 buf = ReasonBuffer2.forAll("Project cannot be changed because");
appendReasonIfReversalOrReported(buf);
appendReasonIfLinkedToAnOrder(buf);
return buf.getReason();
}
use of org.estatio.module.base.platform.applib.ReasonBuffer2 in project estatio by estatio.
the class InvoiceItem method disableChangeTax.
public String disableChangeTax() {
ReasonBuffer2 buf = ReasonBuffer2.forSingle("Can't change tax because");
appendReasonChangeTaxDisabledIfAny(buf);
return buf.getReason();
}
use of org.estatio.module.base.platform.applib.ReasonBuffer2 in project estatio by estatio.
the class IncomingDocAsInvoiceViewModel method reasonNotEditableIfAny.
@Override
protected String reasonNotEditableIfAny() {
final ReasonBuffer2 buf = ReasonBuffer2.forSingle();
buf.append(getIncomingInvoiceType() == null, "Incoming invoice type is required");
buf.append(() -> getIncomingInvoiceType().validateProperty(getProperty()));
buf.append(() -> {
final Object viewContext = IncomingDocAsInvoiceViewModel.this;
return getDomainObject().reasonDisabledDueToState(viewContext);
});
buf.append(() -> {
final IncomingInvoice incomingInvoice = getDomainObject();
SortedSet<InvoiceItem> items = incomingInvoice.getItems();
return items.size() > 1 ? "Only simple invoices with 1 item can be maintained using this view" : null;
});
return buf.getReason();
}
use of org.estatio.module.base.platform.applib.ReasonBuffer2 in project estatio by estatio.
the class ReasonBuffer2_Test method with_prefix_first_and_condition.
@Test
public void with_prefix_first_and_condition() throws Exception {
final ReasonBuffer2 buf = ReasonBuffer2.forSingle("Cannot change");
buf.append((() -> true), "reason #1");
buf.append(false, "reason #2");
buf.append(true, "reason #3");
Assertions.assertThat(buf.getReason()).isEqualTo("Cannot change reason #1");
}
use of org.estatio.module.base.platform.applib.ReasonBuffer2 in project estatio by estatio.
the class ReasonBuffer2_Test method with_prefix_first.
@Test
public void with_prefix_first() throws Exception {
final ReasonBuffer2 buf = ReasonBuffer2.forSingle("Cannot change");
buf.append(true, "reason #1");
buf.append(false, "reason #2");
buf.append(true, "reason #3");
Assertions.assertThat(buf.getReason()).isEqualTo("Cannot change reason #1");
}
Aggregations