Package org.apache.isis.applib

Examples of org.apache.isis.applib.RecoverableException


                    getMessageBroker().addWarning(ex.getMessage());
                    return;

                } catch(final RuntimeException ex) {
                   
                    final RecoverableException appEx = ActionModel.getApplicationExceptionIfAny(ex);
                    if (appEx != null) {

                        recover();
                       
                        getMessageBroker().setApplicationError(appEx.getMessage());
                       
                        // there's no need to abort the transaction, it will have already been done
                        // (in IsisTransactionManager#executeWithinTransaction(...)).
                        return;
                    }
View Full Code Here


                    getMessageBroker().addWarning(ex.getMessage());
                    return;

                } catch(final RuntimeException ex) {
                   
                    final RecoverableException appEx = ActionModel.getApplicationExceptionIfAny(ex);
                    if (appEx != null) {

                        recover();
                       
                        getMessageBroker().setApplicationError(appEx.getMessage());
                       
                        // there's no need to abort the transaction, it will have already been done
                        // (in IsisTransactionManager#executeWithinTransaction(...)).
                        return;
                    }
View Full Code Here

            // TODO: some duplication between this code and ActionPanel

            // see if is an application-defined exception
            // if so, is converted to an application error,
            // equivalent to calling DomainObjectContainer#raiseError(...)
            final RecoverableException appEx = ActionModel.getApplicationExceptionIfAny(ex);
            if (appEx != null) {
                IsisContext.getMessageBroker().setApplicationError(appEx.getMessage());
                return null;
            }

            // not handled, so propagate
            throw ex;
View Full Code Here

            // TODO: some duplication between this code and ActionLinkFactoryAbstract
           
            // see if is an application-defined exception
            // if so, is converted to an application error,
            // equivalent to calling DomainObjectContainer#raiseError(...)
            final RecoverableException appEx = ActionModel.getApplicationExceptionIfAny(ex);
            if (appEx != null) {
                getMessageBroker().setApplicationError(appEx.getMessage());

                // there's no need to abort the transaction, it will have already been done
                // (in IsisTransactionManager#executeWithinTransaction(...)).
                return null;
            }
View Full Code Here

    public void demoException(final @Named("Type") DemoExceptionType type) {
        switch(type) {
        case NonRecoverableException:
            throw new NonRecoverableException("Demo throwing " + type.name());
        case RecoverableException:
            throw new RecoverableException("Demo throwing " + type.name());
        case RecoverableExceptionAutoEscalated:
            try {
                // this will trigger an exception (because category cannot be null), causing the xactn to be aborted
                setCategory(null);
                container.flush();
            } catch(Exception e) {
                // it's a programming mistake to throw only a recoverable exception here, because of the xactn's state.
                // the framework should instead auto-escalate this to a non-recoverable exception
                throw new RecoverableException("Demo throwing " + type.name(), e);
            }
        }
    }
View Full Code Here

    public Behaviour getSubscriberBehaviour() {
        return behaviour;
    }
    private void onExecutedVetoIfRequired() {
        if(behaviour == Behaviour.AnyExecuteVetoWithRecoverableException) {
            throw new RecoverableException("Rejecting event (recoverable exception thrown)");
        }
        if(behaviour == Behaviour.AnyExecuteVetoWithNonRecoverableException) {
            throw new NonRecoverableException("Rejecting event (recoverable exception thrown)");
        }
        if(behaviour == Behaviour.AnyExecuteVetoWithOtherException) {
View Full Code Here

                onExecutedVetoIfRequired();

                if(ev.getIdentifier().getMemberName().contains("description")) {
                    String newValue = (String) ev.getNewValue();
                    if(newValue.matches(".*demo veto.*")) {
                        throw new RecoverableException("oh no you don't! " + ev.getNewValue());
                    }
                }
                break;
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.applib.RecoverableException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.