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
FieldsModifier and TypeFieldDescriptionprotected ColumnHelperThe helper for columnsprotected ContentResultSetHelperHelper for saxing resultprotected ContentTypeExtensionPointThe content type extension pointprotected ContextContextprotected ContentTypesHelperThe content type helper.protected SearchUIModelExtensionPointThe search model managerprotected ServerCommHelperThe server comm helperstatic final StringConstant for getting content in specific version labelFields 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 TypeMethodDescriptionvoidcontextualize(Context context) voidgenerate()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 voidsaxContent(Content content, Collection<? extends ResultField> resultFields, Locale defaultLocale) SAX the result contentprotected voidsaxContents(SearchModel model, SearchResults<Content> results, Collection<? extends ResultField> resultFields, String versionLabel, Map<String, Object> jsParameters, Locale defaultLocale, Map<String, Object> contextualParameters) Sax a set of contentsvoidservice(ServiceManager smanager) protected booleanswitchToLabel(Content content, String label) Switch to the revision corresponding to the specified label.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
enableLogging, 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
-
CONTENT_VERSION_LABEL
Constant for getting content in specific version label- See Also:
-
_serverCommHelper
The server comm helper -
_contentRSH
Helper for saxing result -
_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:
servicein interfaceServiceable- Overrides:
servicein classServiceableGenerator- Throws:
ServiceException
-
contextualize
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
generate
- Specified by:
generatein interfaceGenerator- Throws:
IOExceptionSAXExceptionProcessingException
-
saxContents
protected void saxContents(SearchModel model, SearchResults<Content> results, Collection<? extends ResultField> resultFields, 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- contentsresultFields- fields to retreiveversionLabel- 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
-
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:
trueif a revision with this label exists and the content was switch,falseotherwise.
-
saxContent
protected void saxContent(Content content, Collection<? extends ResultField> resultFields, Locale defaultLocale) throws SAXException, AmetysRepositoryException, IOException SAX the result content- Parameters:
content- the resultresultFields- 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
-