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
public class SearchServiceGenerator extends ServiceableGenerator
Generator for the search service.
-
-
Field Summary
Fields Modifier and Type Field Description protected AmetysObjectResolver_ametysObjectResolverThe resolver for Ametys objectsprotected org.slf4j.Logger_loggerThe SL4j loggerprotected RenderingContextHandler_renderingContextHandlerThe handler of rendering contextprotected SearchComponentExtensionPoint_searchComponentEPThe extension point forSearchComponentsprotected SearcherFactory_searcherFactoryThe searcher factoryprotected SearchService_searchServiceThe searchServiceprotected SearchServiceInstanceManager_searchServiceInstanceManagerThe manager forSearchServiceInstancesprotected SearchUserInputsRetriever_searchUserInputsRetrieverThe search user inputs retrieverprotected SiteManager_siteManagerThe site manager-
Fields inherited from class org.apache.cocoon.generation.ServiceableGenerator
manager
-
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, source
-
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
-
-
Constructor Summary
Constructors Constructor Description SearchServiceGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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, Page page)Retrieves the current langprotected Page_retrieveCurrentPage(Request request, String zoneItemId)Retrieves the current pageprotected Site_retrieveCurrentSite(Request request, Page 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
dispose
-
Methods inherited from class org.apache.cocoon.generation.AbstractGenerator
recycle, setup
-
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
getLogger, setupLogger, setupLogger, setupLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
-
-
-
-
Field Detail
-
_logger
protected org.slf4j.Logger _logger
The SL4j logger
-
_searchServiceInstanceManager
protected SearchServiceInstanceManager _searchServiceInstanceManager
The manager forSearchServiceInstances
-
_searchService
protected SearchService _searchService
The searchService
-
_siteManager
protected SiteManager _siteManager
The site manager
-
_searcherFactory
protected SearcherFactory _searcherFactory
The searcher factory
-
_searchComponentEP
protected SearchComponentExtensionPoint _searchComponentEP
The extension point forSearchComponents
-
_renderingContextHandler
protected RenderingContextHandler _renderingContextHandler
The handler of rendering context
-
_ametysObjectResolver
protected AmetysObjectResolver _ametysObjectResolver
The resolver for Ametys objects
-
_searchUserInputsRetriever
protected SearchUserInputsRetriever _searchUserInputsRetriever
The search user inputs retriever
-
-
Constructor Detail
-
SearchServiceGenerator
public SearchServiceGenerator()
-
-
Method Detail
-
enableLogging
public void enableLogging(Logger logger)
- Specified by:
enableLoggingin interfaceLogEnabled- Overrides:
enableLoggingin classAbstractLogEnabled
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classServiceableGenerator- Throws:
ServiceException
-
_buildArguments
protected SearchComponentArguments _buildArguments(Request request) throws ProcessingException
BuildsSearchComponentArguments- Parameters:
request- The request- Returns:
- The built
SearchComponentArguments - Throws:
ProcessingException- If an error occured when processing the request
-
generate
public void generate() throws IOException, SAXException, ProcessingException
-
_retrieveZoneItemId
protected String _retrieveZoneItemId(Request request)
Retrieves the current zone item id- Parameters:
request- the request- Returns:
- the zone item id
-
getInstance
protected SearchServiceInstance getInstance(Request request, String zoneItemId)
Gets theSearchServiceInstancebeing processed- Parameters:
request- the requestzoneItemId- The zone item id- Returns:
- the
SearchServiceInstancebeing processed
-
_retrievePageIndex
protected int _retrievePageIndex(Request request) throws ProcessingException
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
protected Page _retrieveCurrentPage(Request request, String zoneItemId)
Retrieves the current page- Parameters:
request- the requestzoneItemId- The zone item id- Returns:
- the current page
-
_retrieveCurrentSite
protected Site _retrieveCurrentSite(Request request, Page page)
Retrieves the current site- Parameters:
request- the requestpage- the page- Returns:
- the current site
-
_retrieveCurrentLang
protected String _retrieveCurrentLang(Request request, Page page)
Retrieves the current lang- Parameters:
request- the requestpage- the page- Returns:
- the current lang
-
_isFormSubmitted
protected boolean _isFormSubmitted(Request request)
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
protected SearchServiceDebugModeHelper.DebugMode _debugMode(Request request)
Gets the debug mode if activated- Parameters:
request- The request- Returns:
- the debug mode if activated
-
_getRequestIdentifier
protected String _getRequestIdentifier(Request request)
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
-
-