org.apache.shale.view
Class AbstractFacesBean

java.lang.Object
  extended by org.apache.shale.view.AbstractFacesBean
Direct Known Subclasses:
AbstractApplicationBean, AbstractRequestBean, AbstractSessionBean, AbstractViewController

public abstract class AbstractFacesBean
extends Object

Convenient abstract base class for application beans that wish to interact with JavaServer Faces request processing facilities. WARNING - These methods are only effective during the lifecycle of a JavaServer Faces request.

$Id: AbstractFacesBean.java 464373 2006-10-16 04:21:54Z rahul $


Constructor Summary
AbstractFacesBean()
           
 
Method Summary
protected  void erase()
          Erase submitted values on all EditableValueHolder components in the current view.
protected  void error(String summary)
          Enqueue a global FacesMessage (not associated with any particular component) containing the specified summary text and a message severity level of FacesMessage.SEVERITY_ERROR.
protected  void error(javax.faces.component.UIComponent component, String summary)
          Enqueue a FacesMessage (associated with the specified component) containing the specified summary text and a message severity level of FacesMessage.SEVERITY_ERROR.
protected  void fatal(String summary)
          Enqueue a global FacesMessage (not associated with any particular component) containing the specified summary text and a message severity level of FacesMessage.SEVERITY_FATAL.
protected  void fatal(javax.faces.component.UIComponent component, String summary)
          Enqueue a FacesMessage (associated with the specified component) containing the specified summary text and a message severity level of FacesMessage.SEVERITY_FATAL.
protected  javax.faces.application.Application getApplication()
          Retiurn the Application instance for the current web application.
protected  Map getApplicationMap()
          Return a Map of the application scope attributes for this web application.
protected  Object getBean(String name)
          Return the named bean from request, session, or application scope.
protected  javax.faces.context.ExternalContext getExternalContext()
          Return the ExternalContext instance for the current request.
protected  javax.faces.context.FacesContext getFacesContext()
          Return the FacesContext instance for the current request.
protected  javax.faces.lifecycle.Lifecycle getLifecycle()
          Return the configured Lifecycle instance for the current application.
protected  Map getRequestHeaderMap()
          Return a Map of the request headers included in this request.
protected  Map getRequestMap()
          Return a Map of the request scope attributes for this request.
 String getRequestParameter(String name)
          Return the first (or only) value for the specified request parameter.
protected  Map getRequestParameterMap()
          Return a Map of the request parameters included in this request.
 String[] getRequestParameterValues(String name)
          Return an array of all the values for the specified request parameter, if there are any.
protected  Map getSessionMap()
          Return a Map of the session scope attributes for the current user.
protected  Object getValue(String expr)
          Evaluate the specified value binding expression and return the value it points at.
protected  void info(String summary)
          Enqueue a global FacesMessage (not associated with any particular component) containing the specified summary text and a message severity level of FacesMessage.SEVERITY_INFO.
protected  void info(javax.faces.component.UIComponent component, String summary)
          Enqueue a FacesMessage (associated with the specified component) containing the specified summary text and a message severity level of FacesMessage.SEVERITY_INFO.
protected  void log(String message)
          Log the specified message to the server's log file.
protected  void log(String message, Throwable throwable)
          Log the specified message and exception to the server's log file.
 Object retrieveData(String key)
          Return the data object stored (typically when the component tree was previously rendered) under the specified key, if any; otherwise, return null.
 void saveData(String key, Object data)
          Save the specified data object (which MUST be Serializable) under the specified key, such that it can be retrieved (via getData()) on a s subsequent request immediately after the component tree has been restored.
protected  void setBean(String name, Object value)
          Replace the value of any attribute stored in request scope, session scope, or application scope, under the specified name.
protected  void setValue(String expr, Object value)
          Evaluate the specified value binding expression, and replace the value it points at.
protected  void warn(String summary)
          Enqueue a global FacesMessage (not associated with any particular component) containing the specified summary text and a message severity level of FacesMessage.SEVERITY_WARN.
protected  void warn(javax.faces.component.UIComponent component, String summary)
          Enqueue a FacesMessage (associated with the specified component) containing the specified summary text and a message severity level of FacesMessage.SEVERITY_WARN.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFacesBean

public AbstractFacesBean()
Method Detail

getApplication

protected javax.faces.application.Application getApplication()

Retiurn the Application instance for the current web application.


getApplicationMap

protected Map getApplicationMap()

Return a Map of the application scope attributes for this web application.


getExternalContext

protected javax.faces.context.ExternalContext getExternalContext()

Return the ExternalContext instance for the current request.


getFacesContext

protected javax.faces.context.FacesContext getFacesContext()

Return the FacesContext instance for the current request.


getLifecycle

protected javax.faces.lifecycle.Lifecycle getLifecycle()

Return the configured Lifecycle instance for the current application.


getRequestHeaderMap

protected Map getRequestHeaderMap()

Return a Map of the request headers included in this request. If there is more than one header for a particular header name, only the first value is included in this map.


getRequestMap

protected Map getRequestMap()

Return a Map of the request scope attributes for this request.


getRequestParameterMap

protected Map getRequestParameterMap()

Return a Map of the request parameters included in this request. If there is more than one value for a particular parameter name, only the first value is included in this map.


getSessionMap

protected Map getSessionMap()

Return a Map of the session scope attributes for the current user.


getBean

protected Object getBean(String name)

Return the named bean from request, session, or application scope. If this is a managed bean, it might also get created as a side effect. Return null if no such bean can be found or created.

Parameters:
name - Name of the desired bean

setBean

protected void setBean(String name,
                       Object value)

Replace the value of any attribute stored in request scope, session scope, or application scope, under the specified name. If there is no such value, store this value as a new request scope attribute under the specified name.

Parameters:
name - Name of the attribute to replace or create
value - Value to be stored

getValue

protected Object getValue(String expr)

Evaluate the specified value binding expression and return the value it points at.

Parameters:
expr - Value binding expression to be evaluated

setValue

protected void setValue(String expr,
                        Object value)

Evaluate the specified value binding expression, and replace the value it points at.

Parameters:
expr - Value binding expression pointing at a writeable property
value - New value to store there

retrieveData

public Object retrieveData(String key)

Return the data object stored (typically when the component tree was previously rendered) under the specified key, if any; otherwise, return null.

IMPLEMENTATION NOTE: Data objects will become available only after the Restore View phase of the request processing lifecycle has been completed. A common place to reinitialize state information, then, would be in the preprocess() event handler of a ViewController backing bean.

Parameters:
key - Key under which to retrieve the requested data

saveData

public void saveData(String key,
                     Object data)

Save the specified data object (which MUST be Serializable) under the specified key, such that it can be retrieved (via getData()) on a s subsequent request immediately after the component tree has been restored.

IMPLEMENTATION NOTE: In order to successfully save data objects, this method must be called before the Render Response phase of the request processing lifecycle is executed. A common scenario is to save state information in the prerender() event handler of a ViewController backing bean.

Parameters:
key - Key under which to store the requested data
data - Data object to be stored

erase

protected void erase()

Erase submitted values on all EditableValueHolder components in the current view. This method should be called if you have input components bound to data values, submit the form, and then arbitrarily change the data that the binding points at without going through the Update Model Values phase of the request processing lifecycle.


getRequestParameter

public String getRequestParameter(String name)

Return the first (or only) value for the specified request parameter. If no such request parameter exists for the current requset, return null instead.

Parameters:
name - Name of the request parameter to look for

getRequestParameterValues

public String[] getRequestParameterValues(String name)

Return an array of all the values for the specified request parameter, if there are any. If no such request parameter exists for the current request, return null instead.

Parameters:
name - Name of the request parameter to look for

log

protected void log(String message)

Log the specified message to the server's log file.

Parameters:
message - Message to be logged

log

protected void log(String message,
                   Throwable throwable)

Log the specified message and exception to the server's log file.

Parameters:
message - Message to be logged
throwable - Exception to be logged

info

protected void info(String summary)

Enqueue a global FacesMessage (not associated with any particular component) containing the specified summary text and a message severity level of FacesMessage.SEVERITY_INFO.

Parameters:
summary - Summary text for this message

info

protected void info(javax.faces.component.UIComponent component,
                    String summary)

Enqueue a FacesMessage (associated with the specified component) containing the specified summary text and a message severity level of FacesMessage.SEVERITY_INFO.

Parameters:
component - Component with which this message is associated
summary - Summary text for this message

warn

protected void warn(String summary)

Enqueue a global FacesMessage (not associated with any particular component) containing the specified summary text and a message severity level of FacesMessage.SEVERITY_WARN.

Parameters:
summary - Summary text for this message

warn

protected void warn(javax.faces.component.UIComponent component,
                    String summary)

Enqueue a FacesMessage (associated with the specified component) containing the specified summary text and a message severity level of FacesMessage.SEVERITY_WARN.

Parameters:
component - Component with which this message is associated
summary - Summary text for this message

error

protected void error(String summary)

Enqueue a global FacesMessage (not associated with any particular component) containing the specified summary text and a message severity level of FacesMessage.SEVERITY_ERROR.

Parameters:
summary - Summary text for this message

error

protected void error(javax.faces.component.UIComponent component,
                     String summary)

Enqueue a FacesMessage (associated with the specified component) containing the specified summary text and a message severity level of FacesMessage.SEVERITY_ERROR.

Parameters:
component - Component with which this message is associated
summary - Summary text for this message

fatal

protected void fatal(String summary)

Enqueue a global FacesMessage (not associated with any particular component) containing the specified summary text and a message severity level of FacesMessage.SEVERITY_FATAL.

Parameters:
summary - Summary text for this message

fatal

protected void fatal(javax.faces.component.UIComponent component,
                     String summary)

Enqueue a FacesMessage (associated with the specified component) containing the specified summary text and a message severity level of FacesMessage.SEVERITY_FATAL.

Parameters:
component - Component with which this message is associated
summary - Summary text for this message


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.