Package org.ametys.runtime.model.type
Class DataContext
java.lang.Object
org.ametys.runtime.model.type.DataContext
- Direct Known Subclasses:
RepositoryDataContext
Object that gives some context for data manipulation
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_cloneContextData
(DataContext context) Clone the data of the current context in the given oneaddSegmentToDataPath
(String segment) Add a segment to the data pathaddSuffixToLastSegment
(String suffix) Add a suffix to the last segment of the data pathCreates a new instance of aDataContext
, with the current context valuesRetrieves the data pathRetrieves the full data pathRetrieves the locale to use for localized dataRetrieves the identifier of the object from which the data path is computedRetrieves the identifier of the object from which the full data path is computedstatic DataContext
Creates a new instance of aDataContext
boolean
Determines if the empty values have to be renderedwithDataPath
(String dataPath) Sets the data pathwithEmptyValues
(boolean renderEmptyValues) Set tofalse
to not render empty values (default totrue
)withFullDataPath
(String fullDataPath) Sets the full data pathwithLocale
(Locale locale) Sets the locale to use for localized data.withObjectId
(String objectId) Set the identifier of the object from which the data path is computedwithRootObjectId
(String rootObjectId) Set the identifier of the object from which the full data path is computed
-
Constructor Details
-
DataContext
protected DataContext()Creates a new instance of aDataContext
-
-
Method Details
-
newInstance
Creates a new instance of aDataContext
- Returns:
- the created instance
-
cloneContext
Creates a new instance of aDataContext
, with the current context values- Returns:
- the created instance
-
_cloneContextData
Clone the data of the current context in the given one- Parameters:
context
- the clone
-
getLocale
Retrieves the locale to use for localized data- Returns:
- the locale, or null if no local has been set
-
withLocale
Sets the locale to use for localized data. Do not setLocale
to use all existing ones.- Parameters:
locale
- the locale to set- Returns:
- the current
DataContext
-
getDataPath
Retrieves the data path- Returns:
- the dataPath
-
withDataPath
Sets the data path- Parameters:
dataPath
- the data path to set- Returns:
- the current
DataContext
-
getFullDataPath
Retrieves the full data path- Returns:
- the fullDataPath
-
withFullDataPath
Sets the full data path- Parameters:
fullDataPath
- the full data path to set- Returns:
- the current
DataContext
-
addSegmentToDataPath
Add a segment to the data path- Parameters:
segment
- the segment to add to the data path- Returns:
- the current
DataContext
-
addSuffixToLastSegment
Add a suffix to the last segment of the data path- Parameters:
suffix
- the suffix to add to the last segment- Returns:
- the current
DataContext
-
getObjectId
Retrieves the identifier of the object from which the data path is computed- Returns:
- the object identifier
-
withObjectId
Set the identifier of the object from which the data path is computed- Parameters:
objectId
- the object identifier to set- Returns:
- the current
DataContext
-
getRootObjectId
Retrieves the identifier of the object from which the full data path is computed- Returns:
- the root object identifier
-
withRootObjectId
Set the identifier of the object from which the full data path is computed- Parameters:
rootObjectId
- the root object identifier to set- Returns:
- the current
DataContext
-
renderEmptyValues
Determines if the empty values have to be rendered- Returns:
true
if empty values must be rendered (default),false
otherwise
-
withEmptyValues
Set tofalse
to not render empty values (default totrue
)- Parameters:
renderEmptyValues
-true
to render the empty values,false
otherwise- Returns:
- the current
DataContext
-