use of org.apache.isis.applib.services.wrapper.DisabledException in project estatio by estatio.
the class InvoiceSummaryAbstract method validate0InvoiceAll.
public String validate0InvoiceAll(final LocalDate invoiceDate) {
for (Invoice invoice : getInvoices()) {
try {
final InvoiceForLease._invoice mixin = mixin(InvoiceForLease._invoice.class, invoice);
wrapperFactory.wrapNoExecute(mixin).$$(invoiceDate);
} catch (InvalidException ex) {
final String reasonMessage = ex.getInteractionEvent() != null ? ex.getInteractionEvent().getReason() : null;
return titleService.titleOf(invoice) + ": " + (reasonMessage != null ? reasonMessage : ex.getMessage());
} catch (HiddenException | DisabledException ex) {
// ignore
}
}
return null;
}
use of org.apache.isis.applib.services.wrapper.DisabledException in project estatio by estatio.
the class IncomingInvoiceApprovalState_IntegTest method complete_should_fail_when_not_having_appropriate_role_type_test.
@Test
public void complete_should_fail_when_not_having_appropriate_role_type_test() {
Exception error = new Exception();
// given
Person personEmmaWithNoRoleAsPropertyManager = (Person) partyRepository.findPartyByReference(Person_enum.EmmaTreasurerGb.getRef());
SortedSet<PartyRole> rolesforEmma = personEmmaWithNoRoleAsPropertyManager.getRoles();
assertThat(rolesforEmma.size()).isEqualTo(1);
assertThat(rolesforEmma.first().getRoleType()).isEqualTo(partyRoleTypeRepository.findByKey(PartyRoleTypeEnum.TREASURER.getKey()));
// when
try {
// workaround: clear MeService#me cache
queryResultsCache.resetForNextTransaction();
sudoService.sudo(Person_enum.EmmaTreasurerGb.getRef().toLowerCase(), (Runnable) () -> wrap(mixin(IncomingInvoice_complete.class, incomingInvoice)).act("PROPERTY_MANAGER", null, null));
} catch (DisabledException e) {
error = e;
}
assertThat(error.getMessage()).isNotNull();
assertThat(error.getMessage()).contains("Reason: Task assigned to 'PROPERTY_MANAGER' role");
}
use of org.apache.isis.applib.services.wrapper.DisabledException in project estatio by estatio.
the class IncomingInvoiceApprovalState_IntegTest method complete_works_when_having_appropriate_role_type_test.
@Test
public void complete_works_when_having_appropriate_role_type_test() {
Exception error = new Exception();
// given
Person personEmma = (Person) partyRepository.findPartyByReference(Person_enum.EmmaTreasurerGb.getRef());
PartyRoleType roleAsPropertyManager = partyRoleTypeRepository.findByKey("PROPERTY_MANAGER");
personEmma.addRole(roleAsPropertyManager);
transactionService.nextTransaction();
SortedSet<PartyRole> rolesforEmma = personEmma.getRoles();
assertThat(rolesforEmma.size()).isEqualTo(2);
assertThat(rolesforEmma.first().getRoleType()).isEqualTo(partyRoleTypeRepository.findByKey("PROPERTY_MANAGER"));
// when
try {
// workaround: clear MeService#me cache
queryResultsCache.resetForNextTransaction();
sudoService.sudo(Person_enum.EmmaTreasurerGb.getRef().toLowerCase(), (Runnable) () -> wrap(mixin(IncomingInvoice_complete.class, incomingInvoice)).act("PROPERTY_MANAGER", null, null));
} catch (DisabledException e) {
error = e;
}
assertThat(error.getMessage()).isNull();
assertThat(incomingInvoice.getApprovalState()).isEqualTo(IncomingInvoiceApprovalState.COMPLETED);
}
Aggregations