public class SearchGenerator extends ServiceableGenerator implements Contextualizable
SearchAction
.Modifier and Type | Field and Description |
---|---|
protected ColumnHelper |
_columnHelper
The helper for columns
|
protected ContentResultSetHelper |
_contentRSH
Helper for saxing result
|
protected ContentTypeExtensionPoint |
_contentTypeExtensionPoint
The content type extension point
|
protected Context |
_context
Context
|
protected ContentTypesHelper |
_cTypeHelper
The content type helper.
|
protected SearchUIModelExtensionPoint |
_searchModelManager
The search model manager
|
protected ServerCommHelper |
_serverCommHelper
The server comm helper
|
protected ContentValuesExtractorFactory |
_valuesExtractorFactory
The content values extractor factory.
|
static String |
CONTENT_VERSION_LABEL
Constant for getting content in specific version label
|
manager
objectModel, parameters, resolver, source
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
Constructor and Description |
---|
SearchGenerator() |
Modifier and Type | Method and Description |
---|---|
void |
contextualize(Context context) |
void |
generate() |
protected List<ColumnHelper.Column> |
getColumnsFromParameters(Map<String,Object> jsParameters,
Optional<String> contentType)
Get the columns from JS parameters
|
protected Optional<ContentType> |
getCommonContentType(Map<String,Object> jsParameters,
SearchModel model,
Map<String,Object> contextualParameters)
Get the common content type
|
protected void |
saxContent(Content content,
Collection<? extends ResultField> resultFields,
Locale defaultLocale)
SAX the result content
|
protected void |
saxContents(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 contents
|
void |
service(ServiceManager smanager) |
protected boolean |
switchToLabel(Content content,
String label)
Switch to the revision corresponding to the specified label.
|
dispose
recycle, setup
setConsumer, setContentHandler, setLexicalHandler
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setConsumer
public static final String CONTENT_VERSION_LABEL
protected ServerCommHelper _serverCommHelper
protected ContentValuesExtractorFactory _valuesExtractorFactory
protected ContentResultSetHelper _contentRSH
protected SearchUIModelExtensionPoint _searchModelManager
protected ContentTypesHelper _cTypeHelper
protected ColumnHelper _columnHelper
protected ContentTypeExtensionPoint _contentTypeExtensionPoint
public SearchGenerator()
public void service(ServiceManager smanager) throws ServiceException
service
in interface Serviceable
service
in class ServiceableGenerator
ServiceException
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void generate() throws IOException, SAXException, ProcessingException
generate
in interface Generator
IOException
SAXException
ProcessingException
protected void saxContents(SearchModel model, SearchResults<Content> results, Collection<? extends ResultField> resultFields, String versionLabel, Map<String,Object> jsParameters, Locale defaultLocale, Map<String,Object> contextualParameters) throws SAXException, AmetysRepositoryException, IOException, ProcessingException
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 parametersSAXException
- if a error occurred during saxAmetysRepositoryException
- if a error occurredIOException
- if a error occurredProcessingException
- if a error occurredprotected Optional<ContentType> getCommonContentType(Map<String,Object> jsParameters, SearchModel model, Map<String,Object> contextualParameters)
jsParameters
- The JS parametersmodel
- The search modelcontextualParameters
- The contextual parametersprotected List<ColumnHelper.Column> getColumnsFromParameters(Map<String,Object> jsParameters, Optional<String> contentType)
jsParameters
- The JS parameterscontentType
- The content typeprotected boolean switchToLabel(Content content, String label)
content
- The contentlabel
- the label to switch totrue
if a revision with this label exists and the content was switch, false
otherwise.protected void saxContent(Content content, Collection<? extends ResultField> resultFields, Locale defaultLocale) throws SAXException, AmetysRepositoryException, IOException
content
- the resultresultFields
- the result fieldsdefaultLocale
- The locale to use for localized values if content's language is null.SAXException
- if a error occurred during saxAmetysRepositoryException
- if a error occurredIOException
- if a error occurred