atg.commerce.csr.search
Class OrderSearchFormHandler

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.droplet.EmptyFormHandler
              extended by atg.droplet.GenericFormHandler
                  extended by atg.commerce.csr.search.SearchFormHandler
                      extended by atg.commerce.csr.search.OrderSearchFormHandler
All Implemented Interfaces:
atg.droplet.DropletFormHandler, atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.logging.ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener, java.util.EventListener, javax.servlet.Servlet

public class OrderSearchFormHandler
extends SearchFormHandler
implements javax.servlet.Servlet

This OrderSearchFormHandler class is a subclass of SearchFormhandler and is used to search order on order repository and other order related repositories( Profile, Catalog). The class builds a Query object and generates search resultset

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="&lt"> <
 <option value="&gt"> >
 <option value="&lt="> <=
 <option value="&gt="> >=
 </select>
 <input type="text" bean="RepositorySearchForm.SearchAttributes[1].Values" value=""> </td>
 <input type="submit" bean="RepositorySearchForm.Search" value="Search">
 </FORM>


Field Summary
protected static int CATALOG_SEARCH_METHOD
           
protected static java.lang.String CATALOG_SEARCH_RELATION
           
static java.lang.String CLASS_VERSION
          Class version string
protected static int PROFILE_SEARCH_METHOD
           
 
Fields inherited from class atg.commerce.csr.search.SearchFormHandler
DIR_ASCENDING_STRING, DIR_DESCENDING_STRING, OUTPUT, SEARCHFORMRESOURCES, sResourceBundle
 
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
OrderSearchFormHandler()
           
 
Method Summary
 void clearSearchResults()
          Clears the window-scoped search results form handler in preparation for a new call by clearing search criteria, results and any related data specific to the previous search.
protected  atg.repository.Repository findLocaleCatalogRepository(atg.servlet.DynamoHttpServletRequest request)
          ------------------------------------- findLocaleRepository Use user's current locale to find the right catalog repository to search
protected  atg.repository.Query generateRepositorySearchQuery(atg.servlet.DynamoHttpServletRequest request, atg.servlet.DynamoHttpServletResponse response, SearchAttribute[] pSearchAttributes, SearchAttribute pOrderSearchAttribute, atg.repository.Repository pRepository, java.lang.String pViewName)
          generate the order search Query on order related repository (profile or catalog)
protected  atg.repository.Query generateSearchQuery(atg.servlet.DynamoHttpServletRequest request, atg.servlet.DynamoHttpServletResponse response)
          generate the search Query
 atg.repository.Repository getCatalogRepository()
          Returns Catalog Repository which is being queried
 SearchAttribute getCatalogSearchAttribute(int pIndex)
          Returns Catalog SearchAttribute by which the search is done
 SearchAttribute[] getCatalogSearchAttributes()
          Returns Catalog SearchAttributes by which the search is done
 java.lang.String getCatalogSearchProperty()
           
 java.lang.String getCatalogSearchViewName()
           
 atg.commerce.catalog.CatalogTools getCatalogTools()
          Returns property catalogTools.
 int getMaxProfileResults()
           
 java.lang.String getProfileIdProperty()
           
 java.lang.String getProfileProperty()
           
 atg.repository.Repository getProfileRepository()
          Returns profile Repository which is being queried
 SearchAttribute getProfileSearchAttribute(int pIndex)
          Returns SearchAttribute by which the search is done
 SearchAttribute[] getProfileSearchAttributes()
          Returns SearchAttributes by which the search is done
 java.lang.String getProfileSearchViewName()
           
 boolean getSearchOnCatalog()
          Returns mSearchOnCatalog
 boolean getSearchOnProfile()
          Returns mSearchOnProfile
 boolean isAssumeSingleDataSource()
          If true, an order query that contains profile constraints will be executed as a single compound query.
 void setAssumeSingleDataSource(boolean pAssumeSingleDataSource)
          If true, an order query that contains profile constraints will be executed as a single compound query.
 void setCatalogRepository(atg.repository.Repository pRepository)
          Sets Catalog Repository which is being queried
 void setCatalogSearchableAttributeNum(int pCatalogSearchableAttributeNum)
          Sets property mCatalogSearchableAttributeNum
 void setCatalogSearchAttribute(int pIndex, SearchAttribute pSearchAttribute)
          Sets Catalog SearchAttribute by which the search is done
 void setCatalogSearchAttributes(SearchAttribute[] pSearchAttributes)
          Sets SearchAttributes by which the search is done
 void setCatalogSearchProperty(java.lang.String catalogSearchProperty)
           
 void setCatalogSearchViewName(java.lang.String catalogSearchViewName)
           
 void setCatalogTools(atg.commerce.catalog.CatalogTools pCatalogTools)
          Sets property catalogTools.
 void setMaxProfileResults(int maxProfileResults)
           
 void setProfileIdProperty(java.lang.String profileIdProperty)
           
 void setProfileProperty(java.lang.String profileProperty)
           
 void setProfileRepository(atg.repository.Repository pRepository)
          Sets profile Repository which is being queried
 void setProfileSearchableAttributeNum(int pProfileSearchableAttributeNum)
          Sets property mProfileSearchableAttributeNum
 void setProfileSearchAttribute(int pIndex, SearchAttribute pSearchAttribute)
          Sets ProfileSearchAttribute by which the search is done
 void setProfileSearchAttributes(SearchAttribute[] pSearchAttributes)
          Sets SearchAttributes by which the search is done
 void setProfileSearchViewName(java.lang.String profileSearchViewName)
           
 void setSearchOnCatalog(boolean pSearchOnCatalog)
          Sets mSearchOnCatalog
 void setSearchOnProfile(boolean pSearchOnProfile)
          Sets mSearchOnProfile
protected  boolean validateSearchCriteria(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          validateSearchCriteria
 
Methods inherited from class atg.commerce.csr.search.SearchFormHandler
checkFormError, destroy, findLocaleRepository, generateFormException, getAllowOpenEndedSearch, getCancelURL, getCurrentResultPageNum, getDateConstant, getEndIndex, getErrorURL, getLocale, getMaxResultNum, getMaxResultsPerPage, getQuery, getQueryOptions, getRepository, getRepositorySearcher, getResultNumGreaterThanMax, getResultPageCount, getResultSetSize, getResultsNextPage, getSearchableAttributeNum, getSearchAttribute, getSearchAttributes, getSearchResults, getServletConfig, getServletInfo, getSortDirection, getSortDirectionInt, getSortProperty, getStartIndex, getSuccessURL, getUseLocaleRepository, handleCancelSearch, handleContinueSearch, handleNextResultPageNum, handlePreviousResultPageNum, handleSearch, handleSearchQuery, init, isEnableCountQuery, service, service, setAllowOpenEndedSearch, setCancelURL, setCurrentResultPageNum, setEnableCountQuery, setErrorURL, setMaxResultNum, setMaxResultsPerPage, setQuery, setQueryOptions, setRepository, setRepositorySearcher, setRepositoryViewName, setResultNumGreaterThanMax, setResultSetSize, setSearchableAttributeNum, setSearchAttribute, setSearchAttributes, setSearchResults, setSortDirection, setSortProperty, setSuccessURL, setUseLocaleRepository, setUserName, validateSearchCriteria, validateSearchValue
 
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
 
Methods inherited from interface javax.servlet.Servlet
destroy, getServletConfig, getServletInfo, init, service
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values

PROFILE_SEARCH_METHOD

protected static final int PROFILE_SEARCH_METHOD
See Also:
Constant Field Values

CATALOG_SEARCH_METHOD

protected static final int CATALOG_SEARCH_METHOD
See Also:
Constant Field Values

CATALOG_SEARCH_RELATION

protected static final java.lang.String CATALOG_SEARCH_RELATION
See Also:
Constant Field Values
Constructor Detail

OrderSearchFormHandler

public OrderSearchFormHandler()
Method Detail

setProfileRepository

public void setProfileRepository(atg.repository.Repository pRepository)
Sets profile Repository which is being queried

Parameters:
pRepository - the order Repository which is being queried

getProfileRepository

public atg.repository.Repository getProfileRepository()
Returns profile Repository which is being queried


setSearchOnProfile

public void setSearchOnProfile(boolean pSearchOnProfile)
Sets mSearchOnProfile

Parameters:
pSearchOnProfile - boolean determining whether to search on a profile

getSearchOnProfile

public boolean getSearchOnProfile()
Returns mSearchOnProfile


setCatalogRepository

public void setCatalogRepository(atg.repository.Repository pRepository)
Sets Catalog Repository which is being queried

Parameters:
pRepository - the Catalog Repository which is being queried

getCatalogRepository

public atg.repository.Repository getCatalogRepository()
Returns Catalog Repository which is being queried


setSearchOnCatalog

public void setSearchOnCatalog(boolean pSearchOnCatalog)
Sets mSearchOnCatalog

Parameters:
pSearchOnCatalog - a boolean determining whether to search the catalog repository

getSearchOnCatalog

public boolean getSearchOnCatalog()
Returns mSearchOnCatalog


setProfileSearchAttributes

public void setProfileSearchAttributes(SearchAttribute[] pSearchAttributes)
Sets SearchAttributes by which the search is done

Parameters:
pSearchAttributes - the SearchAttributes by which the search is done

getProfileSearchAttributes

public SearchAttribute[] getProfileSearchAttributes()
Returns SearchAttributes by which the search is done


setProfileSearchAttribute

public void setProfileSearchAttribute(int pIndex,
                                      SearchAttribute pSearchAttribute)
Sets ProfileSearchAttribute by which the search is done


getProfileSearchAttribute

public SearchAttribute getProfileSearchAttribute(int pIndex)
Returns SearchAttribute by which the search is done


isAssumeSingleDataSource

public boolean isAssumeSingleDataSource()
If true, an order query that contains profile constraints will be executed as a single compound query. If false, we will first query the profile database for a list of profile IDs, then querying the order database for orders with those IDs. If set to true, the two DBs must be using the same datasource, or the profile table is not visible from the order datasource. If they aren't, then you need to set this to false and perform two queries.

Returns:
The boolean value.

setAssumeSingleDataSource

public void setAssumeSingleDataSource(boolean pAssumeSingleDataSource)
If true, an order query that contains profile constraints will be executed as a single compound query. If false, we will first query the profile database for a list of profile IDs, then querying the order database for orders with those IDs. If set to true, the two DBs must be using the same datasource, or the profile table is not visible from the order datasource. If they aren't, then you need to set this to false and perform two queries.

Parameters:
pAssumeSingleDataSource - The boolean value.

setCatalogSearchAttributes

public void setCatalogSearchAttributes(SearchAttribute[] pSearchAttributes)
Sets SearchAttributes by which the search is done

Parameters:
pSearchAttributes - the SearchAttributes by which the search is done

getCatalogSearchAttributes

public SearchAttribute[] getCatalogSearchAttributes()
Returns Catalog SearchAttributes by which the search is done


setCatalogSearchAttribute

public void setCatalogSearchAttribute(int pIndex,
                                      SearchAttribute pSearchAttribute)
Sets Catalog SearchAttribute by which the search is done


getCatalogSearchAttribute

public SearchAttribute getCatalogSearchAttribute(int pIndex)
Returns Catalog SearchAttribute by which the search is done


setCatalogTools

public void setCatalogTools(atg.commerce.catalog.CatalogTools pCatalogTools)
Sets property catalogTools.

Parameters:
pCatalogTools - the property to store the global service catalog tools factory to obtain the catalog to search in.

getCatalogTools

public atg.commerce.catalog.CatalogTools getCatalogTools()
Returns property catalogTools.

Returns:
The value of the property catalogTools

setCatalogSearchableAttributeNum

public void setCatalogSearchableAttributeNum(int pCatalogSearchableAttributeNum)
Sets property mCatalogSearchableAttributeNum

Parameters:
pCatalogSearchableAttributeNum - the property to store

setProfileSearchableAttributeNum

public void setProfileSearchableAttributeNum(int pProfileSearchableAttributeNum)
Sets property mProfileSearchableAttributeNum

Parameters:
pProfileSearchableAttributeNum - the property to store

findLocaleCatalogRepository

protected atg.repository.Repository findLocaleCatalogRepository(atg.servlet.DynamoHttpServletRequest request)
------------------------------------- findLocaleRepository Use user's current locale to find the right catalog repository to search

Parameters:
request -
Returns:
Repository

generateSearchQuery

protected atg.repository.Query generateSearchQuery(atg.servlet.DynamoHttpServletRequest request,
                                                   atg.servlet.DynamoHttpServletResponse response)
                                            throws javax.servlet.ServletException,
                                                   java.io.IOException
generate the search Query

Overrides:
generateSearchQuery in class SearchFormHandler
Parameters:
request -
response -
Returns:
success of the execution
Throws:
javax.servlet.ServletException
java.io.IOException

generateRepositorySearchQuery

protected atg.repository.Query generateRepositorySearchQuery(atg.servlet.DynamoHttpServletRequest request,
                                                             atg.servlet.DynamoHttpServletResponse response,
                                                             SearchAttribute[] pSearchAttributes,
                                                             SearchAttribute pOrderSearchAttribute,
                                                             atg.repository.Repository pRepository,
                                                             java.lang.String pViewName)
                                                      throws javax.servlet.ServletException,
                                                             java.io.IOException
generate the order search Query on order related repository (profile or catalog)

Parameters:
request -
response -
pSearchAttributes -
pOrderSearchAttribute -
pRepository -
pViewName -
Returns:
Query
Throws:
javax.servlet.ServletException
java.io.IOException

validateSearchCriteria

protected boolean validateSearchCriteria(atg.servlet.DynamoHttpServletRequest pRequest,
                                         atg.servlet.DynamoHttpServletResponse pResponse)
                                  throws javax.servlet.ServletException,
                                         java.io.IOException
validateSearchCriteria

Overrides:
validateSearchCriteria in class SearchFormHandler
Parameters:
pRequest -
pResponse -
Returns:
success of the execution
Throws:
javax.servlet.ServletException
java.io.IOException

getMaxProfileResults

public int getMaxProfileResults()

setMaxProfileResults

public void setMaxProfileResults(int maxProfileResults)

getProfileIdProperty

public java.lang.String getProfileIdProperty()

setProfileIdProperty

public void setProfileIdProperty(java.lang.String profileIdProperty)

getProfileProperty

public java.lang.String getProfileProperty()

setProfileProperty

public void setProfileProperty(java.lang.String profileProperty)

getProfileSearchViewName

public java.lang.String getProfileSearchViewName()

setProfileSearchViewName

public void setProfileSearchViewName(java.lang.String profileSearchViewName)

getCatalogSearchProperty

public java.lang.String getCatalogSearchProperty()

setCatalogSearchProperty

public void setCatalogSearchProperty(java.lang.String catalogSearchProperty)

getCatalogSearchViewName

public java.lang.String getCatalogSearchViewName()

setCatalogSearchViewName

public void setCatalogSearchViewName(java.lang.String catalogSearchViewName)

clearSearchResults

public void clearSearchResults()
Clears the window-scoped search results form handler in preparation for a new call by clearing search criteria, results and any related data specific to the previous search.