Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Oracle Application Development Framework Controller Java API Reference 10g Release 3 (10.1.3) B16004-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.adf.controller.struts.actions
Class StrutsPageLifecycle

`java.lang.Object
oracle.adf.controller.lifecycle.PageLifecycle
oracle.adf.controller.struts.actions.StrutsPageLifecycle`

All Implemented Interfaces:
  Lifecycle

Direct Known Subclasses:
  StrutsJspLifecycle, StrutsUixLifecycle

public class StrutsPageLifecycle
extends PageLifecycle

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

Since:
  9.0.5

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.lifecycle.PageLifecycle
`clazz, DISABLE_VALIDATE_TOKENS, eventParam, events, ordDomainInputHandlerName`

Constructor Summary
`StrutsPageLifecycle()`

Method Summary
`void` | `findForward(LifecycleContext lcContext)` Determine the ActionForward that will be returned by the Struts action executing the Lifecycle.
`protected boolean` | `handleEvent(LifecycleContext lcContext, java.lang.String event)` Handle an event.
`void` | `initializeMethodParameters(LifecycleContext lcContext, oracle.jbo.uicli.binding.JUCtrlActionBinding actionBinding)` This method is invoked before any ControlBinding or custom method is being executed.
`protected void` | `initializeParameterValuesUsingExpressions(LifecycleContext lcContext, oracle.jbo.uicli.binding.JUCtrlActionBinding actionBinding)` This method allows for initialization of the action binding's parameters by evaluating the expression values stored in the action definition.
`void` | `invokeCustomMethod(LifecycleContext lcContext)` Invoke custom method if one is defined in the `mapping` of the DataAction.
`void` | `prepareModel(LifecycleContext lcContext)` Give the opportunity for the data model to prepare and initialize. This method will throw if the data model cannot be prepared. If you need to set bind variable values on query objects in the business services layer in order to properly prepare the model, then you can set them by overriding this method and doing it before calling the superclass. 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. In the Struts case, prepare the ADF formBean (ADFStrutsForm) with the current binding container.
`void` | `processActionConfig(DataActionMapping mapping)` Give the opportunity to the lifecyle to handle and possibly modify the config of the mapping.
`void` | `processUpdateModel(LifecycleContext lcContext)` Handle update using a Struts formbean In case of error the method setInputValue will not throw but instead the errors will be collected in the binding container.
`void` | `refreshModel(LifecycleContext lcContext)` Used to notify the model when updates are over with.
`void` | `reportErrors(LifecycleContext lcContext)`
`boolean` | `shouldAllowModelUpdate(LifecycleContext lcContext)` Allows clients to determine whether the model should be updated.. Disable data model updates in two cases: When specific action like 'rollback' will be executed during the lifecycle. This is done by calling the ignoreUpdates method or each action in the event list. The custom method ignoreUpdates is also called. When the binding container of the previous page does not match. This is to get around the case where updates from the previous page in the forward chain are applied. Bypassing update might be necessary for operations such as rollback or custom methods that want to veto the change. Overide this method if you need to add logic to skip data model updates.
`protected void` | `updateModel(LifecycleContext lcContext, java.util.Map updatedValues)` Apply each new values to the binding.

Methods inherited from class oracle.adf.controller.lifecycle.PageLifecycle
`buildEventList, disableTokenValidationForRequest, findCtrlBinding, getEventMethod, getEventMethodFromCache, getRequestValues, handleError, handleLifecycle, hasErrors, initializeParameterValuesUsingRequestObject, invokeActionBinding, isNewValueForBinding, processComponentEvents, processEvent, setInputValue, shouldValidateToken, validateModelUpdates`

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

### processActionConfig

    public void processActionConfig(DataActionMapping mapping)

  Give the opportunity to the lifecyle to handle and possibly modify the config of the mapping.
  Parameters:
    `mapping` - the action mapping
  See Also:
    `DataActionMapping.freeze()`

### prepareModel

    public void prepareModel(LifecycleContext lcContext)
                      throws java.lang.Exception

  Give the opportunity for the data model to prepare and initialize. This method will throw if the data model cannot be prepared.

  If you need to set bind variable values on query objects in the business services layer in order to properly prepare the model, then you can set them by overriding this method and doing it before calling the superclass.

  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. In the Struts case, prepare the ADF formBean (ADFStrutsForm) with the current binding container. Also if the token validation fails, clean the pending values in the formbean because they belongs to the wrong iterator.

  Specified by:
    `prepareModel` in interface `Lifecycle`
  Overrides:
    `prepareModel` in class `PageLifecycle`
  Throws:
    `java.lang.Exception`

### shouldAllowModelUpdate

    public boolean shouldAllowModelUpdate(LifecycleContext lcContext)

  Allows clients to determine whether the model should be updated..

  Disable data model updates in two cases:

  - When specific action like 'rollback' will be executed during the lifecycle. This is done by calling the ignoreUpdates method or each action in the event list. The custom method ignoreUpdates is also called.
  - When the binding container of the previous page does not match. This is to get around the case where updates from the previous page in the forward chain are applied.
  Bypassing update might be necessary for operations such as rollback or custom methods that want to veto the change.
  Overide this method if you need to add logic to skip data model updates.

  This is the stuff needed to bypass update on some method like rollback. Also give a chance to the custom method to veto the change.

  Specified by:
    `shouldAllowModelUpdate` in interface `Lifecycle`
  Overrides:
    `shouldAllowModelUpdate` in class `PageLifecycle`
  See Also:
    `JUCtrlActionBinding.ignoreUpdates()`

### processUpdateModel

    public void processUpdateModel(LifecycleContext lcContext)

  Handle update using a Struts formbean In case of error the method setInputValue will not throw but instead the errors will be collected in the binding container.
  Specified by:
    `processUpdateModel` in interface `Lifecycle`
  Overrides:
    `processUpdateModel` in class `PageLifecycle`

### updateModel

    protected void updateModel(LifecycleContext lcContext,
                               java.util.Map updatedValues)

  Description copied from class: `PageLifecycle`
  Apply each new values to the binding. The values are coming from a Map of values keyed by property name. In case of error the method setInputValue will not throw but instead the errors will be collected in the binding container.
  Overrides:
    `updateModel` in class `PageLifecycle`
  Parameters:
    `lcContext` - the lifecycle context
    `updatedValues` - the map of values keyed by property name
  See Also:
    `PageLifecycle.getRequestValues(oracle.adf.controller.lifecycle.LifecycleContext)`

### handleEvent

    protected boolean handleEvent(LifecycleContext lcContext,
                                  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 handler the method signature need to be similar to:

       public void onEvent(DataActionContext ctx)
       {
          // Use the following method to execute the possible
          // action binding associated with this event
          ctx.getEventActionBinding().doit();
       }

  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 `PageLifecycle`
  Parameters:
    `lcContext` - the lifecycle 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`

### initializeParameterValuesUsingExpressions

    protected void initializeParameterValuesUsingExpressions(LifecycleContext lcContext,
                                                             oracle.jbo.uicli.binding.JUCtrlActionBinding actionBinding)

  This method allows for initialization of the action binding's parameters by evaluating the expression values stored in the action definition. This will only be invoked for the action binding that represents the default method dropped on the action via the data control palette.
  Parameters:
    `lcContext` - the lifecycle context
    `actionBinding` - the action bindings to be initialized

### initializeMethodParameters

    public void initializeMethodParameters(LifecycleContext lcContext,
                                           oracle.jbo.uicli.binding.JUCtrlActionBinding actionBinding)

  Description copied from interface: `Lifecycle`
  This method is invoked before any ControlBinding or custom method is being executed. Overriding this method gives an opportunity to set the parameters.
  Specified by:
    `initializeMethodParameters` in interface `Lifecycle`
  Overrides:
    `initializeMethodParameters` in class `PageLifecycle`

### invokeCustomMethod

    public void invokeCustomMethod(LifecycleContext lcContext)

  Invoke custom method if one is defined in the `mapping` of the DataAction.
  Specified by:
    `invokeCustomMethod` in interface `Lifecycle`
  Overrides:
    `invokeCustomMethod` in class `PageLifecycle`
  See Also:
    `DataActionMapping`

### refreshModel

    public void refreshModel(LifecycleContext lcContext)

  Description copied from interface: `Lifecycle`
  Used to notify the model when updates are over with.
  Specified by:
    `refreshModel` in interface `Lifecycle`
  Overrides:
    `refreshModel` in class `PageLifecycle`

### reportErrors

    public void reportErrors(LifecycleContext lcContext)

  This method retrieve the list of error from the dataControl and treat them as fit for the PageLifeCycle implementation. Retrieves the errors from the data control and reports then to the user.

  Specified by:
    `reportErrors` in interface `Lifecycle`
  Overrides:
    `reportErrors` in class `PageLifecycle`

### findForward

    public void findForward(LifecycleContext lcContext)
                     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 DataActionContext. 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 ( ! actionContext.hasErrors())
          {
             actionContext.setActionForward(myActionForward);
          }
          else
          {
             super.findForward(actionContext);
          }

  Specified by:
    `findForward` in interface `Lifecycle`
  Overrides:
    `findForward` in class `PageLifecycle`
  Throws:
    `java.lang.Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Oracle Application Development Framework Controller Java API Reference 10g Release 3 (10.1.3) B16004-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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