org.apache.myfaces.orchestra.conversation.jsf.lib
Class _EndConversationMethodBindingFacade

java.lang.Object
  extended by javax.faces.el.MethodBinding
      extended by org.apache.myfaces.orchestra.conversation.jsf.lib._EndConversationMethodBindingFacade
All Implemented Interfaces:
javax.faces.component.StateHolder

public class _EndConversationMethodBindingFacade
extends javax.faces.el.MethodBinding
implements javax.faces.component.StateHolder

A facade for the original method binding to deal with end conversation conditions.

This class implements MethodBinding, ie represents an EL expression string that specifies a method to call. It is expected to be used when invoking action methods when the current conversation should be closed upon certain results of the action.

This facade also enhances error-handling for action methods. If the invoked method throws an exception of any kind, and an errorOutcome value has been specified then the errorOutcome is returned instead of allowing the exception to propagate. The exception that occurred is reported to the ConversationMessager object associated with the conversation, so it can choose whether and how to present the error to the user.


Constructor Summary
_EndConversationMethodBindingFacade()
           
_EndConversationMethodBindingFacade(java.lang.String conversation, java.util.Collection onOutcomes, javax.faces.el.MethodBinding original, java.lang.String errorOutcome)
          Constructor.
 
Method Summary
 java.lang.String getConversationName()
           
 java.lang.String getExpressionString()
           
 java.lang.Class getType(javax.faces.context.FacesContext context)
           
 java.lang.Object invoke(javax.faces.context.FacesContext context, java.lang.Object[] values)
           
 boolean isTransient()
          Required by StateHolder interface.
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object states)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
 void setTransient(boolean newTransientValue)
          Required by StateHolder interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

_EndConversationMethodBindingFacade

public _EndConversationMethodBindingFacade()

_EndConversationMethodBindingFacade

public _EndConversationMethodBindingFacade(java.lang.String conversation,
                                           java.util.Collection onOutcomes,
                                           javax.faces.el.MethodBinding original,
                                           java.lang.String errorOutcome)
Constructor.

Parameters:
conversation - is the name of the conversation to conditionally be closed.
onOutcomes - is a collection of navigation strings that may be returned from the invoked method. One of the following rules is then used to determine whether the conversation is ended or not:
  • If there was no action to invoke, end the conversation, else
  • If the action returned null, do not end the conversation, else
  • If the onOutcomes list is null or empty then end the conversation, else
  • If the returned value is in the onOutcomes list, then end the conversation, else
  • do not end the conversation.
original - is the EL expression to be invoked.
errorOutcome - is a JSF navigation string to be returned if the action method throws an exception of any kind. This navigation value is checked against the onOutcomes values just as if the action method had actually returned this value. When not specified, then on exception the current conversation is not ended.
Method Detail

getConversationName

public java.lang.String getConversationName()

getExpressionString

public java.lang.String getExpressionString()
Overrides:
getExpressionString in class javax.faces.el.MethodBinding

getType

public java.lang.Class getType(javax.faces.context.FacesContext context)
                        throws javax.faces.el.MethodNotFoundException
Specified by:
getType in class javax.faces.el.MethodBinding
Throws:
javax.faces.el.MethodNotFoundException

invoke

public java.lang.Object invoke(javax.faces.context.FacesContext context,
                               java.lang.Object[] values)
                        throws javax.faces.el.EvaluationException,
                               javax.faces.el.MethodNotFoundException
Specified by:
invoke in class javax.faces.el.MethodBinding
Throws:
javax.faces.el.EvaluationException
javax.faces.el.MethodNotFoundException

setTransient

public void setTransient(boolean newTransientValue)
Required by StateHolder interface.

Specified by:
setTransient in interface javax.faces.component.StateHolder

isTransient

public boolean isTransient()
Required by StateHolder interface.

Specified by:
isTransient in interface javax.faces.component.StateHolder

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object states)
Specified by:
restoreState in interface javax.faces.component.StateHolder

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder


Copyright © 2009 The Apache Software Foundation. All Rights Reserved.