com.webmethods.caf.faces.bean
Class BaseViewBean

java.lang.Object
  extended by com.webmethods.caf.faces.bean.BaseFacesBean
      extended by com.webmethods.caf.faces.bean.BaseFacesSessionBean
          extended by com.webmethods.caf.faces.bean.BaseViewBean
All Implemented Interfaces:
IPageFlowScopeAdapter
Direct Known Subclasses:
BaseCompositeViewControlPageBean, BasePortletPageBean, BaseWebPageBean

public class BaseViewBean
extends BaseFacesSessionBean

Base class implementation for view page managed beans. Clients should subclass this base class for each .view file in the web or portlet application.


Nested Class Summary
protected  class BaseViewBean.ClientIdsContentProvider
          Providers that maps raw control ids to client-side element ids.
 
Field Summary
protected  IContentProvider clientIds
          IContentProvider to map raw control ids to client-side element ids.
protected  boolean initialized
          boolean to check if the Bean is initialized.
 
Fields inherited from class com.webmethods.caf.faces.bean.BaseFacesSessionBean
fExpireWithPageFlow
 
Fields inherited from class com.webmethods.caf.faces.bean.BaseFacesBean
DATA_BINDING_CLIENTS, OUTCOME_ERROR, OUTCOME_OK, resourcesProviders
 
Constructor Summary
BaseViewBean()
          Default constructor
 
Method Summary
protected  void afterApplyRequestValues()
          Clients should overwrite this method to perform custom actions after request parameters are applied to the controls.
protected  void afterInvokeApplication()
          Clients should overwrite this method to perform custom actions after an action method is invoked.
 void afterPhase(PhaseEvent event)
          Implementation method of the JSF phase listener.
protected  void afterProcessValidations()
          Clients should overwrite this method to perform custom actions after validation is performed.
protected  void afterRenderResponse()
          Clients should overwrite this method to perform custom actions after the view got rendered.
protected  void afterRestoreView()
          Clients should overwrite this method to perform custom actions after the view got restored from the postback render request.
protected  void afterUpdateModelValues()
          Clients should overwrite this method to perform custom actions after controls updated data model using submitted values.
protected  void beforeApplyRequestValues()
          Clients should overwrite this method to perform custom actions before request parameters are applied to the controls.
protected  void beforeInvokeApplication()
          Clients should overwrite this method to perform custom actions before an action method is invoked.
 void beforePhase(PhaseEvent event)
          Implementation method of the JSF phase listener.
protected  void beforeProcessValidations()
          Clients should overwrite this method to perform custom actions before validation is performed.
protected  void beforeRenderResponse()
          Clients should overwrite this method to perform custom actions before the view gets rendered.
protected  void beforeRestoreView()
          Clients should overwrite this method to perform custom actions before the view gets restored from the postback render request.
protected  void beforeUpdateModelValues()
          Clients should overwrite this method to perform custom actions before controls update data model using submitted values.
protected  void callInitialize()
          Initializes the bean if not already done.
 UIComponent findComponent(UIComponent base, String id)
           Return the UIComponent (if any) with the specified id, searching recursively starting at the specified base, and examining the base component itself, followed by examining all the base component's facets and children.
 UIComponent findComponentInRoot(String id)
          Finds components by its id in the root of the component tree.
protected  Map getApplicationScope()
          Returns writable map of application scoped attributes
 IContentProvider getClientIds()
           Maps raw control ids to client-side element ids.
 PhaseId getPhaseId()
          Returns PhaseId#ANY_PHASE which indicates all standard phases.
protected static String getRealPath(String relPath)
          Returns a full system path for a resource path given relative to the web application root.
protected  Map getRequestParam()
          Returns read-only map of request parameters
protected  Map getRequestScope()
          Returns writable map of request scoped attributes
protected  Map getSessionScope()
          Returns writable map of session scoped attributes.
 void gotoPage(String pageURI)
          Deprecated. use BaseViewBean.gotoPage(String, boolean) instead.
 void gotoPage(String pageURI, boolean redirect)
          Switches to the specified view page.
protected  String initialize()
          This gets overwritten in the page bean classes to be a public dataflow method implementation
 boolean isAsyncRequest()
          Returns true if current request is an async request.
protected  void release()
          Override this method to release any resources associated with this session.
protected  void resetPageFlowStorage()
          Reset the storage used for Page Flow.
protected  void streamFileDataToResponse(IFileExportBean exportBean)
          Helper method that can be called to stream an exported file back to the response.
 
Methods inherited from class com.webmethods.caf.faces.bean.BaseFacesSessionBean
getExpireWithPageFlow, setExpireWithPageFlow, valueBound, valueUnbound
 
Methods inherited from class com.webmethods.caf.faces.bean.BaseFacesBean
createMethodBinding, createValueBinding, error, error, error, error, error, getBean, getFacesContext, getLocale, getResourceInputStream, getResources, getResourcesProvider, getRootCause, getStackTrace, getTreeAttribute, isUserInRole, log, log, log, putTreeAttribute, resetDataBindingClients, resolveDataBinding, resolveDataBinding, resolveExpression, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clientIds

protected transient IContentProvider clientIds
IContentProvider to map raw control ids to client-side element ids.


initialized

protected transient boolean initialized
boolean to check if the Bean is initialized.

Constructor Detail

BaseViewBean

public BaseViewBean()
Default constructor

Method Detail

release

protected void release()
Description copied from class: BaseFacesSessionBean
Override this method to release any resources associated with this session. Please note, the FacesContext is not valid for this function

Specified by:
release in class BaseFacesSessionBean

streamFileDataToResponse

protected void streamFileDataToResponse(IFileExportBean exportBean)
Helper method that can be called to stream an exported file back to the response.

Parameters:
exportBean - the bean describing the file to export

beforePhase

public void beforePhase(PhaseEvent event)
Implementation method of the JSF phase listener. Should not be subclassed by the clients directly. Specific beforeXXX methods should be used instead to perform actions during required JSF phases.

Parameters:
event - JSF phase even

callInitialize

protected void callInitialize()
Initializes the bean if not already done.


initialize

protected String initialize()
This gets overwritten in the page bean classes to be a public dataflow method implementation

Returns:
OUTCOME_OK for success and OUTCOME_ERROR otherwise

afterPhase

public void afterPhase(PhaseEvent event)
Implementation method of the JSF phase listener. Should not be subclassed by the clients directly. Specific afterXXX methods should be used instead to perform actions during required JSF phases.

Parameters:
event - JSF PhaseEvent

getPhaseId

public PhaseId getPhaseId()
Returns PhaseId#ANY_PHASE which indicates all standard phases.

See Also:
PhaseListener

gotoPage

public void gotoPage(String pageURI)
Deprecated. use BaseViewBean.gotoPage(String, boolean) instead.

Sets the specified view page URI on the faces context for rendering. This method should be called inside an action method to set the page URI for the next rendering request.

Parameters:
pageURI - the uri of the page, for example: /portlet1/mypage.view

gotoPage

public void gotoPage(String pageURI,
                     boolean redirect)
Switches to the specified view page. If redirect is false it will simply change the faces context view root to the contents of the specified viewId. If redirect is true, it will redirect to the URL of the specified view. This method should be called inside an action method to set the page URI for the next rendering request.

Parameters:
pageURI - the uri of the page, for example: /portlet1/mypage.view
redirect - true to redirect to the page, false to just change the FacesContext view root

findComponent

public UIComponent findComponent(UIComponent base,
                                 String id)

Return the UIComponent (if any) with the specified id, searching recursively starting at the specified base, and examining the base component itself, followed by examining all the base component's facets and children. Unlike findComponent method of UIComponentBase, which skips recursive scan each time it finds a NamingContainer, this method examines all components, regardless of their namespace (assuming IDs are unique).

Parameters:
base - Base UIComponent from which to search
id - Component identifier to be matched
Returns:
UI component or null if not found

findComponentInRoot

public UIComponent findComponentInRoot(String id)
Finds components by its id in the root of the component tree.

Parameters:
id - the component id
Returns:
UIComponent or null if not found

getClientIds

public IContentProvider getClientIds()

Maps raw control ids to client-side element ids.

For example, #{myPageBean.clientIds.myControlId} returns the client-side id (ie "wmp1234:zID3:myControlId") for the control with an id of 'myControlId'.

Returns:
instance of the IContentProvider for ID mapping.

isAsyncRequest

public boolean isAsyncRequest()
Returns true if current request is an async request.

Returns:
true for async request

getRealPath

protected static String getRealPath(String relPath)
Returns a full system path for a resource path given relative to the web application root.

Parameters:
relPath - relative path of the web resource
Returns:
String for full system path of this resource, or null if it cannot be calculated

getApplicationScope

protected Map getApplicationScope()
Returns writable map of application scoped attributes

Returns:
Map <String, Object> of attributes

getRequestParam

protected Map getRequestParam()
Returns read-only map of request parameters

Returns:
Map <String, Object> of parameters

getRequestScope

protected Map getRequestScope()
Returns writable map of request scoped attributes

Returns:
Map <String, Object> of attributes

getSessionScope

protected Map getSessionScope()
Returns writable map of session scoped attributes. For portlets the session scope is private, i.e. per portlet instance.

Returns:
Map <String, Object> of attributes

beforeRestoreView

protected void beforeRestoreView()
Clients should overwrite this method to perform custom actions before the view gets restored from the postback render request.


afterRestoreView

protected void afterRestoreView()
Clients should overwrite this method to perform custom actions after the view got restored from the postback render request.


beforeApplyRequestValues

protected void beforeApplyRequestValues()
Clients should overwrite this method to perform custom actions before request parameters are applied to the controls.


afterApplyRequestValues

protected void afterApplyRequestValues()
Clients should overwrite this method to perform custom actions after request parameters are applied to the controls.


beforeProcessValidations

protected void beforeProcessValidations()
Clients should overwrite this method to perform custom actions before validation is performed.


afterProcessValidations

protected void afterProcessValidations()
Clients should overwrite this method to perform custom actions after validation is performed.


beforeUpdateModelValues

protected void beforeUpdateModelValues()
Clients should overwrite this method to perform custom actions before controls update data model using submitted values.


afterUpdateModelValues

protected void afterUpdateModelValues()
Clients should overwrite this method to perform custom actions after controls updated data model using submitted values.


beforeInvokeApplication

protected void beforeInvokeApplication()
Clients should overwrite this method to perform custom actions before an action method is invoked.


afterInvokeApplication

protected void afterInvokeApplication()
Clients should overwrite this method to perform custom actions after an action method is invoked.


beforeRenderResponse

protected void beforeRenderResponse()
Clients should overwrite this method to perform custom actions before the view gets rendered.


afterRenderResponse

protected void afterRenderResponse()
Clients should overwrite this method to perform custom actions after the view got rendered.


resetPageFlowStorage

protected void resetPageFlowStorage()
Reset the storage used for Page Flow.