public class SearchServiceGenerator extends ServiceableGenerator
Modifier and Type | Class and Description |
---|---|
(package private) static class |
SearchServiceGenerator.SearchComponentError |
manager
objectModel, parameters, resolver, source
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
Constructor and Description |
---|
SearchServiceGenerator() |
Modifier and Type | Method and Description |
---|---|
protected SearchComponentArguments |
_buildArguments(Request request)
Builds
SearchComponentArguments |
protected int |
_computeResultsPerPage(SearchServiceInstance serviceInstance)
Computes the number of results per page
|
protected int |
_computeStartIndex(int pageIndex,
SearchServiceInstance serviceInstance)
Computes the start index (i.e.
|
protected SearchServiceDebugModeHelper.DebugMode |
_debugMode(Request request)
Gets the debug mode if activated
|
protected String |
_getRequestIdentifier(Request request)
Gets the identifier of the request for display debug purposes only
|
protected void |
_handleErrors(List<SearchServiceGenerator.SearchComponentError> errors)
Handles errors of
SearchComponent s |
protected boolean |
_inputValid(Request request,
SearchServiceInstance serviceInstance,
SearchServiceDebugModeHelper.DebugMode debugMode)
Checks if inputs are valid
|
protected boolean |
_isFormSubmitted(Request request)
Checks if the form was submitted
|
protected Optional<Integer> |
_resultsPerPage(SearchServiceInstance serviceInstance)
Gets the number of results per page
|
protected String |
_retrieveCurrentLang(Request request,
Page page)
Retrieves the current lang
|
protected Page |
_retrieveCurrentPage(Request request,
String zoneItemId)
Retrieves the current page
|
protected Site |
_retrieveCurrentSite(Request request,
Page page)
Retrieves the current site
|
protected int |
_retrievePageIndex(Request request)
Retrieves the current page index of the search
|
protected String |
_retrieveZoneItemId(Request request)
Retrieves the current zone item id
|
void |
enableLogging(Logger logger) |
void |
generate() |
protected SearchServiceInstance |
getInstance(Request request,
String zoneItemId)
Gets the
SearchServiceInstance being processed |
void |
service(ServiceManager smanager) |
void |
setup(SourceResolver sourceResolver,
Map objModel,
String src,
Parameters par) |
dispose
recycle
setConsumer, setContentHandler, setLexicalHandler
getLogger, setupLogger, setupLogger, setupLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setConsumer
static final String __ZONE_ITEM_REQUEST_PARAM_NAME
static final String __ZONE_ITEM_GENERATOR_PARAM_NAME
static final String __PAGINATION_GENERATOR_PARAM_NAME
static final String __SUBMIT_FORM_PARAM_NAME
protected SearchServiceInstanceManager _searchServiceInstanceManager
SearchServiceInstance
sprotected SearchService _searchService
Service
protected SiteManager _siteManager
protected SearcherFactory _searcherFactory
protected SearchComponentExtensionPoint _searchComponentEP
SearchComponent
sprotected RenderingContextHandler _renderingContextHandler
protected AmetysObjectResolver _ametysObjectResolver
protected SearchUserInputsRetriever _searchUserInputsRetriever
protected SearchServiceRequestAttributeSetter _requestAttributeSetter
public SearchServiceGenerator()
public void enableLogging(Logger logger)
enableLogging
in interface LogEnabled
enableLogging
in class AbstractLogEnabled
public void service(ServiceManager smanager) throws ServiceException
service
in interface Serviceable
service
in class ServiceableGenerator
ServiceException
public void setup(SourceResolver sourceResolver, Map objModel, String src, Parameters par) throws ProcessingException, SAXException, IOException
setup
in interface SitemapModelComponent
setup
in class AbstractGenerator
ProcessingException
SAXException
IOException
protected SearchComponentArguments _buildArguments(Request request) throws ProcessingException
SearchComponentArguments
request
- The requestSearchComponentArguments
ProcessingException
- If an error occured when processing the requestpublic void generate() throws IOException, SAXException, ProcessingException
protected String _retrieveZoneItemId(Request request)
request
- the requestprotected SearchServiceInstance getInstance(Request request, String zoneItemId)
SearchServiceInstance
being processedrequest
- the requestzoneItemId
- The zone item idSearchServiceInstance
being processedprotected int _retrievePageIndex(Request request) throws ProcessingException
request
- the requestProcessingException
- If an error occured when retrieving the page indexprotected Optional<Integer> _resultsPerPage(SearchServiceInstance serviceInstance)
serviceInstance
- the search service instanceprotected int _computeStartIndex(int pageIndex, SearchServiceInstance serviceInstance)
pageIndex
- the page indexserviceInstance
- the search service instanceprotected int _computeResultsPerPage(SearchServiceInstance serviceInstance)
serviceInstance
- the search service instanceprotected Page _retrieveCurrentPage(Request request, String zoneItemId)
request
- the requestzoneItemId
- The zone item idprotected Site _retrieveCurrentSite(Request request, Page page)
request
- the requestpage
- the pageprotected String _retrieveCurrentLang(Request request, Page page)
request
- the requestpage
- the pageprotected boolean _isFormSubmitted(Request request)
request
- The requesttrue
if the form was submittedprotected boolean _inputValid(Request request, SearchServiceInstance serviceInstance, SearchServiceDebugModeHelper.DebugMode debugMode)
request
- The requestserviceInstance
- The service instance being processeddebugMode
- The debug modetrue
if inputs are validprotected SearchServiceDebugModeHelper.DebugMode _debugMode(Request request)
request
- The requestprotected String _getRequestIdentifier(Request request)
request
- the requestprotected void _handleErrors(List<SearchServiceGenerator.SearchComponentError> errors) throws ProcessingException
SearchComponent
serrors
- The errorsProcessingException
- if the SearchServiceGenerator.SearchComponentError
s lead to a need to throw an exception