Oracle Application Development Framework Lifecycle Java API Reference 10g Release 3 (10.1.3) B25779-01


oracle.adf.controller.v2.lifecycle
Class PageLifecycleImpl

java.lang.Object
  extended byoracle.adf.controller.v2.lifecycle.Phases
      extended byoracle.adf.controller.v2.lifecycle.PageLifecycle
          extended byoracle.adf.controller.v2.lifecycle.PageLifecycleImpl

Direct Known Subclasses:
FacesPageLifecycle, StrutsPageLifecycle

public class PageLifecycleImpl
extends PageLifecycle

Implementation of the PageLifecycle abstract class.

This contain the base implementation of the Phases of the ADF Lifecycle.

Since:
10.1.3

Field Summary
static java.lang.String DISABLE_VALIDATE_TOKENS
          A request-level property used to disable the token validation.
static java.lang.String ordDomainInputHandlerName
          A custom input handler used by bindings dealing with ord domain type.

 

Fields inherited from class oracle.adf.controller.v2.lifecycle.PageLifecycle
clazz, eventParam, events

 

Constructor Summary
PageLifecycleImpl()
           

 

Method Summary
 void applyInputValues(LifecycleContext lfContext)
          Builds the list of events with their possible associated action binding from the request parameters. In this method, the input values list and the event list are built.
protected  void buildEventList(PageLifecycleContext context)
          Possible events are request parameters named "event" or which name are prefixed with "event_".
protected  void buildInputValues(PageLifecycleContext context)
          Build a list of all the new submited ADF values from the request parameters.
protected  void disableTokenValidationForRequest(PageLifecycleContext context)
          Token validation will only occur once-per-request.
protected  ControlBinding findCtrlBinding(RegionBinding bindings, java.lang.String event)
          Look action binding with the name 'name' or 'Name'
 void findForward(PageLifecycleContext context)
          The path of the next web page is identified using the forwardPath property on the PageLifecycleContext.
 java.lang.reflect.Method getEventMethod(PageLifecycleContext lcContext, java.lang.String eventName)
           
protected  java.lang.String getToken(PageLifecycleContext context, RegionBinding bindings)
          Retrieve the token from the request
 void handleError(PageLifecycleContext context, java.lang.Exception ex)
           
protected  boolean handleEvent(PageLifecycleContext context, java.lang.String event)
          Handle an event.
 boolean hasErrors(PageLifecycleContext context)
          Return true if an error occured during validation. The default implementation looks at the content of the ExceptionList of the BindingContainer to determine if an error occured.
 void initContext(LifecycleContext lfContext)
          During this phase the listener is able to initialize the LifecycleContext with additional information that will be persisted during the Lifecycle.
 void initializeMethodParameters(PageLifecycleContext context, OperationBinding actionBinding)
           
protected  void initializeParameterValuesUsingRequestObject(PageLifecycleContext context, OperationBinding actionBinding)
          In model 1 we do not have a way to initialize method parameters.
 boolean invokeActionBinding(PageLifecycleContext context, java.lang.String event)
           
 boolean invokeEventMethod(PageLifecycleContext lcContext, java.lang.String eventName)
           
 void metadataCommit(LifecycleContext lfContext)
          Used to commit Runtime changes to the metadata.
 void prepareModel(LifecycleContext lfContext)
          Give the opportunity for the data model to prepare and initialize.
 void prepareRender(LifecycleContext lfContext)
          Last phase before rendering a page.
 void processComponentEvents(LifecycleContext lfContext)
          Process each event accumulated during the previous phases. Handle any events in the Events list previously built during the applyInputValues phase.
protected  void processEvent(PageLifecycleContext context, java.lang.String event)
          Process a possible raw event coming as a request parameter.
 void processUpdateModel(LifecycleContext lfContext)
          Update the data model with new and validated input values.
protected  void registerCustomInputHandler(PageLifecycleContext context)
          Register OrdDomainInputHandler custom input handler to the binding context.
 void reportErrors(PageLifecycleContext context)
           
 boolean shouldAllowModelUpdate(PageLifecycleContext context)
           
protected  boolean shouldValidateToken(PageLifecycleContext context, RegionBinding bindings)
          Checks the request object to see if token validation should occur.
 void validateInputValues(LifecycleContext lfContext)
          Validate input values.
 void validateModelUpdates(LifecycleContext lfContext)
          Forces model-level validation to occur.

 

Methods inherited from class oracle.adf.controller.v2.lifecycle.PageLifecycle
getEventMethodFromCache, getLifecycleContextClass

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

DISABLE_VALIDATE_TOKENS

public static final java.lang.String DISABLE_VALIDATE_TOKENS
A request-level property used to disable the token validation. Token validation should only occur once per http request.
See Also:
Constant Field Values

ordDomainInputHandlerName

public static final java.lang.String ordDomainInputHandlerName
A custom input handler used by bindings dealing with ord domain type.
See Also:
Constant Field Values

Constructor Detail

PageLifecycleImpl

public PageLifecycleImpl()

Method Detail

initContext

public void initContext(LifecycleContext lfContext)
Description copied from class: Phases
During this phase the listener is able to initialize the LifecycleContext with additional information that will be persisted during the Lifecycle.
Specified by:
initContext in class Phases

prepareModel

public void prepareModel(LifecycleContext lfContext)
Give the opportunity for the data model to prepare and initialize.

If you need to reference prepared model values and/or update the values of any bindings in the binding container, then you can do it by overriding this method and doing it after calling the superclass.

Specified by:
prepareModel in class Phases

applyInputValues

public void applyInputValues(LifecycleContext lfContext)
Builds the list of events with their possible associated action binding from the request parameters. In this method, the input values list and the event list are built.
Specified by:
applyInputValues in class Phases

validateInputValues

public void validateInputValues(LifecycleContext lfContext)
Description copied from class: Phases
Validate input values.
Specified by:
validateInputValues in class Phases

processUpdateModel

public void processUpdateModel(LifecycleContext lfContext)
Update the data model with new and validated input values.

This phase is executed only if the shouldAllowModelUpdate method returns true.

In case of error when setting the value to the model the errors will not be thrown but collected in the binding container.

Specified by:
processUpdateModel in class Phases

shouldAllowModelUpdate

public boolean shouldAllowModelUpdate(PageLifecycleContext context)
See Also:
JUCtrlActionBinding.ignoreUpdates()

validateModelUpdates

public void validateModelUpdates(LifecycleContext lfContext)
Forces model-level validation to occur.

This phase is executed only if the shouldAllowModelUpdate method returns true.

To delay model-level validation until Commit, override this method and replace it with a no-op.
Specified by:
validateModelUpdates in class Phases

processComponentEvents

public void processComponentEvents(LifecycleContext lfContext)
Process each event accumulated during the previous phases. Handle any events in the Events list previously built during the applyInputValues phase.
Specified by:
processComponentEvents in class Phases

hasErrors

public boolean hasErrors(PageLifecycleContext context)
Return true if an error occured during validation. The default implementation looks at the content of the ExceptionList of the BindingContainer to determine if an error occured.

initializeParameterValuesUsingRequestObject

protected void initializeParameterValuesUsingRequestObject(PageLifecycleContext context,
                                                           OperationBinding actionBinding)
In model 1 we do not have a way to initialize method parameters. In the action binding the user can change the name of the parameters. This function will iterate through the parameter names in the action binding and look for request parameters that match those names. This transfer of values allows us to pass in request parameters that match the action binding's parameter names.
Parameters:
context - the Pagelifecycle context
actionBinding - the action binding to initialize

initializeMethodParameters

public void initializeMethodParameters(PageLifecycleContext context,
                                       OperationBinding actionBinding)
Parameters:
context - the PageLifecycle context
actionBinding - the action binding object to initialize

metadataCommit

public void metadataCommit(LifecycleContext lfContext)
Description copied from class: Phases
Used to commit Runtime changes to the metadata. This phase is always called before prepareRender even in case of navigation.
Specified by:
metadataCommit in class Phases

prepareRender

public void prepareRender(LifecycleContext lfContext)
Description copied from class: Phases
Last phase before rendering a page. This can be used to notify a binding that rendering is about to happen and allow them to optimize data preparation or processing before the rendering begins.

During this phase the model is refreshed.

Specified by:
prepareRender in class Phases

handleError

public void handleError(PageLifecycleContext context,
                        java.lang.Exception ex)

reportErrors

public void reportErrors(PageLifecycleContext context)

getToken

protected java.lang.String getToken(PageLifecycleContext context,
                                    RegionBinding bindings)
Retrieve the token from the request

shouldValidateToken

protected boolean shouldValidateToken(PageLifecycleContext context,
                                      RegionBinding bindings)
Checks the request object to see if token validation should occur.

disableTokenValidationForRequest

protected void disableTokenValidationForRequest(PageLifecycleContext context)
Token validation will only occur once-per-request. This function will disable token validation for the given request.
See Also:
DISABLE_VALIDATE_TOKENS

processEvent

protected void processEvent(PageLifecycleContext context,
                            java.lang.String event)
Process a possible raw event coming as a request parameter. This method handle the case where the request parameter is produced from an image control where the parameter name represent the coordinate of the mouse when clicked on the image. This also make sure an event is not executed multiple time when the request is forwarded.
Parameters:
context - the Pagelifecycle context
event - the event name

findCtrlBinding

protected ControlBinding findCtrlBinding(RegionBinding bindings,
                                         java.lang.String event)
Look action binding with the name 'name' or 'Name'
Parameters:
bindings - the binding container
event - the event name

buildInputValues

protected void buildInputValues(PageLifecycleContext context)

Build a list of all the new submited ADF values from the request parameters.

The result is a Map of values keyed by binding instance stored in the UpdatedValues property.
Only new values are kept in the UpdatedValues list.
Parameters:
context - the Pagelifecycle context

buildEventList

protected void buildEventList(PageLifecycleContext context)
Possible events are request parameters named "event" or which name are prefixed with "event_". If there are parameters named "event" each of their values are event names. If the parameter name starts with "event_", the following part of the name is the event name. (i.e "event_Next" will add the event called "Next").

The "event" prefix can be modified using setEventPrefix

By doing this once and storing the result in the lifecycle context we don't have to walk through the request parameter list multiple time during the lifecycle.

See Also:
addControlActionBinding, getControlActionBindings, addEvent, getEvents

registerCustomInputHandler

protected void registerCustomInputHandler(PageLifecycleContext context)
Register OrdDomainInputHandler custom input handler to the binding context.

handleEvent

protected boolean handleEvent(PageLifecycleContext context,
                              java.lang.String event)
                       throws java.lang.Exception
Handle an event. An event handler can be a method defined in a subclass of this PageLifecycle. To be recognized as an event handle the method need to have the following syntax:
 public void onEvent(LifecycleContext ctx)
 {
    // Use the following method to execute the possible
    // action binding associated with this event
    ctx.getEventActionBinding().invoke();
 }
 
Where Event is the name of the event.

An event can also be an action binding with the same name of the event present in the current binding container.

Parameters:
context - the PageLifecycle context
event - the name of the event to handle
Returns:
true if the event was mapped to an action binding
Throws:
java.lang.Exception
See Also:
buildEventList, PageLifecycleContext.EVENT_METHOD_PREFIX

getEventMethod

public java.lang.reflect.Method getEventMethod(PageLifecycleContext lcContext,
                                               java.lang.String eventName)
Parameters:
lcContext - the PageLifecycle context
eventName - name of the event
Returns:
the Method object for this event if exist

invokeEventMethod

public boolean invokeEventMethod(PageLifecycleContext lcContext,
                                 java.lang.String eventName)
                          throws java.lang.Exception
Parameters:
lcContext - the PageLifecycle context
eventName - name of the event
Returns:
the Method object for this event if exist
Throws:
java.lang.Exception

invokeActionBinding

public boolean invokeActionBinding(PageLifecycleContext context,
                                   java.lang.String event)
Parameters:
context - the lifecycle context
event - the name of the event
Returns:
true if an action binding is associated with the event

findForward

public void findForward(PageLifecycleContext context)
                 throws java.lang.Exception
Description copied from class: PageLifecycle
The path of the next web page is identified using the forwardPath property on the PageLifecycleContext. If the redirect property on the PageLifecycleContext is true, the response will be redirected to the specified path. Otherwise, the request will be forwarded to the specified path.
Specified by:
findForward in class PageLifecycle
Throws:
java.lang.Exception

Oracle Application Development Framework Lifecycle Java API Reference 10g Release 3 (10.1.3) B25779-01


Copyright © 1997, 2005, Oracle. All rights reserved.