org.apache.beehive.netui.pageflow
Class ProcessPopulate

Object
  extended by ProcessPopulate

public class ProcessPopulate
extends Object

Implement the processPopulate stage of the Struts / PageFlow request processing lifecycle. The populate(HttpServletRequest, HttpServletResponse, ActionForm, boolean) method is invoked in order to take request parameters from the HttpServletRequest use the key / value pairs from the request to perform an update to the underlying JavaBean objects.

Updates are performed on a key / value pair if the key is an expression; otherwise, the updates are delegated to the Struts processPopulate infrastructure.


Nested Class Summary
static class ProcessPopulate.ExpressionUpdateNode
          An inner class that represnts the data that will be used to perform an update.
 
Field Summary
static String IDMAP_PARAMETER_NAME
          This defines the name of the parameter that will contain the NetUI ID map..
 
Constructor Summary
ProcessPopulate()
           
 
Method Summary
static void populate(HttpServletRequest request, HttpServletResponse response, ActionForm form, boolean requestHasPopulated)
          Use the request parameters to populate all properties that have expression keys into the underlying JavaBeans.
static void registerPrefixHandler(String prefix, RequestParameterHandler handler)
          Register a RequestParameterHandler that is added to handle a particular prefix which be present as a prefix to a request parameter key.
static String writeHandlerName(String handler, String expression)
          Write the handler name specified onto the given expression.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IDMAP_PARAMETER_NAME

public static final String IDMAP_PARAMETER_NAME
This defines the name of the parameter that will contain the NetUI ID map..

See Also:
Constant Field Values
Constructor Detail

ProcessPopulate

public ProcessPopulate()
Method Detail

registerPrefixHandler

public static void registerPrefixHandler(String prefix,
                                         RequestParameterHandler handler)
Register a RequestParameterHandler that is added to handle a particular prefix which be present as a prefix to a request parameter key. For keys that match the prefix, the key / value from the request are put in an ProcessPopulate.ExpressionUpdateNode struct and handed to the RequestParameterHandler for processing. The returned ProcessPopulate.ExpressionUpdateNode is used to perform an expression update.

Parameters:
prefix - the String prefix that will be appended to request paramters that should pass through the RequestParameterHandler before being updated.
handler - the handler that should handle all request paramters with the given prefix

writeHandlerName

public static String writeHandlerName(String handler,
                                      String expression)
Write the handler name specified onto the given expression.


populate

public static void populate(HttpServletRequest request,
                            HttpServletResponse response,
                            ActionForm form,
                            boolean requestHasPopulated)
                     throws ServletException
Use the request parameters to populate all properties that have expression keys into the underlying JavaBeans. Creates a java.util.Map of objects that will be consumed by Struts processPopulate. This includes all request attributes that were not expressions

Parameters:
request - the current HttpServletRequest
form - if this request references an action and it has an ActionForm associated with it, then the form parameter is non-null.
Throws:
ServletException - when an error occurs in populating data after the request; failure here can be caused by failures in creating or executing update expressions.