protected void processException( final Throwable exception, final Object event) { final AbstractDomainEvent<?> domainEvent = asDomainEvent(event); if (domainEvent == null) { if (LOG.isDebugEnabled()) { LOG.debug("Ignoring exception '%s' (%s), not a subclass of AbstractDomainEvent", exception.getMessage(), exception.getClass().getName()); } return; } if(LOG.isDebugEnabled()) { LOG.debug("Exception stack trace (to help diagnose issue): ", exception); } final AbstractDomainEvent.Phase phase = domainEvent.getEventPhase(); switch (phase) { case HIDE: case DISABLE: case VALIDATE: veto(exception, domainEvent, phase); break; case EXECUTING: case EXECUTED: abort(exception, phase); throw new RuntimeException(exception); } }
switch (getEventPhase()) { case HIDE: hide();
/** * Use instead of {@link #hide()}, {@link #disable(org.apache.isis.applib.services.i18n.TranslatableString)} and {@link #invalidate(org.apache.isis.applib.services.i18n.TranslatableString)}; just delegates to * appropriate vetoing method based upon the {@link #getEventPhase() phase}. * * <p> * If hiding, just pass <tt>null</tt> for the parameter. * </p> * * @param translatableReason - reason why the interaction is being invalidated (ignored if in {@link org.apache.isis.applib.services.eventbus.AbstractDomainEvent.Phase#HIDE hide} phase). * * @see #veto(String, Object...) */ @Programmatic public void veto(final TranslatableString translatableReason) { switch (getEventPhase()) { case HIDE: hide(); break; case DISABLE: disable(translatableReason); break; case VALIDATE: invalidate(translatableReason); break; } } //endregion