public class CmsScriptHandler extends ScriptHandler
Modifier and Type | Field and Description |
---|---|
private ContentHelper |
_contentHelper |
private ContentTypeExtensionPoint |
_contentTypeExtensionPoint |
private ContentTypesHelper |
_contentTypesHelper |
private ServiceManager |
_manager |
private SearchUIModelExtensionPoint |
_searchUIModelEP |
private SearchUIModelHelper |
_searchUIModelHelper |
private ServerCommHelper |
_serverCommHelper |
private SystemPropertyExtensionPoint |
_systemPropEP |
private ContentValuesExtractorFactory |
_valuesExtractorFactory |
_context, _currentUserProvider, _rightManager, _scriptBindingEP
Constructor and Description |
---|
CmsScriptHandler() |
Modifier and Type | Method and Description |
---|---|
private void |
_addColumnsConfiguration(Collection<String> columns,
ContentType cTypeCommonAncestor,
MutableConfiguration columnsDefaultConf) |
protected SearchUIModel |
_createModel(ThreadSafeComponentManager<SearchUIModel> localSearchModelManager,
String defaultModelId,
Collection<String> columns,
Collection<Content> contents)
Create and return a dynamic model based on desired columns or return a default model.
|
private SearchUIModel |
_getOrCreateModel(Map columns,
List<Content> contents,
String defaultModelId) |
protected void |
_handleColumnConfiguration(MutableConfiguration columnConf,
String column)
Add/modify column configuration
|
private Object |
_processScriptResult(Map<String,Object> results,
List<ScriptBinding> scriptBindings,
Object scriptResult) |
private List<String> |
_processScriptResultContents(Map<String,Object> results,
Map scriptResultMap) |
protected Map<String,Object> |
content2Json(Content content,
Collection<SearchUIColumn> searchColumns,
ContentValuesExtractorFactory.SearchModelContentValuesExtractor extractor)
Convert content to json
|
protected Object |
processScriptResult(Map<String,Object> results,
List<ScriptBinding> scriptBindings,
Object scriptResult)
Process the result of the script
|
void |
service(ServiceManager serviceManager) |
contextualize, executeScript, executeScript, getScriptBindingDescription, getScriptBindings
getLogger, setLogger
private SearchUIModelHelper _searchUIModelHelper
private SearchUIModelExtensionPoint _searchUIModelEP
private ContentTypesHelper _contentTypesHelper
private ContentTypeExtensionPoint _contentTypeExtensionPoint
private SystemPropertyExtensionPoint _systemPropEP
private ServerCommHelper _serverCommHelper
private ServiceManager _manager
private ContentValuesExtractorFactory _valuesExtractorFactory
private ContentHelper _contentHelper
public CmsScriptHandler()
public void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
service
in class ScriptHandler
ServiceException
protected Object processScriptResult(Map<String,Object> results, List<ScriptBinding> scriptBindings, Object scriptResult) throws ScriptException
ScriptHandler
processScriptResult
in class ScriptHandler
results
- The results map, available to fillscriptBindings
- The script bindingsscriptResult
- The result of the scriptScriptException
- If an exception occurredprivate SearchUIModel _getOrCreateModel(Map columns, List<Content> contents, String defaultModelId) throws Exception, ProcessingException
Exception
ProcessingException
protected SearchUIModel _createModel(ThreadSafeComponentManager<SearchUIModel> localSearchModelManager, String defaultModelId, Collection<String> columns, Collection<Content> contents) throws Exception
localSearchModelManager
- The local search managerdefaultModelId
- The default model idcolumns
- The columnscontents
- The contentsException
- If an error occurredprivate Object _processScriptResult(Map<String,Object> results, List<ScriptBinding> scriptBindings, Object scriptResult) throws ScriptException
ScriptException
private List<String> _processScriptResultContents(Map<String,Object> results, Map scriptResultMap)
private void _addColumnsConfiguration(Collection<String> columns, ContentType cTypeCommonAncestor, MutableConfiguration columnsDefaultConf)
protected void _handleColumnConfiguration(MutableConfiguration columnConf, String column)
columnConf
- The mutable configuration object that will be used to create the column.column
- The column identifierprotected Map<String,Object> content2Json(Content content, Collection<SearchUIColumn> searchColumns, ContentValuesExtractorFactory.SearchModelContentValuesExtractor extractor)
content
- The contentsearchColumns
- The columns, to know which value to fillextractor
- The properties extractor