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
ConstructorsModifierConstructorDescriptionprotected
Creates a new instance of aCMSDataContext
protected
CMSDataContext
(DataContext context) Creates a new instance of aCMSDataContext
from anotherDataContext
-
Method Summary
Modifier and TypeMethodDescriptionCreates a new instance of aCMSDataContext
, with the current context valuesGet the field name of full-text field.int
Retrieves the rich text max length.boolean
Determines if the value should be indexed for a fulltext field.boolean
Determines if the searched value is escapedboolean
Determines if the search is multilingualstatic CMSDataContext
Creates a new instance of aCMSDataContext
static CMSDataContext
newInstance
(DataContext context) Creates a new instance of aCMSDataContext
from anotherDataContext
.<T extends CMSDataContext>
TwithFullTextFieldName
(String fulltextFieldName) Set the field name of full-text field.<T extends CMSDataContext>
TwithIndexForFullTextField
(boolean indexForFullTextField) Set totrue
to index the value for a fulltext field.<T extends CMSDataContext>
TwithMultilingualSearch
(boolean isSearchMultilingual) Set totrue
if 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 totrue
if 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, withObject
Methods 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 aCMSDataContext
from 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 aCMSDataContext
from 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:
cloneContext
in 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:
true
to index value for a fulltext field,false
otherwise.
-
withIndexForFullTextField
Set totrue
to index the value for a fulltext field. The fulltext field is given by thisCMSDataContext
- Type Parameters:
T
- the type of the retrievedDataContext
- Parameters:
indexForFullTextField
-true
to index the value for a fulltext field,false
otherwise- Returns:
- the current
CMSDataContext
-
getFullTextFieldName
Get the field name of full-text field. Use if thisCMSDataContext
is 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 thisCMSDataContext
is 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:
true
if the searched value is escaped,false
otherwise.
-
withSearchedValueEscaped
Set totrue
if the searched value is escaped (default tofalse
)- Type Parameters:
T
- the type of the retrievedDataContext
- Parameters:
isSearchedValueEscaped
-true
if the searched value is escaped,false
otherwise- Returns:
- the current
CMSDataContext
-
isSearchMultilingual
Determines if the search is multilingual- Returns:
true
if the search is multilingual,false
otherwise.
-
withMultilingualSearch
Set totrue
if the search is multilingual (default tofalse
)- Type Parameters:
T
- the type of the retrievedDataContext
- Parameters:
isSearchMultilingual
-true
if the search is multilingual,false
otherwise- Returns:
- the current
CMSDataContext
-