Oracle ADF Controller API Reference 10.1.2 B14363-02


oracle.adf.controller.lifecycle
Class LifecycleContext

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.HashMap
          extended byoracle.adf.controller.lifecycle.LifecycleContext

All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable
Direct Known Subclasses:
DataActionContext

public class LifecycleContext
extends java.util.HashMap

LifecycleContext contains all the state information that will be kept during the Lifecycle. It is passed as a method parameter to each of the phases of the Lifecycle. Since it extends the HashMap class it can be use to append additional user data.

This context object lives for the duration of the current lifecycle.

NOTE: Implementations of Lifecycle should be thread-safe and use the LifecycleContext object as the place to store any per-request state they may need.

Since:
9.0.5
See Also:
Serialized Form

Field Summary
static java.lang.String EVENT_METHOD_PREFIX
Prefix used for each event method.
static java.lang.String EVENT_PREFIX
The default value to be used by the lifecycle to reconize an event in a parameter name.

Constructor Summary
LifecycleContext()

Method Summary
void addControlActionBinding(java.lang.String event, oracle.jbo.uicli.binding.JUCtrlActionBinding actionBinding)
This method add an action binding to the collection of action being executed.
void addEvent(java.lang.String event)
Add an event name to the list of event to be handled during this lifecycle.
oracle.adf.model.binding.DCBindingContainer getBindingContainer()
Retrieve the Model binding container from the context.
oracle.adf.model.BindingContext getBindingContext()
Retrieve the BindingContext from the context.
java.util.Map getControlActionBindings()
Retrieve a list of all action binding keyed by event name.
oracle.jbo.uicli.binding.JUCtrlActionBinding getCustomMethod()
Retrieve the custom method Action binding from the context.
oracle.jbo.uicli.binding.JUCtrlActionBinding getEventActionBinding()
Retrieve the ActionBinding associated with the current event.
java.lang.String getEventPrefix()
Retrieve the event prefix from the context.
java.util.List getEvents()
Retrieve the list of event names to be handled during this lifecycle.
java.lang.String getForwardPath()
Retrieve the path of the page that the Lifecycle will forward to.
javax.servlet.http.HttpServletRequest getHttpServletRequest()
Retrieve the HttpServletRequest from the context.
javax.servlet.http.HttpServletResponse getHttpServletResponse()
Retrieve the HttpServletResponse from the context.
Lifecycle getLifecycle()
Retrieve the Lifecycle from the context.
java.lang.String getModelReference()
Retrieve the ModelReference name property from the context.
boolean getRedirect()
Retrieve the redirect setting from the context.
void initialize(Lifecycle lifecycle, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Initialize the context with the Lifecycle it is going to be use with and the request and response information.
void initialize(Lifecycle lifecycle, java.lang.String modelRef, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Initialize the context with the name of the model reference to be use during this Lifecycle.
void setBindingContainer(oracle.adf.model.binding.DCBindingContainer bindings)
Store the Model binding container in the context.
void setBindingContext(oracle.adf.model.BindingContext bindingContext)
Store the BindingContext in the context.
void setCustomMethod(oracle.jbo.uicli.binding.JUCtrlActionBinding actionBinding)
Set the custom method Action binding in the context.
void setEventActionBinding(oracle.jbo.uicli.binding.JUCtrlActionBinding action)
Set the ActionBinding for the current event.
void setEventPrefix(java.lang.String prefix)
Set the prefix that will be used to reconize event request parameters.
void setForwardPath(java.lang.String path)
Set the path of the page to which the Lifecycle should forward.
void setHttpServletRequest(javax.servlet.http.HttpServletRequest request)
Store the HttpServletRequest in the context.
void setHttpServletResponse(javax.servlet.http.HttpServletResponse response)
Store the HttpServletResponse in the context.
void setLifecycle(Lifecycle lifeCycle)
Store a Lifecycle object in the context.
void setModelReference(java.lang.String modelRef)
Store the Model Reference name in the context.
void setRedirect(boolean redirect)
Specify if the page path information defined using the setForwardPath should be use to forward the request or redirect the response.

Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values

Methods inherited from class java.util.AbstractMap
equals, hashCode, toString

Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait

Methods inherited from interface java.util.Map
equals, hashCode

Field Detail

EVENT_PREFIX

public static final java.lang.String EVENT_PREFIX
The default value to be used by the lifecycle to reconize an event in a parameter name.
See Also:
Constant Field Values

EVENT_METHOD_PREFIX

public static final java.lang.String EVENT_METHOD_PREFIX
Prefix used for each event method.
See Also:
Constant Field Values

Constructor Detail

LifecycleContext

public LifecycleContext()

Method Detail

initialize

public void initialize(Lifecycle lifecycle,
                       javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
Initialize the context with the Lifecycle it is going to be use with and the request and response information.
Parameters:
lifecycle - the lifecycle
request - the current HttpServletRequest
response - the current HttpServletResponse

initialize

public void initialize(Lifecycle lifecycle,
                       java.lang.String modelRef,
                       javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
Initialize the context with the name of the model reference to be use during this Lifecycle.
Parameters:
lifecycle - The lifecycle object in use for the current request.
modelRef - The name of the UIModel to use for the binding container
request - The current HTTP request object
response - The current HTTP response object

setLifecycle

public void setLifecycle(Lifecycle lifeCycle)
Store a Lifecycle object in the context.
Parameters:
lifeCycle - Lifecycle object to use for the current request.

getLifecycle

public Lifecycle getLifecycle()
Retrieve the Lifecycle from the context.
Returns:
Lifecycle object in use for the current request.

setHttpServletRequest

public void setHttpServletRequest(javax.servlet.http.HttpServletRequest request)
Store the HttpServletRequest in the context.
Parameters:
request - Current HTTP Request object.

getHttpServletRequest

public javax.servlet.http.HttpServletRequest getHttpServletRequest()
Retrieve the HttpServletRequest from the context.
Returns:
the HttpServletRequest

setHttpServletResponse

public void setHttpServletResponse(javax.servlet.http.HttpServletResponse response)
Store the HttpServletResponse in the context.
Parameters:
response - Current HTTP response object.

getHttpServletResponse

public javax.servlet.http.HttpServletResponse getHttpServletResponse()
Retrieve the HttpServletResponse from the context.
Returns:
the HttpServletResponse

setBindingContext

public void setBindingContext(oracle.adf.model.BindingContext bindingContext)
Store the BindingContext in the context.
Parameters:
bindingContext - BindingContext in use for the current request.

getBindingContext

public oracle.adf.model.BindingContext getBindingContext()
Retrieve the BindingContext from the context.
Returns:
the BindingContext object

setModelReference

public void setModelReference(java.lang.String modelRef)
Store the Model Reference name in the context.
Parameters:
modelRef - the model reference

getModelReference

public java.lang.String getModelReference()
Retrieve the ModelReference name property from the context.
Returns:
the modelReference

setBindingContainer

public void setBindingContainer(oracle.adf.model.binding.DCBindingContainer bindings)
Store the Model binding container in the context.
Parameters:
bindings - Binding container to use for the current request.

getBindingContainer

public oracle.adf.model.binding.DCBindingContainer getBindingContainer()
Retrieve the Model binding container from the context.
Returns:
Binding container in use by the current request.

setCustomMethod

public void setCustomMethod(oracle.jbo.uicli.binding.JUCtrlActionBinding actionBinding)
Set the custom method Action binding in the context.
Parameters:
actionBinding - Action binding object to call during current request.

getCustomMethod

public oracle.jbo.uicli.binding.JUCtrlActionBinding getCustomMethod()
Retrieve the custom method Action binding from the context.
Returns:
Action binding to be called during current request.

setEventActionBinding

public void setEventActionBinding(oracle.jbo.uicli.binding.JUCtrlActionBinding action)
Set the ActionBinding for the current event. This is used internally to prepare the context before calling the event handler.
Parameters:
action - Action binding to invoke as the event's default action.

getEventActionBinding

public oracle.jbo.uicli.binding.JUCtrlActionBinding getEventActionBinding()
Retrieve the ActionBinding associated with the current event. This is usefull when you overide the handler for a specific event because it allows you to execute the associated ActionBinding. The default handler always execute the ActionBinding.

Here is an example for an event named Commit:

 public void onCommit(LifecycleContext ctx)
 {
    // write pre-execution logic here
    
    ctx.getEventActionBinding().doit();
    
    // write post-execution logic here
 }
 

Return null is no ActionBinding is associated with this event.

Returns:
a JUCtrlActionBinding

setEventPrefix

public void setEventPrefix(java.lang.String prefix)

Set the prefix that will be used to reconize event request parameters. To change the default prefix "event", call this method with a different prefix every time the lifecycle context is initialized.

?event=xxx

name="event_xxx"

Parameters:
prefix - the new prefix string
See Also:
EVENT_PREFIX

getEventPrefix

public java.lang.String getEventPrefix()
Retrieve the event prefix from the context.
Returns:
the prefix string
See Also:
EVENT_PREFIX

addControlActionBinding

public void addControlActionBinding(java.lang.String event,
                                    oracle.jbo.uicli.binding.JUCtrlActionBinding actionBinding)
This method add an action binding to the collection of action being executed. Each action binding is keyed by an event name.
Parameters:
event - an event name
actionBinding - the action binding to be associated with the event

getControlActionBindings

public java.util.Map getControlActionBindings()
Retrieve a list of all action binding keyed by event name.
Returns:
Map of control action bindings

addEvent

public void addEvent(java.lang.String event)
Add an event name to the list of event to be handled during this lifecycle.
Parameters:
event - an event name

getEvents

public java.util.List getEvents()
Retrieve the list of event names to be handled during this lifecycle.
Returns:
List of event names to be handled.
See Also:
PageLifecycle.buildEventList(LifecycleContext)

setForwardPath

public void setForwardPath(java.lang.String path)
Set the path of the page to which the Lifecycle should forward.
Parameters:
path - Relative path of next page.
See Also:
PageLifecycle.findForward(LifecycleContext), setRedirect(boolean)

getForwardPath

public java.lang.String getForwardPath()
Retrieve the path of the page that the Lifecycle will forward to.
Returns:
Path of next page
See Also:
PageLifecycle.findForward(LifecycleContext)

setRedirect

public void setRedirect(boolean redirect)
Specify if the page path information defined using the setForwardPath should be use to forward the request or redirect the response.
Parameters:
redirect - a boolean
See Also:
setForwardPath(java.lang.String), PageLifecycle.findForward(LifecycleContext)

getRedirect

public boolean getRedirect()
Retrieve the redirect setting from the context.
Returns:
the value of the redirect flag.
See Also:
setRedirect(boolean)

Oracle ADF Controller API Reference 10.1.2 B14363-02


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