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
ConstructorsModifierConstructorDescriptionprotected
Creates a new instance of aDataContext
protected
DataContext
(DataContext context) Creates a new instance of aDataContext
from anotherDataContext
-
Method Summary
Modifier and TypeMethodDescription<T extends DataContext>
TaddSegmentToDataPath
(String segment) Add a segment to the data path<T extends DataContext>
TaddSuffixToLastSegment
(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 last segment of the data pathRetrieves the full data pathRetrieves the locale to use for localized dataRetrieves the model itemRetrieves the identifier of the object from which the data path is computedRetrieves the identifier of the object from which the full data path is computedRetrieves the view itemstatic DataContext
Creates a new instance of aDataContext
static DataContext
newInstance
(DataContext context) Creates a new instance of aDataContext
from anotherDataContext
.boolean
Determines if the empty values have to be rendered<T extends DataContext>
TwithDataPath
(String dataPath) Sets the data path<T extends DataContext>
TwithEmptyValues
(boolean renderEmptyValues) Set tofalse
to not render empty values (default totrue
)<T extends DataContext>
TwithFullDataPath
(String fullDataPath) Sets the full data path<T extends DataContext>
TwithLocale
(Locale locale) Sets the locale to use for localized data.<T extends DataContext>
TwithModelItem
(ModelItem modelItem) Sets the model item<T extends DataContext>
TwithObjectId
(String objectId) Set the identifier of the object from which the data path is computed<T extends DataContext>
TwithRootObjectId
(String rootObjectId) Set the identifier of the object from which the full data path is computed<T extends DataContext>
TwithViewItem
(ViewItem viewItem) Sets the view item
-
Constructor Details
-
DataContext
protected DataContext()Creates a new instance of aDataContext
-
DataContext
Creates a new instance of aDataContext
from anotherDataContext
- Parameters:
context
- the data context to copy
-
-
Method Details
-
newInstance
Creates a new instance of aDataContext
- Returns:
- the created instance
-
newInstance
Creates a new instance of aDataContext
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 aDataContext
, with the current context values- Returns:
- the created instance
-
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
-
getDataPathLastSegment
Retrieves the last segment of the data path- Returns:
- the last segment of the data path
-
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
-
getModelItem
Retrieves the model item- Returns:
- the model item
-
withModelItem
Sets the model item- Parameters:
modelItem
- the model item to set- Returns:
- the current
DataContext
-
getViewItem
Retrieves the view item- Returns:
- the view item
-
withViewItem
Sets the view item- Parameters:
viewItem
- the view item to set- Returns:
- the current
DataContext
-