Class SearchServiceGenerator
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.xml.AbstractXMLProducer
org.apache.cocoon.generation.AbstractGenerator
org.apache.cocoon.generation.ServiceableGenerator
org.ametys.web.frontoffice.search.requesttime.SearchServiceGenerator
- All Implemented Interfaces:
Poolable,Recyclable,Disposable,Component,LogEnabled,Serviceable,Generator,SitemapModelComponent,XMLProducer
- Direct Known Subclasses:
CalendarSearchServiceGenerator
Generator for the search service.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AmetysObjectResolverThe resolver for Ametys objectsprotected org.slf4j.LoggerThe SL4j loggerprotected RenderingContextHandlerThe handler of rendering contextprotected SearchComponentExtensionPointThe extension point forSearchComponentsprotected SearcherFactoryThe searcher factoryprotected SearchServiceThe searchServiceprotected SearchServiceInstanceManagerThe manager forSearchServiceInstancesprotected SearchUserInputsRetrieverThe search user inputs retrieverprotected SiteManagerThe site managerFields inherited from class org.apache.cocoon.generation.ServiceableGenerator
managerFields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, sourceFields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SearchComponentArguments_buildArguments(Request request) BuildsSearchComponentArgumentsprotected SearchServiceDebugModeHelper.DebugMode_debugMode(Request request) Gets the debug mode if activatedprotected String_getRequestIdentifier(Request request) Gets the identifier of the request for display debug purposes onlyprotected void_handleErrors(List<org.ametys.web.frontoffice.search.requesttime.SearchServiceGenerator.SearchComponentError> errors) Handles errors ofSearchComponentsprotected boolean_inputValid(Request request, SearchServiceInstance serviceInstance, SearchServiceDebugModeHelper.DebugMode debugMode) Checks if inputs are validprotected boolean_isFormSubmitted(Request request) Checks if the form was submittedprotected boolean_launchSearch(boolean isFormSubmitted, Request request, SearchServiceInstance serviceInstance, SearchServiceDebugModeHelper.DebugMode debugMode) Tells if the search has to be launchedprotected String_retrieveCurrentLang(Request request, SitemapElement page) Retrieves the current langprotected Page_retrieveCurrentPage(Request request, String zoneItemId) Retrieves the current pageprotected Site_retrieveCurrentSite(Request request, SitemapElement page) Retrieves the current siteprotected int_retrievePageIndex(Request request) Retrieves the current page index of the searchprotected String_retrieveZoneItemId(Request request) Retrieves the current zone item idvoidenableLogging(Logger logger) voidgenerate()protected SearchServiceInstancegetInstance(Request request, String zoneItemId) Gets theSearchServiceInstancebeing processedvoidservice(ServiceManager smanager) Methods inherited from class org.apache.cocoon.generation.ServiceableGenerator
disposeMethods inherited from class org.apache.cocoon.generation.AbstractGenerator
recycle, setupMethods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandlerMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
getLogger, setupLogger, setupLogger, setupLoggerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
-
Field Details
-
_logger
The SL4j logger -
_searchServiceInstanceManager
The manager forSearchServiceInstances -
_searchService
The searchService -
_siteManager
The site manager -
_searcherFactory
The searcher factory -
_searchComponentEP
The extension point forSearchComponents -
_renderingContextHandler
The handler of rendering context -
_ametysObjectResolver
The resolver for Ametys objects -
_searchUserInputsRetriever
The search user inputs retriever
-
-
Constructor Details
-
SearchServiceGenerator
public SearchServiceGenerator()
-
-
Method Details
-
enableLogging
- Specified by:
enableLoggingin interfaceLogEnabled- Overrides:
enableLoggingin classAbstractLogEnabled
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classServiceableGenerator- Throws:
ServiceException
-
_buildArguments
BuildsSearchComponentArguments- Parameters:
request- The request- Returns:
- The built
SearchComponentArguments - Throws:
ProcessingException- If an error occured when processing the request
-
generate
-
_retrieveZoneItemId
Retrieves the current zone item id- Parameters:
request- the request- Returns:
- the zone item id
-
getInstance
Gets theSearchServiceInstancebeing processed- Parameters:
request- the requestzoneItemId- The zone item id- Returns:
- the
SearchServiceInstancebeing processed
-
_retrievePageIndex
Retrieves the current page index of the search- Parameters:
request- the request- Returns:
- the current page index of the search
- Throws:
ProcessingException- If an error occured when retrieving the page index
-
_retrieveCurrentPage
Retrieves the current page- Parameters:
request- the requestzoneItemId- The zone item id- Returns:
- the current page
-
_retrieveCurrentSite
Retrieves the current site- Parameters:
request- the requestpage- the page- Returns:
- the current site
-
_retrieveCurrentLang
Retrieves the current lang- Parameters:
request- the requestpage- the page- Returns:
- the current lang
-
_isFormSubmitted
Checks if the form was submitted- Parameters:
request- The request- Returns:
trueif the form was submitted
-
_launchSearch
protected boolean _launchSearch(boolean isFormSubmitted, Request request, SearchServiceInstance serviceInstance, SearchServiceDebugModeHelper.DebugMode debugMode) Tells if the search has to be launched- Parameters:
isFormSubmitted-trueif the form was submittedrequest- The requestserviceInstance- The service instance being processeddebugMode- The debug mode- Returns:
trueif the search has to be launched
-
_inputValid
protected boolean _inputValid(Request request, SearchServiceInstance serviceInstance, SearchServiceDebugModeHelper.DebugMode debugMode) Checks if inputs are valid- Parameters:
request- The requestserviceInstance- The service instance being processeddebugMode- The debug mode- Returns:
trueif inputs are valid
-
_debugMode
Gets the debug mode if activated- Parameters:
request- The request- Returns:
- the debug mode if activated
-
_getRequestIdentifier
Gets the identifier of the request for display debug purposes only- Parameters:
request- the request- Returns:
- the identifier of the request for display debug purposes only
-
_handleErrors
protected void _handleErrors(List<org.ametys.web.frontoffice.search.requesttime.SearchServiceGenerator.SearchComponentError> errors) throws ProcessingException Handles errors ofSearchComponents- Parameters:
errors- The errors- Throws:
ProcessingException- if theSearchServiceGenerator.SearchComponentErrors lead to a need to throw an exception
-