Package org.ametys.cms.search.cocoon
Class SearchGenerator
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.cms.search.cocoon.SearchGenerator
- All Implemented Interfaces:
Poolable
,Recyclable
,Disposable
,Component
,Contextualizable
,LogEnabled
,Serviceable
,Generator
,SitemapModelComponent
,XMLProducer
- Direct Known Subclasses:
DocSearchGenerator
Generate contents returned by the
SearchAction
.-
Field Summary
Modifier and TypeFieldDescriptionprotected ColumnHelper
The helper for columnsprotected ContentTypeExtensionPoint
The content type extension pointprotected Context
Contextprotected ContentTypesHelper
The content type helper.protected SearchUIModelExtensionPoint
The search model managerprotected ServerCommHelper
The server comm helperstatic final String
Constant for getting content in specific version labelFields 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 TypeMethodDescriptionvoid
contextualize
(Context context) void
generate()
protected List<ColumnHelper.Column>
Get the columns from JS parametersgetCommonContentTypeIds
(Map<String, Object> jsParameters, SearchModel model, Map<String, Object> contextualParameters) Get the common content typeprotected ViewItemContainer
getViewItems
(SearchModel model, Map<String, Object> jsParameters, Map<String, Object> contextualParameters) Get the filtered view items to sax the content results.protected void
saxContent
(Content content, ViewItemContainer resultItems, Locale defaultLocale) SAX the result contentprotected void
saxContents
(SearchModel model, SearchResults<Content> results, String versionLabel, Map<String, Object> jsParameters, Locale defaultLocale, Map<String, Object> contextualParameters) Sax a set of contentsvoid
service
(ServiceManager smanager) protected boolean
switchToLabel
(Content content, String label) Switch to the revision corresponding to the specified label.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
enableLogging, 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
-
CONTENT_VERSION_LABEL
Constant for getting content in specific version label- See Also:
-
_serverCommHelper
The server comm helper -
_context
Context -
_searchModelManager
The search model manager -
_cTypeHelper
The content type helper. -
_columnHelper
The helper for columns -
_contentTypeExtensionPoint
The content type extension point
-
-
Constructor Details
-
SearchGenerator
public SearchGenerator()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableGenerator
- Throws:
ServiceException
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
generate
- Specified by:
generate
in interfaceGenerator
- Throws:
IOException
SAXException
ProcessingException
-
saxContents
protected void saxContents(SearchModel model, SearchResults<Content> results, String versionLabel, Map<String, Object> jsParameters, Locale defaultLocale, Map<String, throws SAXException, AmetysRepositoryException, IOException, ProcessingExceptionObject> contextualParameters) Sax a set of contents- Parameters:
model
- search modelresults
- contentsversionLabel
- version labeljsParameters
- parameters of the searchdefaultLocale
- The locale to use for localized values if content's language is null.contextualParameters
- The contextual parameters- Throws:
SAXException
- if a error occurred during saxAmetysRepositoryException
- if a error occurredIOException
- if a error occurredProcessingException
- if a error occurred
-
getViewItems
protected ViewItemContainer getViewItems(SearchModel model, Map<String, Object> jsParameters, Map<String, Object> contextualParameters) Get the filtered view items to sax the content results.- Parameters:
model
- search modeljsParameters
- parameters of the searchcontextualParameters
- The contextual parameters- Returns:
- a
ViewItemContainer
-
getCommonContentTypeIds
protected Set<String> getCommonContentTypeIds(Map<String, Object> jsParameters, SearchModel model, Map<String, Object> contextualParameters) Get the common content type- Parameters:
jsParameters
- The JS parametersmodel
- The search modelcontextualParameters
- The contextual parameters- Returns:
- The common content type
-
getColumnsFromParameters
protected List<ColumnHelper.Column> getColumnsFromParameters(Map<String, Object> jsParameters, Set<String> contentTypeIds) Get the columns from JS parameters- Parameters:
jsParameters
- The JS parameterscontentTypeIds
- The content type identifiers- Returns:
- the requested columns
-
switchToLabel
Switch to the revision corresponding to the specified label.- Parameters:
content
- The contentlabel
- the label to switch to- Returns:
true
if a revision with this label exists and the content was switch,false
otherwise.
-
saxContent
protected void saxContent(Content content, ViewItemContainer resultItems, Locale defaultLocale) throws SAXException, AmetysRepositoryException, IOException SAX the result content- Parameters:
content
- the resultresultItems
- the result fieldsdefaultLocale
- The locale to use for localized values if content's language is null.- Throws:
SAXException
- if a error occurred during saxAmetysRepositoryException
- if a error occurredIOException
- if a error occurred
-