public abstract class SearchForm
extends com.escenic.tools.struts.ValidateForm
implements com.escenic.tools.struts.ForwardingForm, com.escenic.tools.struts.ResettingForm
The abstract super class of all search forms. To be eligable to use as a
ActionForm
by
SearchAction
, they must extend this class.
We supply default implementations that can be used and further extended by customers. Customers are expected to extend this class to be able to create custom search forms.
The default implementations are:Constructor and Description |
---|
SearchForm() |
Modifier and Type | Method and Description |
---|---|
boolean |
allowReset(org.apache.struts.action.ActionMapping pMapping,
javax.servlet.http.HttpServletRequest pRequest) |
protected boolean |
containsParameter(String pParameterName)
Returns
true if this SearchForm contains a mapping
for the specified parameter name. |
protected abstract boolean |
getDescendingSort()
Specify if the result should be sorted in descending order.
|
String |
getErrorUrl()
The url to which the request should be forwarded if the action failes.
|
protected abstract List |
getExcludeNodes()
The
Sections or
Catalogs to exclude in the search. |
protected Date |
getFromDate()
The start date for the search.
|
protected abstract List |
getIncludeNodes()
The
Sections or
Catalogs to include in the search. |
protected abstract int |
getMaxSearchRows()
The max number of rows to include in the search.
|
String |
getPageLength()
Gets the number of items to show on the result page.
|
protected int |
getPageLengthAsInt()
Gets the length of the page, as an int value.
|
String |
getPageNumber()
Gets the page in the search result we want to display.
|
protected int |
getPageNumberhAsInt()
Gets the page number of the page, as an int value.
|
protected Object |
getParameter(String pParameterName)
Returns the value to which this
SearchForm maps the specified
parameter name. |
protected Map |
getParameters()
A
Map of the extra parameters used by the search engines. |
String |
getPublicationId()
Gets the publication id.
|
protected int |
getPublicationIdAsInt() |
String |
getSearchEngineName()
Gets the name of the search engine to use for searching.
|
protected abstract String |
getSearchExpression()
The expression we are searching for.
|
String |
getSearchKey()
The search key to use when collect the stored search.
|
protected int |
getSearchKeyAsInt()
The search key to use when collect the stored search, as int.
|
protected abstract boolean |
getSearchSubNodes()
Should we include sub nodes in the search?
|
protected abstract String |
getSortExpression()
How the result should be sorted.
|
protected abstract List |
getStates()
The states to include in the search.
|
String |
getSuccessUrl()
The url to which the request should be forwarded when the action has
finished successfully.
|
protected Date |
getToDate()
The end date for the search.
|
protected abstract List |
getTypes()
The types to include in the search.
|
protected void |
initParameters()
Initializes the parameters saved in the parameters list.
|
protected abstract boolean |
isLive()
Limit the search to live objects.
|
void |
reset(org.apache.struts.action.ActionMapping pMapping,
javax.servlet.http.HttpServletRequest pRequest)
Resets all properties to their default state.
|
void |
resetErrorUrl(org.apache.struts.action.ActionMapping pMapping,
javax.servlet.http.HttpServletRequest pRequest)
Resets the errorUrl property.
|
void |
resetParameters(org.apache.struts.action.ActionMapping pMapping,
javax.servlet.http.HttpServletRequest pRequest)
Resets the parameters property.
|
void |
resetSearchEngineName(org.apache.struts.action.ActionMapping pMapping,
javax.servlet.http.HttpServletRequest pRequest)
Resets the searchEngineName property.
|
void |
resetSearchKey(org.apache.struts.action.ActionMapping pMapping,
javax.servlet.http.HttpServletRequest pRequest)
Resets the searchKey property.
|
void |
resetTargetUrl(org.apache.struts.action.ActionMapping pMapping,
javax.servlet.http.HttpServletRequest pRequest)
Resets the pageLength property.
|
void |
setErrorUrl(String pError)
Sets the url to which the request should be forwarded if the action failes.
|
void |
setPageLength(String pPageLength)
Sets the number of items to show on the result page.
|
void |
setPageNumber(String pPageNumber)
Sets the page in the search result we want to display.
|
protected void |
setParameter(String pParameterName,
Object pParameterValue)
Extra parameters used by the search engines.
|
void |
setPublicationId(String pPublicationId)
Sets the publication id.
|
void |
setSearchEngineName(String pSearchEngineName)
Sets the name of the search engine to use for searching.
|
void |
setSearchKey(String pSearchKey)
The search key to use when collect the stored search.
|
void |
setSuccessUrl(String pTarget)
Sets the url to which the request should be forwarded when the action has
finished successfully.
|
void |
validatePageLength(org.apache.struts.action.ActionErrors pActionErrors)
Validates the pageLength property.
|
void |
validatePageNumber(org.apache.struts.action.ActionErrors pActionErrors)
Validates the pageNumber property.
|
void |
validatePublicationId(org.apache.struts.action.ActionErrors pActionErrors)
Validates the publicationId property.
|
addError, addError, addError, integer, minValue, range, required, validate
public final void reset(org.apache.struts.action.ActionMapping pMapping, javax.servlet.http.HttpServletRequest pRequest)
Resets all properties to their default state. This method is called before
the properties are repopulated by the
controller servlet
.
Subclasses should create methods with the above signature to reset all bean properties to default values.
Delegates to
ResettingFormModule.reset(ActionMapping, HttpServletRequest, ResettingForm)
reset
in class org.apache.struts.action.ActionForm
pMapping
- The mapping used to select this instance.pRequest
- The request we are processing.ResettingFormModule.reset(ActionMapping, HttpServletRequest, ResettingForm)
public boolean allowReset(org.apache.struts.action.ActionMapping pMapping, javax.servlet.http.HttpServletRequest pRequest)
allowReset
in interface com.escenic.tools.struts.ResettingForm
public String getPageLength()
public void setPageLength(String pPageLength)
pPageLength
- the value to set page length topublic void validatePageLength(org.apache.struts.action.ActionErrors pActionErrors)
pActionErrors
- the ActionErrors
to add ActionError
to when we
discover validation errorsprotected int getPageLengthAsInt()
public String getPageNumber()
public void setPageNumber(String pPageNumber)
pPageNumber
- The pageNumber to set.public void validatePageNumber(org.apache.struts.action.ActionErrors pActionErrors)
pActionErrors
- the ActionErrors
to add ActionError
to when we
discover validation errorsprotected int getPageNumberhAsInt()
public void setSearchKey(String pSearchKey)
pSearchKey
- the String
value to set searchKey topublic String getSearchKey()
public void resetSearchKey(org.apache.struts.action.ActionMapping pMapping, javax.servlet.http.HttpServletRequest pRequest)
pMapping
- The mapping used to select this instance.pRequest
- The request we are processingreset(ActionMapping, HttpServletRequest)
protected int getSearchKeyAsInt()
public String getSearchEngineName()
public void setSearchEngineName(String pSearchEngineName)
pSearchEngineName
- public void resetSearchEngineName(org.apache.struts.action.ActionMapping pMapping, javax.servlet.http.HttpServletRequest pRequest)
pMapping
- The mapping used to select this instance.pRequest
- The request we are processingreset(ActionMapping, HttpServletRequest)
public String getPublicationId()
public void setPublicationId(String pPublicationId)
pPublicationId
- The publication to searchpublic void validatePublicationId(org.apache.struts.action.ActionErrors pActionErrors)
pActionErrors
- the ActionErrors
to add ActionError
to when we
discover validation errorsprotected int getPublicationIdAsInt()
protected abstract String getSearchExpression()
The expression we are searching for.
The search expression to use further. The expression is on the format:
(+Hubba +Bubba) AND ("Stein Erik Berget") AND (Hepp Hopp) AND (-Jule -Nissen)
.
protected Date getFromDate()
The start date for the search.
Defaults to the beginning of the current year.
protected Date getToDate()
The end date for the search.
Defaults to same time tomorrow.
protected abstract List getIncludeNodes()
Sections
or
Catalogs
to include in the search.unmodifiable
List
of Integers
.protected abstract List getExcludeNodes()
Sections
or
Catalogs
to exclude in the search.unmodifiable
List
of Integers
.protected abstract boolean getSearchSubNodes()
true
if we should include the sub nodes in search,
false
otherwise.protected abstract List getTypes()
articles
this will be the article type. For
ReferenceEntity
objects this will be Image
,
Link
,Media
or Person
.null
.protected abstract List getStates()
articles
the states would be:
draft
, submitted
, approved
,
published
or deleted
.null
.protected abstract boolean isLive()
true
when limited to only to include only live
articles, false
otherwise.protected abstract String getSortExpression()
protected abstract boolean getDescendingSort()
true
if sorting in descending order,
false
otherwise.protected final void setParameter(String pParameterName, Object pParameterValue)
pParameterName
- the name of the parameter to setpParameterValue
- the value of the parameterprotected final Object getParameter(String pParameterName)
SearchForm
maps the specified
parameter name. Returns null
if the SearchForm
contains no mapping for this key.pParameterName
- The name of the parameter whose associated value is to be
returned.SearchForm
maps the specified
parameter name, or null
if the SearchForm
contains no mapping for this parameter name.protected final boolean containsParameter(String pParameterName)
true
if this SearchForm
contains a mapping
for the specified parameter name.pParameterName
- the name of parameter whose presence in this SearchForm
is
to be tested.true
if this SearchForm
contains a mapping
for the specified parameter name.protected final Map getParameters()
Map
of the extra parameters used by the search engines.unmodifiable
Map
of the parameters.protected void initParameters()
super.initParameters()
.public final void resetParameters(org.apache.struts.action.ActionMapping pMapping, javax.servlet.http.HttpServletRequest pRequest)
pMapping
- The mapping used to select this instance.pRequest
- The request we are processingreset(ActionMapping, HttpServletRequest)
protected abstract int getMaxSearchRows()
public String getErrorUrl()
com.escenic.tools.struts.ForwardingForm
getErrorUrl
in interface com.escenic.tools.struts.ForwardingForm
public void setErrorUrl(String pError)
com.escenic.tools.struts.ForwardingForm
setErrorUrl
in interface com.escenic.tools.struts.ForwardingForm
pError
- the error url to use.public void resetErrorUrl(org.apache.struts.action.ActionMapping pMapping, javax.servlet.http.HttpServletRequest pRequest)
pMapping
- The mapping used to select this instance.pRequest
- The request we are processingreset(ActionMapping, HttpServletRequest)
public String getSuccessUrl()
com.escenic.tools.struts.ForwardingForm
getSuccessUrl
in interface com.escenic.tools.struts.ForwardingForm
public void setSuccessUrl(String pTarget)
com.escenic.tools.struts.ForwardingForm
setSuccessUrl
in interface com.escenic.tools.struts.ForwardingForm
pTarget
- the target url to use.public void resetTargetUrl(org.apache.struts.action.ActionMapping pMapping, javax.servlet.http.HttpServletRequest pRequest)
pMapping
- The mapping used to select this instance.pRequest
- The request we are processingreset(ActionMapping, HttpServletRequest)
© 1998- 2018 Stibo DX