Tuesday, 24 March 2015

Understanding the Fusion Page Cycle



ADF Faces page lifecycle extends the standard JSF request lifecycle, and the ADF page lifecycle.
The JSF life cycle has been explained in the following link.

The ADF page lifecycle handles preparing and updating the data model, validating the data at the model layer, and executing methods on the business layer. The ADF page lifecycle uses the binding container to make data available for easy referencing by the page during the current page request.
The combined JSF and ADF page lifecycle is only one sequence within a larger sequence of events that begins when an HTTP request arrives at the application server and continues until the page is returned to the client. This overall sequence of events can be called the web page lifecycle. It follows processing through the model, view, and controller layers as defined by the MVC architecture.



Diagram showing a web page life cycle with JSF life Cycle and ADF life cycle in tandem


How do JSF and ADF Phases integrate?




·         Restore View: The URL for the requested page is passed to the bindingContext object, which finds the page definition file that matches the URL. The component tree of the requested page is either newly built or restored.
·         JSF Restore View: Provides before and after phase events for the Restore View phase. You can create a listener and register it with the before or after event of this phase, and the application will behave as if the listener were registered with the Restore View phase. After the before and after listeners are executed, the page flow scope is available.
·         Initialize Context: The page definition file is used to create the bindingContainer object, which is the runtime representation of the page definition file for the requested page. The LifecycleContext class used to persist information throughout the ADF page lifecycle phases is instantiated and initialized with values for the associated request, binding container, and lifecycle.
·         Prepare Model: The ADF page lifecycle enters the Prepare Model phase by calling the BindingContainer.refresh(PREPARE_MODEL) method. During the Prepare Model phase, BindingContainer page parameters are prepared and then evaluated. If parameters for a task flow exist, they are passed into the flow. Next, any executables that have their refresh attribute set to prepareModel are refreshed based on the order of entry in the page definition file’s <executables> section and on the evaluation of their RefreshCondition properties (if present).
·         Apply Request Values: Each component in the tree extracts new values from the request parameters and stores those values locally. When immediate property on some component is set as true this phase behaves differently. Please read more on this link.
·         JSF Apply Request Values: Provides before and after phase events for the Apply Request Values phase. You can create a listener and register it with the before or after event of this phase, and the application will behave as if the listener were registered with the Apply Request Values phase.
·         Process Validations: Local Values of components are converted ad validated on client. At the end of this phase, new component values are set, any validation or conversion error messages and events are queued on FacesContext, and any value change events are delivered.
·         JSF Process Validations: Provides before and after phase events for the Process Validations phase.
·         Update Model Values: The component’s validated local values are moved to the model and the local copies are discarded. For any updateable components (such as an inputText component), corresponding iterators are refreshed, if the refresh condition is set to the default (deferred) and the refresh condition (if any) evaluates to true.
·         JSF Update Model Values: Provides before and after phase events for the Update Model Values Phase.
·         Validation Model Updates: The updated model is now validated against any validation routines set on the model
·         Invoke Application: Any action bindings for command components or events are invoked.
·         JSF Invoke Application: Provides before and after phase events for the Invoke Application Phase.
·         Metadata Commit: Changes to runtime metadata are committed. This phase stores any runtime changes made to the application using the Metadata Service (MDS).
·         Prepare Render: The binding container is refreshed to allow for any changes that may have occurred in the Apply Request Values or Validation phases. Any iterators that correspond to read-only components (such as an outputText component) are refreshed. Any dynamic regions are switched, if needed. Jdeveloper displays refresh(RENDER_MODEL) instead of prepareRender as a valid phase selection.
·         Render Response:  The components in the tree are rendered as the Java EE web container traverses the tags in the page. State information is saved for subsequent requests and the Restore View phase

·         JSF Render Response: Provides before and after phase events for the Render Response.

No comments:

Post a Comment