|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatg.nucleus.logging.VariableArgumentApplicationLoggingImpl
atg.nucleus.GenericService
atg.droplet.EmptyFormHandler
atg.droplet.GenericFormHandler
atg.commerce.csr.search.SearchFormHandler
public class SearchFormHandler
This SearchFormHandler class is used to build repository searches. The class builds a Query object and generates search resultset This class also implements javax.servlet.Servlet interface so that it can be used as a droplet to embed searches within jhtml pages.
Example jhtml usage (as a FormHandler):
<FORM method="POST" action="searchresults.jhtml"> Profile ID: <input type=hidden bean="RepositorySearchForm.SearchAttributes[1].Name" value="profileId"> <input type=hidden bean="RepositorySearchForm.SearchAttributes[1].Method" value="0"> <input type=hidden bean="RepositorySearchForm.SearchAttributes[1].CaseSensitive" value="0"> <select bean="RepositorySearchForm.SearchAttributes[1].Relation"> <option value="=="> == <option value="!="> != <option value="<"> < <option value=">"> > <option value="<="> <= <option value=">="> >= </select> <input type="text" bean="RepositorySearchForm.SearchAttributes[1].Values" value=""> </td> <input type="submit" bean="RepositorySearchForm.Search" value="Search"> </FORM>
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
protected static java.lang.String |
DIR_ASCENDING_STRING
|
protected static java.lang.String |
DIR_DESCENDING_STRING
|
static java.lang.String |
OUTPUT
output oparam |
protected static java.lang.String |
SEARCHFORMRESOURCES
resources file |
protected static java.util.ResourceBundle |
sResourceBundle
resources bundle |
Fields inherited from class atg.droplet.GenericFormHandler |
---|
PARAM_DEFER_FORWARD_OR_REDIRECT, PARAM_USE_FORWARDS |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
SearchFormHandler()
empty constructor |
Method Summary | |
---|---|
protected boolean |
checkFormError(java.lang.String pErrorURL,
java.lang.String pSuccessURL,
atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.DynamoHttpServletResponse pResponse)
Check to see if there were errors during the submit operation. |
void |
destroy()
|
protected atg.repository.Repository |
findLocaleRepository(atg.servlet.DynamoHttpServletRequest request)
------------------------------------- findLocaleRepository Use user's current locale to find the right repository to search |
protected void |
generateFormException(java.lang.String whatException,
java.lang.String substitutionText,
atg.servlet.DynamoHttpServletRequest pRequest)
utility: generateFormException Create a form exception, by looking up the exception code in a resource file identified by the RESOURCE_BUNDLE constant (defined above). |
protected atg.repository.Query |
generateSearchQuery(atg.servlet.DynamoHttpServletRequest request,
atg.servlet.DynamoHttpServletResponse response)
generate the search Query |
boolean |
getAllowOpenEndedSearch()
Returns property AllowOpenEndedSearch |
java.lang.String |
getCancelURL()
Returns the cancelURL |
int |
getCurrentResultPageNum()
Returns property CurrentResultPageNum |
protected java.sql.Date |
getDateConstant(java.lang.String pDate)
Convert string to java.sql.Date |
int |
getEndIndex()
Returns the property EndIndex. |
java.lang.String |
getErrorURL()
Returns where to go upon a failed search |
protected java.util.Locale |
getLocale(atg.servlet.DynamoHttpServletRequest pRequest)
------------------------------------- utility: getLocale Determine the user's current locale, if available |
int |
getMaxResultNum()
Returns property mMaxResultNum |
int |
getMaxResultsPerPage()
Returns property maxResultsPerPage |
atg.repository.Query |
getQuery()
Returns Query to be built and executed |
atg.repository.QueryOptions |
getQueryOptions()
Returns property QueryOptions |
atg.repository.Repository |
getRepository()
Returns Repository which is being queried |
RepositorySearcher |
getRepositorySearcher()
Returns Tool which encapsulates the searching functionality |
java.lang.String |
getResultNumGreaterThanMax()
Returns property ResultNumGreaterThanMax |
int |
getResultPageCount()
Returns the number of results pages which is calculated as the resultSetSize / maxResultsPerPage + 1 if any remainder exists. |
int |
getResultSetSize()
Returns property ResultSetSize |
int |
getResultsNextPage()
Returns the no of records to be displayed for next page |
int |
getSearchableAttributeNum()
Returns property mSearchableAttributeNum |
SearchAttribute |
getSearchAttribute(int pIndex)
Returns SearchAttribute by which the search is done |
SearchAttribute[] |
getSearchAttributes()
Returns SearchAttributes by which the search is done |
java.util.Collection |
getSearchResults()
Returns property SearchResults |
javax.servlet.ServletConfig |
getServletConfig()
|
java.lang.String |
getServletInfo()
|
java.lang.String |
getSortDirection()
|
protected int |
getSortDirectionInt()
|
java.lang.String |
getSortProperty()
|
int |
getStartIndex()
Returns the property startIndex. |
java.lang.String |
getSuccessURL()
Returns where to go upon successful search |
boolean |
getUseLocaleRepository()
Returns UseLocaleRepository |
boolean |
handleCancelSearch(atg.servlet.DynamoHttpServletRequest request,
atg.servlet.DynamoHttpServletResponse response)
Handles the cancel search. |
boolean |
handleContinueSearch(atg.servlet.DynamoHttpServletRequest request,
atg.servlet.DynamoHttpServletResponse response)
Handles the continue search if the search result set number is greater than the specified maximum value |
boolean |
handleNextResultPageNum(atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.DynamoHttpServletResponse pResponse)
Handles the search for the next page |
boolean |
handlePreviousResultPageNum(atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.DynamoHttpServletResponse pResponse)
Handles the search for the previous page. |
boolean |
handleSearch(atg.servlet.DynamoHttpServletRequest request,
atg.servlet.DynamoHttpServletResponse response)
Handles the search. |
boolean |
handleSearchQuery(atg.servlet.DynamoHttpServletRequest request,
atg.servlet.DynamoHttpServletResponse response)
Handles the search |
void |
init(javax.servlet.ServletConfig config)
|
boolean |
isEnableCountQuery()
Returns property enableCountQuery |
void |
service(atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.DynamoHttpServletResponse pResponse)
This methods lets this FormHandler to be used as a droplet. |
void |
service(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res)
The service method - go directly from a Servlet to a DynamoHttpServlet for efficiency. |
void |
setAllowOpenEndedSearch(boolean pAllowOpenEndedSearch)
Sets property AllowOpenEndedSearch |
void |
setCancelURL(java.lang.String pCancelURL)
Sets the cancelURL |
void |
setCurrentResultPageNum(int pCurrentResultPageNum)
Sets the property currentResultPageNum. |
void |
setEnableCountQuery(boolean pEnableCountQuery)
Sets the property enableCountQuery. |
void |
setErrorURL(java.lang.String pErrorURL)
Sets where to go upon a failed search |
void |
setMaxResultNum(int pMaxResultNum)
Sets the property mMaxResultNum. |
void |
setMaxResultsPerPage(int pMaxResultsPerPage)
Sets the property maxResultsPerPage. |
void |
setQuery(atg.repository.Query pQuery)
Sets Query to be built and executed |
void |
setQueryOptions(atg.repository.QueryOptions pQueryOptions)
Sets property QueryOptions |
void |
setRepository(atg.repository.Repository pRepository)
Sets Repository which is being queried |
void |
setRepositorySearcher(RepositorySearcher pRepositorySearcher)
Sets Tool which encapsulates the searching functionality |
void |
setRepositoryViewName(java.lang.String pRepositoryViewName)
Sets Repository view name which is being queried |
void |
setResultNumGreaterThanMax(java.lang.String pResultNumGreaterThanMax)
Sets the property ResultNumGreaterThanMax. |
void |
setResultSetSize(int pResultSetSize)
|
void |
setSearchableAttributeNum(int pSearchableAttributeNum)
Sets property mSearchableAttributeNum |
void |
setSearchAttribute(int pIndex,
SearchAttribute pSearchAttribute)
Sets SearchAttribute by which the search is done |
void |
setSearchAttributes(SearchAttribute[] pSearchAttributes)
Sets SearchAttributes by which the search is done |
void |
setSearchResults(java.util.Collection results)
|
void |
setSortDirection(java.lang.String direction)
|
void |
setSortProperty(java.lang.String property)
|
void |
setSuccessURL(java.lang.String pSuccessURL)
Sets where to go upon successful search |
void |
setUseLocaleRepository(boolean pUseLocaleRepository)
Sets UseLocaleRepository |
void |
setUserName(java.lang.String pUserName)
|
protected boolean |
validateSearchCriteria(atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.DynamoHttpServletResponse pResponse)
validateSearchCriteria |
protected int |
validateSearchCriteria(atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.DynamoHttpServletResponse pResponse,
SearchAttribute[] pSearchAttributes)
validateSearchCriteria |
protected boolean |
validateSearchValue(java.lang.String pValue,
java.lang.String pDataType,
atg.servlet.DynamoHttpServletRequest request)
|
Methods inherited from class atg.droplet.GenericFormHandler |
---|
addFormException, addUncheckedFormException, afterSet, beforeSet, checkFormRedirect, createFormSubmissionMessage, getCheckForValidSession, getFormError, getFormExceptions, getFormName, getMessagePort, getMessageSource, getMessageType, getPropertyExceptions, getSendMessages, getUncheckedFormExceptions, handleCancel, handleFormException, handleUncheckedFormException, hasUncheckedFormExceptions, isDeferForwardsAndRedirects, isRestorableForm, isUseForwards, isValidSession, redirectOrForward, resetFormExceptions, setCheckForValidSession, setDeferForwardsAndRedirects, setFormName, setMessagePort, setMessageSource, setMessageType, setRestorableForm, setSendMessages, setUseForwards |
Methods inherited from class atg.droplet.EmptyFormHandler |
---|
afterGet, beforeGet |
Methods inherited from class atg.nucleus.GenericService |
---|
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CLASS_VERSION
protected static final java.lang.String DIR_DESCENDING_STRING
protected static final java.lang.String DIR_ASCENDING_STRING
protected static final java.lang.String SEARCHFORMRESOURCES
protected static java.util.ResourceBundle sResourceBundle
public static final java.lang.String OUTPUT
Constructor Detail |
---|
public SearchFormHandler()
Method Detail |
---|
public void setUserName(java.lang.String pUserName)
public void setRepositorySearcher(RepositorySearcher pRepositorySearcher)
pRepositorySearcher
- the Tool which encapsulates the searching functionality.public RepositorySearcher getRepositorySearcher()
public void setQuery(atg.repository.Query pQuery)
pQuery
- the Query to be built and executed.public atg.repository.Query getQuery()
public void setRepository(atg.repository.Repository pRepository)
pRepository
- the Repository which is being queried.public atg.repository.Repository getRepository()
public void setUseLocaleRepository(boolean pUseLocaleRepository)
pUseLocaleRepository
- the property that determines if the repository to be searched
should be based on the user's locale.public boolean getUseLocaleRepository()
public void setRepositoryViewName(java.lang.String pRepositoryViewName)
pRepositoryViewName
- the Repository view name which is being queriedpublic void setSearchAttributes(SearchAttribute[] pSearchAttributes)
pSearchAttributes
- the SearchAttributes by which the search is donepublic SearchAttribute[] getSearchAttributes()
public void setSearchAttribute(int pIndex, SearchAttribute pSearchAttribute)
public SearchAttribute getSearchAttribute(int pIndex)
public void setQueryOptions(atg.repository.QueryOptions pQueryOptions)
pQueryOptions
- the property to store specific query options to used when
generating the search string.public atg.repository.QueryOptions getQueryOptions()
public void setSearchableAttributeNum(int pSearchableAttributeNum)
pSearchableAttributeNum
- the property to storepublic int getSearchableAttributeNum()
public void setMaxResultsPerPage(int pMaxResultsPerPage)
pMaxResultsPerPage
- the property to store the maximum number of results to be
displayed per page.public int getMaxResultsPerPage()
public void setMaxResultNum(int pMaxResultNum)
pMaxResultNum
- the property to store the maximum number of results to be
returned.public int getMaxResultNum()
public void setResultNumGreaterThanMax(java.lang.String pResultNumGreaterThanMax)
pResultNumGreaterThanMax
- public java.lang.String getResultNumGreaterThanMax()
public void setCurrentResultPageNum(int pCurrentResultPageNum)
pCurrentResultPageNum
- the property to tell which page of the result set is currently
being viewed.public int getCurrentResultPageNum()
public void setResultSetSize(int pResultSetSize)
pResultSetSize
- the property that represents the number of items that match the
query.public int getResultSetSize()
public int getResultsNextPage()
public boolean getAllowOpenEndedSearch()
public void setAllowOpenEndedSearch(boolean pAllowOpenEndedSearch)
pAllowOpenEndedSearch
- the property that determines whether to do open ended search or
notpublic void setEnableCountQuery(boolean pEnableCountQuery)
pEnableCountQuery
- the property to enable the jhtml programmer to provide next and
prev buttons to iterate over a result set.public boolean isEnableCountQuery()
public int getResultPageCount()
public int getStartIndex()
public int getEndIndex()
public java.lang.String getSortProperty()
public void setSortProperty(java.lang.String property)
public java.lang.String getSortDirection()
protected int getSortDirectionInt()
public void setSortDirection(java.lang.String direction)
public void setSuccessURL(java.lang.String pSuccessURL)
pSuccessURL
- where to go upon successful searchpublic java.lang.String getSuccessURL()
public void setErrorURL(java.lang.String pErrorURL)
pErrorURL
- where to go upon failed searchpublic java.lang.String getErrorURL()
public java.lang.String getCancelURL()
getCancelURL
in class atg.droplet.GenericFormHandler
public void setCancelURL(java.lang.String pCancelURL)
setCancelURL
in class atg.droplet.GenericFormHandler
pCancelURL
- where to go upon canceled searchpublic java.util.Collection getSearchResults()
public void setSearchResults(java.util.Collection results)
protected atg.repository.Query generateSearchQuery(atg.servlet.DynamoHttpServletRequest request, atg.servlet.DynamoHttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
request
- response
-
javax.servlet.ServletException
java.io.IOException
public boolean handleSearchQuery(atg.servlet.DynamoHttpServletRequest request, atg.servlet.DynamoHttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
request
- response
-
javax.servlet.ServletException
java.io.IOException
protected boolean validateSearchCriteria(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
pRequest
- pResponse
-
javax.servlet.ServletException
java.io.IOException
protected int validateSearchCriteria(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse, SearchAttribute[] pSearchAttributes) throws javax.servlet.ServletException, java.io.IOException
pRequest
- pResponse
- pSearchAttributes
-
javax.servlet.ServletException
java.io.IOException
protected boolean validateSearchValue(java.lang.String pValue, java.lang.String pDataType, atg.servlet.DynamoHttpServletRequest request)
public boolean handleSearch(atg.servlet.DynamoHttpServletRequest request, atg.servlet.DynamoHttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
request
- response
-
javax.servlet.ServletException
java.io.IOException
public boolean handleContinueSearch(atg.servlet.DynamoHttpServletRequest request, atg.servlet.DynamoHttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
request
- response
-
javax.servlet.ServletException
java.io.IOException
public boolean handleNextResultPageNum(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
pRequest
- pResponse
-
javax.servlet.ServletException
java.io.IOException
public boolean handlePreviousResultPageNum(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
pRequest
- pResponse
-
javax.servlet.ServletException
java.io.IOException
public boolean handleCancelSearch(atg.servlet.DynamoHttpServletRequest request, atg.servlet.DynamoHttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
request
- response
-
javax.servlet.ServletException
java.io.IOException
protected void generateFormException(java.lang.String whatException, java.lang.String substitutionText, atg.servlet.DynamoHttpServletRequest pRequest)
whatException
- substitutionText
- pRequest
- protected java.util.Locale getLocale(atg.servlet.DynamoHttpServletRequest pRequest)
pRequest
- DynamoHttpServletRequest
protected atg.repository.Repository findLocaleRepository(atg.servlet.DynamoHttpServletRequest request)
request
- DynamoHttpServletRequest
protected boolean checkFormError(java.lang.String pErrorURL, java.lang.String pSuccessURL, atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
pErrorURL
- the URL to redirect to if there are any form errorspSuccessURL
- pRequest
- the servlet's requestpResponse
- the servlet's response
javax.servlet.ServletException
- if there was an error while executing the code
java.io.IOException
- if there was an error with servlet ioprotected java.sql.Date getDateConstant(java.lang.String pDate)
pDate
- String object
public void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) throws javax.servlet.ServletException, java.io.IOException
service
in interface javax.servlet.Servlet
javax.servlet.ServletException
- if an error occurred while processing the servlet request
java.io.IOException
- if an error occurred while reading or writing the servlet
requestpublic void service(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
pRequest
- pResponse
-
javax.servlet.ServletException
- an application specific error occurred processing this request
java.io.IOException
- an error occurred reading data from the request or writing
data to the response.public void destroy()
destroy
in interface javax.servlet.Servlet
public javax.servlet.ServletConfig getServletConfig()
getServletConfig
in interface javax.servlet.Servlet
public java.lang.String getServletInfo()
getServletInfo
in interface javax.servlet.Servlet
public void init(javax.servlet.ServletConfig config)
init
in interface javax.servlet.Servlet
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |