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
_ametysObjectResolver
The resolver for Ametys objectsprotected org.slf4j.Logger
_logger
The SL4j loggerprotected RenderingContextHandler
_renderingContextHandler
The handler of rendering contextprotected SearchComponentExtensionPoint
_searchComponentEP
The extension point forSearchComponent
sprotected SearcherFactory
_searcherFactory
The searcher factoryprotected SearchService
_searchService
The searchService
protected SearchServiceInstanceManager
_searchServiceInstanceManager
The manager forSearchServiceInstance
sprotected SearchUserInputsRetriever
_searchUserInputsRetriever
The search user inputs retrieverprotected SiteManager
_siteManager
The 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)
BuildsSearchComponentArguments
protected 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 ofSearchComponent
sprotected 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 idvoid
enableLogging(Logger logger)
void
generate()
protected SearchServiceInstance
getInstance(Request request, String zoneItemId)
Gets theSearchServiceInstance
being processedvoid
service(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 forSearchServiceInstance
s
-
_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 forSearchComponent
s
-
_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:
enableLogging
in interfaceLogEnabled
- Overrides:
enableLogging
in classAbstractLogEnabled
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in 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 theSearchServiceInstance
being processed- Parameters:
request
- the requestzoneItemId
- The zone item id- Returns:
- the
SearchServiceInstance
being 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:
true
if 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
-true
if the form was submittedrequest
- The requestserviceInstance
- The service instance being processeddebugMode
- The debug mode- Returns:
true
if 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:
true
if 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 ofSearchComponent
s- Parameters:
errors
- The errors- Throws:
ProcessingException
- if theSearchServiceGenerator.SearchComponentError
s lead to a need to throw an exception
-
-