org.hdpagination.web.action
Class AbstractCommandPaginationAction

java.lang.Object
  extended by org.hdpagination.web.action.AbstractPaginationAction
      extended by org.hdpagination.web.action.AbstractCommandPaginationAction
All Implemented Interfaces:
PaginationAction

public abstract class AbstractCommandPaginationAction
extends AbstractPaginationAction

A abstract class with the similar functionalities as AbstractPaginationAction but providing additional convenient method via:

    1) instantiating a javabean and populates its properties with values from http request parameters by matching property name with parameter name;

    2) passing the populated javabean instance to another overloading method getQueryCallback(HttpServletRequest request, Object command).

This allows custom action (its subclass) to manipulate the populated javabean object (method argument 'command') rather than HttpServletRequest.

To simplify the way to handle HTTP Request, only properties with type of java.lang.String or java.lang.String[] in javabean are populated. All other properties with other types will not be populated even their names are matched with HTTP Request parameter names.

Populating property with type of java.lang.String[] from HTTP Request parameters was added since version 1.2; This feature will be useful in some cases where the search criteria includes multiple selections (e.g. check boxes or <select multiple="multiple">). By doing so, the multiple selected option values from the page will be converted automatically to the corresponding property in javabean object if its type is String Array.

Since:
1.0
Author:
Liangfeng Ren

Constructor Summary
AbstractCommandPaginationAction()
           
AbstractCommandPaginationAction(java.lang.Class commandClazz)
           
 
Method Summary
 java.lang.Class getCommandClass()
          The class of javabean whose properties will be populated with http request parameter values
 QueryCallback getQueryCallback(javax.servlet.http.HttpServletRequest request)
          Generate a QueryCallback instance based on request parameters.
abstract  QueryCallback getQueryCallback(javax.servlet.http.HttpServletRequest request, java.lang.Object command)
          Generate a QueryCallback instance based on request parameters.
 void setCommandClass(java.lang.Class commandClass)
          Set the class of javabean whose properties will be populated with http request parameter values
 void setCommandName(java.lang.String commandName)
          Set the name of class of javabean whose properties will be populated with http request parameter values
 
Methods inherited from class org.hdpagination.web.action.AbstractPaginationAction
getAttributeName4Data, getDataScope, getForwardPath, getId, getInputPath, getPageSize, getQueryTemplate, getSearchResultHandler, getValidator, getView, isCacheRecordsCount, setAttributeName4Data, setCacheRecordsCount, setDataScope, setForwardPath, setId, setInputPath, setPageSize, setQueryTemplate, setSearchResultHandler, setValidator, setView
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCommandPaginationAction

public AbstractCommandPaginationAction()

AbstractCommandPaginationAction

public AbstractCommandPaginationAction(java.lang.Class commandClazz)
Parameters:
commandClazz - The class of javabean whose properties will be populated with http parameter values.
Method Detail

getCommandClass

public java.lang.Class getCommandClass()
The class of javabean whose properties will be populated with http request parameter values

Returns:

setCommandClass

public void setCommandClass(java.lang.Class commandClass)
Set the class of javabean whose properties will be populated with http request parameter values

Parameters:
commandClass -

setCommandName

public void setCommandName(java.lang.String commandName)
Set the name of class of javabean whose properties will be populated with http request parameter values

Parameters:
commandName -

getQueryCallback

public QueryCallback getQueryCallback(javax.servlet.http.HttpServletRequest request)
Description copied from class: AbstractPaginationAction
Generate a QueryCallback instance based on request parameters. This returned callback instance finally will be executed by the back-end query engine. It's custom action class can instantiate its own QueryCallback instance based on passed request parameter values. The returned QueryCallback instance should match with the injected QueryTemplate instance as follows:

(1) JdbcQueryCallback matchs with all subclass of JdbcQueryTemplate

(2) HBN2QueryCallback matchs with Hibernate2QueryTemplate

(3) HBN3QueryCallback matchs with Hibernate3QueryTemplate

(4) JPAQueryCallback matchs with JPAQueryTemplate

Specified by:
getQueryCallback in interface PaginationAction
Specified by:
getQueryCallback in class AbstractPaginationAction
Returns:

getQueryCallback

public abstract QueryCallback getQueryCallback(javax.servlet.http.HttpServletRequest request,
                                               java.lang.Object command)
Generate a QueryCallback instance based on request parameters. This returned callback instance finally will be executed by the back-end query engine. It's custom action class can instantiate its own QueryCallback instance based on passed request parameter values. The returned QueryCallback instance should match with the injected QueryTemplate instance as follows:

(1) JdbcQueryCallback matchs with all subclass of JdbcQueryTemplate

(2) HBN2QueryCallback matchs with Hibernate2QueryTemplate

(3) HBN3QueryCallback matchs with Hibernate3QueryTemplate

(4) JPAQueryCallback matchs with JPAQueryTemplate

Parameters:
request -
command - The javabean object whose properties are populated with http parameter values if their names match with request names. To simply the way to handle HTTP Request, only properties with type of java.lang.String or java.lang.String[] in javabean are populated. All other properties with other types will not be populated even their names are matched with HTTP Request parameter names.
Returns:


Copyright © 2008 HDPagination All Rights Reserved.