kiurubeans
Class SearchHandler

java.lang.Object
  |
  +--kiurubeans.KiuruHandler
        |
        +--kiurubeans.SearchHandler
All Implemented Interfaces:
EnumType
Direct Known Subclasses:
PersonSearch, ReservationSearch, SpaceGroupSearch, SpaceSearch

public abstract class SearchHandler
extends KiuruHandler

Superclass for searchobjects (eg. SpaceSearch, PersonSearch...)


Field Summary
static int RESET_SEARCH
          Clears search field.
static int SUBMIT_SEARCH
          Submits search with current field value.
 
Fields inherited from class kiurubeans.KiuruHandler
NO_ACTION
 
Constructor Summary
SearchHandler()
          Dummy empty constructor.
 
Method Summary
 void assignDefaultOrder()
          Assigns order according to visibleFields.
 void clearEmptyParameters(javax.servlet.http.HttpServletRequest request)
          Ensures empty request parameters are clearer when entity is posted.
protected  void defaultAction()
          Performs action based on actionType.
protected  void doClearActionState(javax.servlet.http.HttpServletRequest request)
          Implementation of clearing action state.
protected  void doClearEmptyParameters(javax.servlet.http.HttpServletRequest request)
          Implementation for clearing empty parameters.
 int fieldIndexOf(java.lang.String name)
          Returns incasesensitive index of field alias.
protected  int getMaxState()
          Returns current max state value.
 java.lang.String getOrder()
          Getter for property order.
 java.lang.String getOrderClause()
          Returns order clause to be appended in search SQL.
 Field[] getVisibleFields()
          Getter for property visibleFields.
 Field getVisibleFields(int index)
          Indexed getter for property visibleFields.
abstract  void resetSearch()
          Implementation for RESET_SEARCH
 void setContinueSearch(java.lang.String s)
          Sets bean state to NO_ACTION.
 void setOrder(java.lang.String order)
          Setter for property order.
 void setSubmitSearch(java.lang.String s)
          Sets bean state to SUBMIT_SEARCH.
 void setVisibleFields(Field[] visibleFields)
          Setter for property visibleFields.
 void setVisibleFields(int index, Field visibleFields)
          Indexed setter for property visibleFields.
abstract  void submitSearch()
          Implementation for SUBMIT_SEARCH
 
Methods inherited from class kiurubeans.KiuruHandler
addError, addNotice, getEnumState, getError, getLangId, getOk, getUser, performAction, resetActionState, resetErrorState, setEnumState, setError, setOk, setUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUBMIT_SEARCH

public static final int SUBMIT_SEARCH
Submits search with current field value.

See Also:
Constant Field Values

RESET_SEARCH

public static final int RESET_SEARCH
Clears search field. Search does not return anything.

See Also:
Constant Field Values
Constructor Detail

SearchHandler

public SearchHandler()
Dummy empty constructor.

Method Detail

getMaxState

protected int getMaxState()
Returns current max state value. Inherited classes may override this when new states are introduced.

Overrides:
getMaxState in class KiuruHandler
Returns:
max state value

getVisibleFields

public Field getVisibleFields(int index)
Indexed getter for property visibleFields.

Parameters:
index - Index of the property.
Returns:
Value of the property at index.

getVisibleFields

public Field[] getVisibleFields()
Getter for property visibleFields.

Returns:
Value of property visibleFields.

setVisibleFields

public void setVisibleFields(int index,
                             Field visibleFields)
Indexed setter for property visibleFields.

Parameters:
index - Index of the property.
visibleFields - New value of the property at index.

setVisibleFields

public void setVisibleFields(Field[] visibleFields)
Setter for property visibleFields.

Parameters:
visibleFields - New value of property visibleFields.

getOrder

public java.lang.String getOrder()
Getter for property order.

Returns:
Value of property order.

setSubmitSearch

public void setSubmitSearch(java.lang.String s)
Sets bean state to SUBMIT_SEARCH. Usually called from a web form.

Parameters:
s - any nonempty string.
See Also:
SUBMIT_SEARCH

setContinueSearch

public void setContinueSearch(java.lang.String s)
Sets bean state to NO_ACTION. Usually called from a web form.

Parameters:
s - any nonempty string.
See Also:
KiuruHandler.NO_ACTION

fieldIndexOf

public int fieldIndexOf(java.lang.String name)
Returns incasesensitive index of field alias.

Parameters:
name - field alias name
Returns:
index of field, -1 if not valid

setOrder

public void setOrder(java.lang.String order)
Setter for property order.

Parameters:
order - New value of property order. Multiple fields are separated by ,

getOrderClause

public java.lang.String getOrderClause()
Returns order clause to be appended in search SQL.

Returns:
order part of SQL clause or nothing if there is no ordering.

assignDefaultOrder

public void assignDefaultOrder()
Assigns order according to visibleFields.


clearEmptyParameters

public void clearEmptyParameters(javax.servlet.http.HttpServletRequest request)
Ensures empty request parameters are clearer when entity is posted.

If bean is used in a JSP, this should be called in the beginning of page. If form content is "" or null it is not sent via HTTP, so those fields must be cleared manually. Method may be called from a handler or UI page. Descendant classes should redefine conditions for calling doClearEmpty parameters method.

Overrides:
clearEmptyParameters in class KiuruHandler
Parameters:
request - HTTP request with parameters
See Also:
doClearEmptyParameters(HttpServletRequest)

doClearActionState

protected void doClearActionState(javax.servlet.http.HttpServletRequest request)
Implementation of clearing action state. Inherited classes should always override this.

Specified by:
doClearActionState in class KiuruHandler
Parameters:
request - Http request used for parameter parsing.

submitSearch

public abstract void submitSearch()
Implementation for SUBMIT_SEARCH


resetSearch

public abstract void resetSearch()
Implementation for RESET_SEARCH


defaultAction

protected void defaultAction()
                      throws java.lang.Exception
Performs action based on actionType. Called from performAction. Descendant classes should override this and call the same method in inherited class as default.

Specified by:
defaultAction in class KiuruHandler
Throws:
java.lang.Exception - If something went wrong during actual executed action.
See Also:
KiuruHandler.performAction()

doClearEmptyParameters

protected void doClearEmptyParameters(javax.servlet.http.HttpServletRequest request)
Description copied from class: KiuruHandler
Implementation for clearing empty parameters. Descendant classes override this.

Specified by:
doClearEmptyParameters in class KiuruHandler
Parameters:
request - Http request used for parameter parsing.