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
Modifier and TypeFieldDescriptionprotected AmetysObjectResolver
The resolver for Ametys objectsprotected Logger
The SL4j loggerprotected RenderingContextHandler
The handler of rendering contextprotected SearchComponentExtensionPoint
The extension point forSearchComponent
sprotected SearcherFactory
The searcher factoryprotected SearchService
The searchService
protected SearchServiceInstanceManager
The manager forSearchServiceInstance
sprotected SearchUserInputsRetriever
The search user inputs retrieverprotected SiteManager
The site managerFields 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
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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, 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 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 Details
-
_logger
The SL4j logger -
_searchServiceInstanceManager
The manager forSearchServiceInstance
s -
_searchService
The searchService
-
_siteManager
The site manager -
_searcherFactory
The searcher factory -
_searchComponentEP
The extension point forSearchComponent
s -
_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:
enableLogging
in interfaceLogEnabled
- Overrides:
enableLogging
in classAbstractLogEnabled
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in 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 theSearchServiceInstance
being processed- Parameters:
request
- the requestzoneItemId
- The zone item id- Returns:
- the
SearchServiceInstance
being 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:
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
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 ofSearchComponent
s- Parameters:
errors
- The errors- Throws:
ProcessingException
- if theSearchServiceGenerator.SearchComponentError
s lead to a need to throw an exception
-