atg.commerce.gifts
Class SearchFormHandler

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.gifts.SearchFormHandler
All Implemented Interfaces:
DropletFormHandler, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class SearchFormHandler
extends GenericFormHandler

This search form handler is used to support giftlist searches. Giftlist searching will search the giftlist repository for published giftlists that match the search criteria. This formhandler is configurable to search most giftlist properties. At a minimum, doNameSearch and doAdvancedSearch are boolean properties that specify what type of searches to perform. HandleSearch looks at these values to build the search query and executes on the Repository view.

Name
Name searching uses name properties and an input search string to do text pattern matching. Values entered will be used to build the subquery for name searching of giftlist owners. The name search query will be constructed using an OR clause of both first and last names.

Advanced
Advanced searches provide possible search options for each property specified in AdvancedSearchPropertyNames. For example, enumerated types will be defined in the repository with a set number of values. Advanced searching will retrieve these values from the definition to display in a select box. The advanced query will be built from options selected to further refine the gift list search. Name searches can also be built into the query here, to enable searches on a first name basis or last name bases if so desired. If this sort of name searching is used within the form its likely that the above Name search will not be used and only the advanced sort properties firstName and lastName will be used to enable the name searching.

A note on firstName and lastName Advanced search properties. As firstName and lastName are not properties that exist in the gift list repository definition, we therefore must map to such properties. Therefore the properties firstNamePropertyName, lastNamePropertyName and statePropertyName exist to perform this function. We can supply advanced search properties of firstName, lastName and state, and these will be mapped to configured properties firstNamePropertyName, lastNamePropertyName and statePropertyName.


Field Summary
static java.lang.String ALL
           
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String CURRENT
           
protected  int mCurrentPage
           
protected  java.lang.String mFirstNamePropertyName
           
protected  java.lang.String mLastNamePropertyName
           
protected  int mResultsPerPage
           
protected  java.lang.String mSearchErrorURL
           
protected  java.lang.String mSearchSuccessURL
           
protected  boolean mSortCaseSensitive
           
protected  java.lang.String mSortDirection
           
protected  java.lang.String mSortField
           
protected  int mTotalItemCount
           
protected  boolean mUseContainsForNames
           
static java.lang.String SORT_DIRECTION_ASCENDING
          sort direction for a ascending search result
static java.lang.String SORT_DIRECTION_DESCENDING
          sort direction for a descending search result
 
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()
          Constructs an instanceof SearchFormHandler
 
Method Summary
protected  QueryOptions buildQueryOptions()
          buildQueryOptions is called to set the query options on the property mQueryOptions
protected  SortDirectives buildSortDirectives()
          buildSortDirectives is called to construct the SortDirectives object that will be used in the repository query.
protected  java.lang.Integer calculateEndIndex()
          calculateEndIndex Calculates the ending index used for the query
protected  java.lang.Integer calculateStartIndex()
          calculateStartIndex Calculates the starting index used for the query.
 java.util.Collection doSearch(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Performs the search operation and generates the result set.
protected  void executeCountQuery(RepositoryView pView, Query pQuery)
          executeCountQuery Executes a count query and stores the results in the totalItemCount
protected  Query generateAdvancedSearchQuery(java.lang.String pItemType, QueryBuilder pQueryBuilder)
          Return a query which represents an advanced search based on selected property values.
protected  Query generateNameSearchQuery(java.lang.String pItemType, QueryBuilder pQueryBuilder, java.lang.String pInput)
          Return a query which represents a name search query.
protected  Query generatePublishedSearchQuery(java.lang.String pItemType, QueryBuilder pQueryBuilder)
          Generates a published search query to verify that lists are both public and published.
protected  java.util.Collection generateResultSet(java.lang.String pItemType)
          For the supplied item type return a sub-result set that will be combined into the total result set.
protected  Query generateSearchQuery(java.lang.String pItemType, QueryBuilder pQueryBuilder)
          Return the query that should be executed on the Repository View.
protected  java.util.Collection generateSearchValues(java.lang.String pSearchType)
          generateSearchValues is used by the advanced searching feature.
protected  Query generateSiteConstrainedQuery(java.lang.String[] pSiteIds, QueryBuilder pQueryBuilder)
          Returns a query that represents a site search.
 java.lang.String[] getAdvancedSearchPropertyNames()
          Returns property AdvancedSearchPropertyNames
 int getCurrentPage()
          Returns the currently requested page number.
 java.lang.String getFirstNamePropertyName()
          Returns property firstNamePropertyName
 GiftlistManager getGiftlistManager()
          Returns property GiftlistManager
 Repository getGiftlistRepository()
          Returns property GiftlistRepository
 java.lang.String[] getItemTypes()
          Returns property ItemTypes
 java.lang.String getLastNamePropertyName()
          Returns property lastNamePropertyName
 java.lang.String getLoggingIdentifier()
          Returns property LoggingIdentifier
 java.lang.String[] getNameSearchPropertyNames()
          Returns property NameSearchPropertyNames
 java.util.Hashtable getPropertyValues()
          Returns property PropertyValues
 java.util.HashMap getPropertyValuesByType()
          Returns property PropertyValuesByType
 java.lang.String[] getPublishedSearchPropertyNames()
          Returns property PublishedSearchPropertyNames
 QueryOptions getQueryOptions()
          Returns property QueryOptions
 int getResultsPerPage()
          Returns the number of objects to be queried at one time.
 java.lang.String getSearchErrorURL()
           
 java.lang.String getSearchInput()
          Returns property SearchInput
 java.util.Collection getSearchResults()
          Returns property SearchResults
 java.util.HashMap getSearchResultsByItemType()
          Returns property SearchResultsByItemType
 java.lang.String getSearchSuccessURL()
           
 atg.multisite.SiteGroupManager getSiteGroupManager()
          Returns property siteGroupManager.
 java.lang.String[] getSiteIds()
          Returns property siteId
 java.lang.String getSiteScope()
          gets the property siteScope
 boolean getSortCaseSensitive()
          Returns the property SortCaseSensitive
 java.lang.String getSortDirection()
          Returns property SortDirection
 java.lang.String getSortField()
          Returns the property SortField
 java.lang.String getStatePropertyName()
          Returns property statePropertyName
 int getTotalItemCount()
          The total number of objects in the search results.
 boolean handleSearch(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          For each item type specified in itemTypes, call generateSearchResultSet to generate a subResultSet for that item type based on query parameters.
 boolean isDoAdvancedSearch()
          Returns property DoAdvancedSearch
 boolean isDoNameSearch()
          Returns property DoNameSearch
 boolean isDoPagedSearch()
          Returns property DoPagedSearch
 boolean isDoPublishedSearch()
          Returns property DoPublishedSearch
 boolean isUseContainsForNames()
          Returns property UseContainsForNames
 void postSearch(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Called after a search.
 void preSearch(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Called prior to the search taking place.
 void setAdvancedSearchPropertyNames(java.lang.String[] pAdvancedSearchPropertyNames)
          Sets property AdvancedSearchPropertyNames
 void setCurrentPage(int pCurrentPage)
          Sets property CurrentPage
 void setDoAdvancedSearch(boolean pDoAdvancedSearch)
          Sets property DoAdvancedSearch
 void setDoNameSearch(boolean pDoNameSearch)
          Sets property DoNameSearch
 void setDoPagedSearch(boolean pDoPagedSearch)
          Sets property DoPagedSearch
 void setDoPublishedSearch(boolean pDoPublishedSearch)
          Sets property DoPublishedSearch
 void setFirstNamePropertyName(java.lang.String pFirstNamePropertyName)
          Sets property firstNamePropertyName
 void setGiftlistManager(GiftlistManager pGiftlistManager)
          Sets property giftlistManager
 void setGiftlistRepository(Repository pGiftlistRepository)
          Sets property giftlistRepository
 void setItemTypes(java.lang.String[] pItemTypes)
          Sets property ItemTypes
 void setLastNamePropertyName(java.lang.String pLastNamePropertyName)
          Sets property lastNamePropertyName
 void setLoggingIdentifier(java.lang.String pLoggingIdentifier)
          Sets property LoggingIdentifier
 void setNameSearchPropertyNames(java.lang.String[] pNameSearchPropertyNames)
          Sets property NameSearchPropertyNames
 void setPropertyValues(java.util.Hashtable pPropertyValues)
          Sets property PropertyValues
 void setPublishedSearchPropertyNames(java.lang.String[] pPublishedSearchPropertyNames)
          Sets property PublishedSearchPropertyNames
 void setQueryOptions(QueryOptions pQueryOptions)
          Sets property QueryOptions
 void setResultsPerPage(int pResultsPerPage)
          Sets property ResultsPerPage
 void setSearchErrorURL(java.lang.String pSearchErrorURL)
           
 void setSearchInput(java.lang.String pSearchInput)
          Sets property SearchInput
 void setSearchSuccessURL(java.lang.String pSearchSuccessURL)
           
 void setSiteGroupManager(atg.multisite.SiteGroupManager pSiteGroupManager)
          Sets property SiteGroupManager.
 void setSiteIds(java.lang.String[] pSiteIds)
          Sets property siteIds
 void setSiteScope(java.lang.String pSiteScope)
          Sets the property siteScope.
 void setSortCaseSensitive(boolean pSortCaseSensitive)
          Sets property SortCaseSensitive
 void setSortDirection(java.lang.String pSortDirection)
          Sets property SortDirection
 void setSortField(java.lang.String pSortField)
          Sets property SortField
 void setStatePropertyName(java.lang.String pStatePropertyName)
          Sets property statePropertyName
 void setTotalItemCount(int pTotalItemCount)
          Sets property TotalItemCount
 void setUseContainsForNames(boolean pUseContainsForNames)
          Sets property UseContainsForNames
 
Methods inherited from class atg.droplet.GenericFormHandler
addFormException, addUncheckedFormException, afterSet, beforeSet, checkFormRedirect, createFormSubmissionMessage, getCancelURL, getCheckForValidSession, getFormError, getFormExceptions, getFormName, getMessagePort, getMessageSource, getMessageType, getPropertyExceptions, getSendMessages, getUncheckedFormExceptions, handleCancel, handleFormException, handleUncheckedFormException, hasUncheckedFormExceptions, isDeferForwardsAndRedirects, isRestorableForm, isUseForwards, isValidSession, redirectOrForward, resetFormExceptions, setCancelURL, 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, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, 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, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, 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

CLASS_VERSION

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

See Also:
Constant Field Values

SORT_DIRECTION_DESCENDING

public static final java.lang.String SORT_DIRECTION_DESCENDING
sort direction for a descending search result

See Also:
Constant Field Values

SORT_DIRECTION_ASCENDING

public static final java.lang.String SORT_DIRECTION_ASCENDING
sort direction for a ascending search result

See Also:
Constant Field Values

ALL

public static final java.lang.String ALL
See Also:
Constant Field Values

CURRENT

public static final java.lang.String CURRENT
See Also:
Constant Field Values

mTotalItemCount

protected int mTotalItemCount

mCurrentPage

protected int mCurrentPage

mSearchSuccessURL

protected java.lang.String mSearchSuccessURL

mSearchErrorURL

protected java.lang.String mSearchErrorURL

mFirstNamePropertyName

protected java.lang.String mFirstNamePropertyName

mLastNamePropertyName

protected java.lang.String mLastNamePropertyName

mUseContainsForNames

protected boolean mUseContainsForNames

mSortDirection

protected java.lang.String mSortDirection

mSortField

protected java.lang.String mSortField

mSortCaseSensitive

protected boolean mSortCaseSensitive

mResultsPerPage

protected int mResultsPerPage
Constructor Detail

SearchFormHandler

public SearchFormHandler()
Constructs an instanceof SearchFormHandler

Method Detail

getTotalItemCount

public int getTotalItemCount()
The total number of objects in the search results.

The value should relfect the total number of items in the complete result set without the indexing constraints. The client side uses this value to determine how many pages can be requested

Returns:
Returns the total number of objects in the search results.

setTotalItemCount

public void setTotalItemCount(int pTotalItemCount)
Sets property TotalItemCount

Parameters:
pTotalItemCount - the property to set the total number of objects in the search results.

getCurrentPage

public int getCurrentPage()
Returns the currently requested page number. Page numbers are zero based.

This value is supplied by the client side and is used to calculate the query's starting and ending indexes.

Note that this value must be request scoped because the client side can request pages in ansynchronous random order.

Returns:
The value of the variable CurrentPage

setCurrentPage

public void setCurrentPage(int pCurrentPage)
Sets property CurrentPage

Parameters:
pCurrentPage - the property to set the currently requested page number.

getSearchSuccessURL

public java.lang.String getSearchSuccessURL()
Returns:
Returns the searchSuccessURL.

setSearchSuccessURL

public void setSearchSuccessURL(java.lang.String pSearchSuccessURL)
Parameters:
pSearchSuccessURL - The searchSuccessURL to set.

getSearchErrorURL

public java.lang.String getSearchErrorURL()
Returns:
Returns the searchErrorURL.

setSearchErrorURL

public void setSearchErrorURL(java.lang.String pSearchErrorURL)
Parameters:
pSearchErrorURL - The searchErrorURL to set.

setLoggingIdentifier

public void setLoggingIdentifier(java.lang.String pLoggingIdentifier)
Sets property LoggingIdentifier

Parameters:
pLoggingIdentifier - the property which identifies this object as the Giftlist Search.

getLoggingIdentifier

public java.lang.String getLoggingIdentifier()
Returns property LoggingIdentifier

Returns:
The value of the property LoggingIdentifier.

setFirstNamePropertyName

public void setFirstNamePropertyName(java.lang.String pFirstNamePropertyName)
Sets property firstNamePropertyName

Parameters:
pFirstNamePropertyName - the property to store the owner firstName property.

getFirstNamePropertyName

public java.lang.String getFirstNamePropertyName()
Returns property firstNamePropertyName

Returns:
The value of the property firstNamePropertyName.

setLastNamePropertyName

public void setLastNamePropertyName(java.lang.String pLastNamePropertyName)
Sets property lastNamePropertyName

Parameters:
pLastNamePropertyName - the property to store the owner lastName property.

getLastNamePropertyName

public java.lang.String getLastNamePropertyName()
Returns property lastNamePropertyName

Returns:
The value of the property lastNamePropertyName.

setStatePropertyName

public void setStatePropertyName(java.lang.String pStatePropertyName)
Sets property statePropertyName

Parameters:
pStatePropertyName - the property to store the owner state property.

getStatePropertyName

public java.lang.String getStatePropertyName()
Returns property statePropertyName

Returns:
The value of the property statePropertyName.

setNameSearchPropertyNames

public void setNameSearchPropertyNames(java.lang.String[] pNameSearchPropertyNames)
Sets property NameSearchPropertyNames

Parameters:
pNameSearchPropertyNames - the property to store name search property names.

getNameSearchPropertyNames

public java.lang.String[] getNameSearchPropertyNames()
Returns property NameSearchPropertyNames

Returns:
The value of the property NameSearchPropertyNames.

setUseContainsForNames

public void setUseContainsForNames(boolean pUseContainsForNames)
Sets property UseContainsForNames

Parameters:
pUseContainsForNames - the property to store the boolean value of which query operation to use when performing name search. true for CONTAINS, false for STARTS_WITH.

isUseContainsForNames

public boolean isUseContainsForNames()
Returns property UseContainsForNames

Returns:
The value of the property UseContainsForNames.

setDoNameSearch

public void setDoNameSearch(boolean pDoNameSearch)
Sets property DoNameSearch

Parameters:
pDoNameSearch - the property to store the boolean value of whether or not to perform a name search.

isDoNameSearch

public boolean isDoNameSearch()
Returns property DoNameSearch

Returns:
The value of the property DoNameSearch.

setSiteScope

public void setSiteScope(java.lang.String pSiteScope)
Sets the property siteScope. This property expects the following values: "all", "current", or existing shareable type ID. The property specifies whether gift lists are not site-limited, limited to one site or to shareable correspondingly.


getSiteScope

public java.lang.String getSiteScope()
gets the property siteScope


setSiteIds

public void setSiteIds(java.lang.String[] pSiteIds)
Sets property siteIds

Parameters:
pSiteIds - the property which holds site IDs in which context search happens.

getSiteIds

public java.lang.String[] getSiteIds()
Returns property siteId

Returns:
The value of the property SiteId.

setSearchInput

public void setSearchInput(java.lang.String pSearchInput)
Sets property SearchInput

Parameters:
pStringInput - the property to store the input search string to parse and search.

getSearchInput

public java.lang.String getSearchInput()
Returns property SearchInput

Returns:
The value of the property SearchInput trimming any extra space.

setGiftlistRepository

public void setGiftlistRepository(Repository pGiftlistRepository)
Sets property giftlistRepository

Parameters:
pGiftlistRepository - the property to store the name of the giftlist repository.

getGiftlistRepository

public Repository getGiftlistRepository()
Returns property GiftlistRepository

Returns:
The value of the property GiftlistRepository

setGiftlistManager

public void setGiftlistManager(GiftlistManager pGiftlistManager)
Sets property giftlistManager

Parameters:
pGiftlistManager - gift list manager.

getGiftlistManager

public GiftlistManager getGiftlistManager()
Returns property GiftlistManager

Returns:
gift list manager

setSiteGroupManager

public void setSiteGroupManager(atg.multisite.SiteGroupManager pSiteGroupManager)
Sets property SiteGroupManager.

Parameters:
pSiteGroupManager - the siteGroupManager

getSiteGroupManager

public atg.multisite.SiteGroupManager getSiteGroupManager()
Returns property siteGroupManager. return property siteGroupManager.


setItemTypes

public void setItemTypes(java.lang.String[] pItemTypes)
Sets property ItemTypes

Parameters:
pItemTypes - the property to store the item types to search in the repository (e.g. gift-list).

getItemTypes

public java.lang.String[] getItemTypes()
Returns property ItemTypes

Returns:
The value of the property itemTypes

setQueryOptions

public void setQueryOptions(QueryOptions pQueryOptions)
Sets property QueryOptions

Parameters:
pQueryOptions - the property to store specific query options to used when generating the search string.

getQueryOptions

public QueryOptions getQueryOptions()
Returns property QueryOptions

Returns:
The value of the property queryOptions

setSortDirection

public void setSortDirection(java.lang.String pSortDirection)
Sets property SortDirection

Parameters:
pSortDirection - the property to store the sort direction.

getSortDirection

public java.lang.String getSortDirection()
Returns property SortDirection

Returns:
The value of the property SortDirection

setSortField

public void setSortField(java.lang.String pSortField)
Sets property SortField

Parameters:
pSortField - the property to set the field by which the search results are to be sorted on.

getSortField

public java.lang.String getSortField()
Returns the property SortField

Returns:
the SortField

setSortCaseSensitive

public void setSortCaseSensitive(boolean pSortCaseSensitive)
Sets property SortCaseSensitive

Parameters:
pSortCaseSensitive - the property to set if the sort should be case sensitive.

getSortCaseSensitive

public boolean getSortCaseSensitive()
Returns the property SortCaseSensitive

Returns:
the SortCaseSensitive

getResultsPerPage

public int getResultsPerPage()
Returns the number of objects to be queried at one time.

This value, along with the current page is used to calculate the starting and ending indexes of the query.

Returns:
The value of the property ResultsPerPage

setResultsPerPage

public void setResultsPerPage(int pResultsPerPage)
Sets property ResultsPerPage

Parameters:
pResultsPerPage - the property to set the number of objects to be queried at one time.

setDoPagedSearch

public void setDoPagedSearch(boolean pDoPagedSearch)
Sets property DoPagedSearch

Parameters:
pDoPagedSearch - the property to store the boolean value of whether or not to perform a paged search.

isDoPagedSearch

public boolean isDoPagedSearch()
Returns property DoPagedSearch

Returns:
The value of the property DoPagedSearch.

getSearchResults

public java.util.Collection getSearchResults()
Returns property SearchResults

Returns:
The value of the property SearchResults

getSearchResultsByItemType

public java.util.HashMap getSearchResultsByItemType()
Returns property SearchResultsByItemType

Returns:
The value of the property SearchResultsByItemType

setDoAdvancedSearch

public void setDoAdvancedSearch(boolean pDoAdvancedSearch)
Sets property DoAdvancedSearch

Parameters:
pDoAdvancedSearch - the property to store the boolean value of whether or not to perform a advanced search.

isDoAdvancedSearch

public boolean isDoAdvancedSearch()
Returns property DoAdvancedSearch

Returns:
The value of the property DoAdvancedSearch

setAdvancedSearchPropertyNames

public void setAdvancedSearchPropertyNames(java.lang.String[] pAdvancedSearchPropertyNames)
Sets property AdvancedSearchPropertyNames

Parameters:
pAdvancedSearchPropertyNames - the property to store advanced search property names.

getAdvancedSearchPropertyNames

public java.lang.String[] getAdvancedSearchPropertyNames()
Returns property AdvancedSearchPropertyNames

Returns:
The value of the property AdvancedSearchPropertyNames

setDoPublishedSearch

public void setDoPublishedSearch(boolean pDoPublishedSearch)
Sets property DoPublishedSearch

Parameters:
pDoPublishedSearch - the property to store the boolean value of whether or not to perform a published search.

isDoPublishedSearch

public boolean isDoPublishedSearch()
Returns property DoPublishedSearch

Returns:
The value of the property DoPublishedSearch

setPublishedSearchPropertyNames

public void setPublishedSearchPropertyNames(java.lang.String[] pPublishedSearchPropertyNames)
Sets property PublishedSearchPropertyNames

Parameters:
pPublishedSearchPropertyNames - the property to store published search property names.

getPublishedSearchPropertyNames

public java.lang.String[] getPublishedSearchPropertyNames()
Returns property PublishedSearchPropertyNames

Returns:
The value of the property PublishedSearchPropertyNames

getPropertyValuesByType

public java.util.HashMap getPropertyValuesByType()
Returns property PropertyValuesByType

Returns:
The value of the property PropertyValuesByType

setPropertyValues

public void setPropertyValues(java.util.Hashtable pPropertyValues)
Sets property PropertyValues

Parameters:
pPropertyValues - the property to store selected property values for advanced searching.

getPropertyValues

public java.util.Hashtable getPropertyValues()
Returns property PropertyValues

Returns:
The value of the property PropertyValues

preSearch

public void preSearch(DynamoHttpServletRequest pRequest,
                      DynamoHttpServletResponse pResponse)
               throws javax.servlet.ServletException,
                      java.io.IOException
Called prior to the search taking place.

Parameters:
pRequest -
pResponse -
Throws:
javax.servlet.ServletException
java.io.IOException

handleSearch

public boolean handleSearch(DynamoHttpServletRequest pRequest,
                            DynamoHttpServletResponse pResponse)
                     throws javax.servlet.ServletException,
                            java.io.IOException
For each item type specified in itemTypes, call generateSearchResultSet to generate a subResultSet for that item type based on query parameters.

Parameters:
pRequest - the servlet's request
pResponse - the servlet's response
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

doSearch

public java.util.Collection doSearch(DynamoHttpServletRequest pRequest,
                                     DynamoHttpServletResponse pResponse)
                              throws javax.servlet.ServletException,
                                     java.io.IOException
Performs the search operation and generates the result set.

Parameters:
pRequest -
pResponse -
Throws:
javax.servlet.ServletException
java.io.IOException

postSearch

public void postSearch(DynamoHttpServletRequest pRequest,
                       DynamoHttpServletResponse pResponse)
                throws javax.servlet.ServletException,
                       java.io.IOException
Called after a search.

Parameters:
pRequest -
pResponse -
Throws:
javax.servlet.ServletException
java.io.IOException

executeCountQuery

protected void executeCountQuery(RepositoryView pView,
                                 Query pQuery)
                          throws RepositoryException
executeCountQuery Executes a count query and stores the results in the totalItemCount

Parameters:
pView -
pQuery -
Throws:
RepositoryException

calculateStartIndex

protected java.lang.Integer calculateStartIndex()
calculateStartIndex Calculates the starting index used for the query.

By default, the starting index is the current * resultsPerPage

Returns:
the startIndex

calculateEndIndex

protected java.lang.Integer calculateEndIndex()
calculateEndIndex Calculates the ending index used for the query

By default, the starting index is the (current * resultsPerPage) + resultsPerPage

Returns:
the endIndex

buildSortDirectives

protected SortDirectives buildSortDirectives()
buildSortDirectives is called to construct the SortDirectives object that will be used in the repository query.

By default this method uses the sortDirection and sortField properties to build a SortDirectives object.

Returns:
SortDirectives

buildQueryOptions

protected QueryOptions buildQueryOptions()
buildQueryOptions is called to set the query options on the property mQueryOptions


generateSearchValues

protected java.util.Collection generateSearchValues(java.lang.String pSearchType)
generateSearchValues is used by the advanced searching feature. For the property supplied in the pSearchType parameter, this method will return a list of available search options for that property. Will search through all itemTypes and collect all values for the property. For example, an enumerated property will be defined in the repository item descriptor with a set of values. This method will get possible values from the property descriptor. Other properties may simply be a string type which will require a simple text query.

Parameters:
pSearchType - the search type. Typically corresponds to an property descriptor name in the giftlist repository
Returns:
options or null if no values could be found

generateResultSet

protected java.util.Collection generateResultSet(java.lang.String pItemType)
For the supplied item type return a sub-result set that will be combined into the total result set. generateResultSet calls generateSearchQuery to build the query string based on options. The resulting query is executed on the Repository View and the result set is returned.

Parameters:
pItemType - the type of item to search for. Typically corresponds to an item descriptor name in the giftlist repository
Returns:
null if no items could be found

generateSearchQuery

protected Query generateSearchQuery(java.lang.String pItemType,
                                    QueryBuilder pQueryBuilder)
                             throws RepositoryException
Return the query that should be executed on the Repository View. This method attempts to build its query from name and advanced search subqueries. It calls each sub method to build the sub query. The method attempts to build an AND query between text and advanced search queries.

Parameters:
pItemType - the type of item to search for. Typically corresponds to an item descriptor name in the giftlist repository
pQueryBuilder - the builder that should be used to construct the query
Throws:
RepositoryException - if an error occured while forming the query

generateNameSearchQuery

protected Query generateNameSearchQuery(java.lang.String pItemType,
                                        QueryBuilder pQueryBuilder,
                                        java.lang.String pInput)
                                 throws RepositoryException
Return a query which represents a name search query. This method builds a sub-query for each attribute named in the nameSearchPropertyNames property. Each sub-query is OR'd together to form the total query.

Parameters:
pItemType - the type of item to search for. Typically corresponds to an item descriptor name in the giftlist repository
pQueryBuilder - the builder that should be used to construct the query
pInput - the search string to use for the full name search
Throws:
RepositoryException - if an error occured while forming the query

generatePublishedSearchQuery

protected Query generatePublishedSearchQuery(java.lang.String pItemType,
                                             QueryBuilder pQueryBuilder)
                                      throws RepositoryException
Generates a published search query to verify that lists are both public and published.

Parameters:
pItemType - the type of item to search for. Typically corresponds to an item descriptor name in the catalog repository
pQueryBuilder - the builder that should be used to construct the query
Throws:
RepositoryException - if an error occured while forming the query

generateAdvancedSearchQuery

protected Query generateAdvancedSearchQuery(java.lang.String pItemType,
                                            QueryBuilder pQueryBuilder)
                                     throws RepositoryException
Return a query which represents an advanced search based on selected property values. This method builds a sub-query for each property found in mAdvancedSearchPropertyNames. If the property type is another repository item, we need to search below this level for the property value. To do this, we append .displayName to the property before searching. All advanced property sub-queries are AND'd together to form the final complete query string.

Parameters:
pItemType - the type of item to search for. Typically corresponds to an item descriptor name in the catalog repository
pQueryBuilder - the builder that should be used to construct the query
Throws:
RepositoryException - if an error occured while forming the query

generateSiteConstrainedQuery

protected Query generateSiteConstrainedQuery(java.lang.String[] pSiteIds,
                                             QueryBuilder pQueryBuilder)
                                      throws RepositoryException
Returns a query that represents a site search. This method builds a query based on settings of GiftlistManager. If GiftlistManager is not site limited null will be returned. If GiftlistManager is limited to one site or a sharable type then a query with corresponding constraints on the siteId property will be returned.

Parameters:
pSiteIds - the list of site IDs to which gift list should belong
pQueryBuilder - the builder that should be used to construct the query
Returns:
query
Throws:
RepositoryException