Package org.ametys.cms.model
Class CMSDataContext
java.lang.Object
org.ametys.runtime.model.type.DataContext
org.ametys.plugins.repository.model.RepositoryDataContext
org.ametys.cms.model.CMSDataContext
Object that gives some context for cms data manipulation
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new instance of aCMSDataContextprotectedCMSDataContext(DataContext context) Creates a new instance of aCMSDataContextfrom anotherDataContext -
Method Summary
Modifier and TypeMethodDescriptionCreates a new instance of aCMSDataContext, with the current context valuesGet the field name of full-text field.intRetrieves the rich text max length.booleanDetermines if the value should be indexed for a fulltext field.booleanDetermines if the searched value is escapedbooleanDetermines if the search is multilingualstatic CMSDataContextCreates a new instance of aCMSDataContextstatic CMSDataContextnewInstance(DataContext context) Creates a new instance of aCMSDataContextfrom anotherDataContext.<T extends CMSDataContext>
TwithFullTextFieldName(String fulltextFieldName) Set the field name of full-text field.<T extends CMSDataContext>
TwithIndexForFullTextField(boolean indexForFullTextField) Set totrueto index the value for a fulltext field.<T extends CMSDataContext>
TwithMultilingualSearch(boolean isSearchMultilingual) Set totrueif the search is multilingual (default tofalse)<T extends CMSDataContext>
TwithRichTextMaxLength(int richTextMaxLength) Sets the rich text max length Set to 0 to keep the whole rich text content (default)<T extends CMSDataContext>
TwithSearchedValueEscaped(boolean isSearchedValueEscaped) Set totrueif the searched value is escaped (default tofalse)Methods inherited from class org.ametys.plugins.repository.model.RepositoryDataContext
_getRootObject, _withRootObject, copyExternalMetadata, getExternalizableData, getObject, getObjectId, getRootObjectId, isDataExternalizable, withExternalizableData, withExternalMetadataInCopy, withObjectMethods inherited from class org.ametys.runtime.model.type.DataContext
addSegmentToDataPath, addSuffixToLastSegment, getDataPath, getDataPathLastSegment, getFullDataPath, getLocale, getModelItem, getViewItem, renderDisabledValues, renderEmptyValues, withDataPath, withDisabledValues, withEmptyValues, withFullDataPath, withLocale, withModelItem, withViewItem
-
Constructor Details
-
CMSDataContext
protected CMSDataContext()Creates a new instance of aCMSDataContext -
CMSDataContext
Creates a new instance of aCMSDataContextfrom anotherDataContext- Parameters:
context- the data context to copy
-
-
Method Details
-
newInstance
Creates a new instance of aCMSDataContext- Returns:
- the created instance
-
newInstance
Creates a new instance of aCMSDataContextfrom anotherDataContext. It can be the same implementation or another one, but it will be casted to the current implementation.- Parameters:
context- the data context to copy- Returns:
- the created instance
-
cloneContext
Creates a new instance of aCMSDataContext, with the current context values- Overrides:
cloneContextin classRepositoryDataContext- Returns:
- the created instance
-
getRichTextMaxLength
Retrieves the rich text max length. If the max length is 0, the whole rich text content is kept- Returns:
- the rich text max length
-
withRichTextMaxLength
Sets the rich text max length Set to 0 to keep the whole rich text content (default)- Type Parameters:
T- the type of the retrievedDataContext- Parameters:
richTextMaxLength- the rich text max length to set- Returns:
- the current
CMSDataContext
-
indexForFullTextField
Determines if the value should be indexed for a fulltext field. The fulltext field is given by thisCMSDataContext- Returns:
trueto index value for a fulltext field,falseotherwise.
-
withIndexForFullTextField
Set totrueto index the value for a fulltext field. The fulltext field is given by thisCMSDataContext- Type Parameters:
T- the type of the retrievedDataContext- Parameters:
indexForFullTextField-trueto index the value for a fulltext field,falseotherwise- Returns:
- the current
CMSDataContext
-
getFullTextFieldName
Get the field name of full-text field. Use if thisCMSDataContextis instanciated for full-text field- Returns:
- the field name of full-text field. Default to SolrFieldNames.SYSTEM_FULL
-
withFullTextFieldName
Set the field name of full-text field. Use if thisCMSDataContextis instanciated for full-text field- Type Parameters:
T- the type of the retrievedDataContext- Parameters:
fulltextFieldName- the full-text field name- Returns:
- the current
CMSDataContext
-
isSearchedValueEscaped
Determines if the searched value is escaped- Returns:
trueif the searched value is escaped,falseotherwise.
-
withSearchedValueEscaped
Set totrueif the searched value is escaped (default tofalse)- Type Parameters:
T- the type of the retrievedDataContext- Parameters:
isSearchedValueEscaped-trueif the searched value is escaped,falseotherwise- Returns:
- the current
CMSDataContext
-
isSearchMultilingual
Determines if the search is multilingual- Returns:
trueif the search is multilingual,falseotherwise.
-
withMultilingualSearch
Set totrueif the search is multilingual (default tofalse)- Type Parameters:
T- the type of the retrievedDataContext- Parameters:
isSearchMultilingual-trueif the search is multilingual,falseotherwise- Returns:
- the current
CMSDataContext
-