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


oracle.adf.controller.v2.struts.lifecycle
Class StrutsPageLifecycle

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


public class StrutsPageLifecycle
extends PageLifecycleImpl

Base class for any Lifecycle running with the Struts controller. This is an adapted PageLifecycleImpl to work with specific Struts feature like error reporting, named forward and form bean.

Since:
10.1.3

Field Summary
static java.lang.String formFileInputHandlerName
          A custom input handler used by bindings dealing with FormFile type

 

Fields inherited from class oracle.adf.controller.v2.lifecycle.PageLifecycleImpl
DISABLE_VALIDATE_TOKENS, ordDomainInputHandlerName

 

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

 

Constructor Summary
StrutsPageLifecycle()
           

 

Method Summary
protected  void buildInputValues(PageLifecycleContext plcContext)
          A Struts specific implementation that only deals with values coming from the ADFStrutsForm.
 void findForward(PageLifecycleContext plcContext)
          Determine the ActionForward that will be returned by the Struts action executing the Lifecycle.
 java.lang.Class getLifecycleContextClass()
          Returns the LifecycleContext class used by this PageLifecycle. Any PageLifecycle subclass can have their own context by subclassing PageLifecycleContext. The StrutsPageLifecycle uses the custom LifecycleContext called StrutsPageLifecycleContext
protected  boolean handleEvent(PageLifecycleContext plcContext, java.lang.String event)
          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. In addition to the super class behavior, the event name is used as a automatic forward mechanism.

 void prepareModel(LifecycleContext context)
          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.

 void prepareRender(LifecycleContext lfContext)
          Last phase before rendering a page.
 void processUpdateModel(LifecycleContext context)
          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.

protected  void registerCustomInputHandler(PageLifecycleContext context)
          Register formFileInputHandlerName custom input handler to the binding context.
 void reportErrors(PageLifecycleContext plcContext)
           Retrieves the errors and convert them to Struts errors.
 boolean shouldAllowModelUpdate(PageLifecycleContext plcContext)
           

 

Methods inherited from class oracle.adf.controller.v2.lifecycle.PageLifecycleImpl
applyInputValues, buildEventList, disableTokenValidationForRequest, findCtrlBinding, getEventMethod, getToken, handleError, hasErrors, initContext, initializeMethodParameters, initializeParameterValuesUsingRequestObject, invokeActionBinding, invokeEventMethod, metadataCommit, processComponentEvents, processEvent, shouldValidateToken, validateInputValues, validateModelUpdates

 

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

 

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

 

Field Detail

formFileInputHandlerName

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

Constructor Detail

StrutsPageLifecycle

public StrutsPageLifecycle()

Method Detail

getLifecycleContextClass

public java.lang.Class getLifecycleContextClass()
Returns the LifecycleContext class used by this PageLifecycle. Any PageLifecycle subclass can have their own context by subclassing PageLifecycleContext. The StrutsPageLifecycle uses the custom LifecycleContext called StrutsPageLifecycleContext
Overrides:
getLifecycleContextClass in class PageLifecycle
Returns:
the Class object

registerCustomInputHandler

protected void registerCustomInputHandler(PageLifecycleContext context)
Register formFileInputHandlerName custom input handler to the binding context.
Overrides:
registerCustomInputHandler in class PageLifecycleImpl

prepareModel

public void prepareModel(LifecycleContext context)
Description copied from class: PageLifecycleImpl
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.

Overrides:
prepareModel in class PageLifecycleImpl

shouldAllowModelUpdate

public boolean shouldAllowModelUpdate(PageLifecycleContext plcContext)
Overrides:
shouldAllowModelUpdate in class PageLifecycleImpl

processUpdateModel

public void processUpdateModel(LifecycleContext context)
Description copied from class: PageLifecycleImpl
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.

Overrides:
processUpdateModel in class PageLifecycleImpl

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.

Overrides:
prepareRender in class PageLifecycleImpl

reportErrors

public void reportErrors(PageLifecycleContext plcContext)
Retrieves the errors and convert them to Struts errors.
Overrides:
reportErrors in class PageLifecycleImpl

handleEvent

protected boolean handleEvent(PageLifecycleContext plcContext,
                              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. In addition to the super class behavior, the event name is used as a automatic forward mechanism. If it exist an action forward of the same name of the event, this action forward is set to the context to be the return value of the DataAction execute method.

Overrides:
handleEvent in class PageLifecycleImpl
Parameters:
plcContext - 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:
getEventActionBinding

findForward

public void findForward(PageLifecycleContext plcContext)
                 throws java.lang.Exception
Determine the ActionForward that will be returned by the Struts action executing the Lifecycle. This method only set the ActionForward object in the actionForward property of the StrutsLifecycleContext. The DataAction executing the Lifecycle will return this value from the execute method.

If the actionForward property has already being set during a previous step of the Lifecycle, it respect this value and return. If there was errors during the Lifecycle, it uses the inputForward property of the action. The normal behavior for a DataForwardAction is to use the parameter property. For a DataAction it is to use the forward called "success".

Clients should override this method to select a forward based on the result of a custom method invocation. Since this method is called when the Lifecycle successfully executed or when an error was encountered, the user has to pay extra attention to always check for the error case using the hasError property.

    // Set my custom Action only when no error occured
    if ( ! hasErrors() )
    {
       context.setActionForward(myActionForward);
    }
    else
    {
       super.findForward(context);
    }
 
Overrides:
findForward in class PageLifecycleImpl
Throws:
java.lang.Exception

buildInputValues

protected void buildInputValues(PageLifecycleContext plcContext)
A Struts specific implementation that only deals with values coming from the ADFStrutsForm.
Overrides:
buildInputValues in class PageLifecycleImpl
Parameters:
plcContext - the Pagelifecycle context

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


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