Class DataContext

java.lang.Object
org.ametys.runtime.model.type.DataContext
Direct Known Subclasses:
RepositoryDataContext

public class DataContext extends Object
Object that gives some context for data manipulation
  • Constructor Details

  • Method Details

    • newInstance

      public static DataContext newInstance()
      Creates a new instance of a DataContext
      Returns:
      the created instance
    • cloneContext

      Creates a new instance of a DataContext, with the current context values
      Returns:
      the created instance
    • _cloneContextData

      protected void _cloneContextData(DataContext context)
      Clone the data of the current context in the given one
      Parameters:
      context - the clone
    • getLocale

      public Locale getLocale()
      Retrieves the locale to use for localized data
      Returns:
      the locale, or null if no local has been set
    • withLocale

      public DataContext withLocale(Locale locale)
      Sets the locale to use for localized data. Do not set Locale to use all existing ones.
      Parameters:
      locale - the locale to set
      Returns:
      the current DataContext
    • getDataPath

      public String getDataPath()
      Retrieves the data path
      Returns:
      the dataPath
    • withDataPath

      public DataContext withDataPath(String dataPath)
      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

      public DataContext withFullDataPath(String fullDataPath)
      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

      public DataContext withObjectId(String objectId)
      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

      public DataContext withRootObjectId(String rootObjectId)
      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

      public boolean renderEmptyValues()
      Determines if the empty values have to be rendered
      Returns:
      true if empty values must be rendered (default), false otherwise
    • withEmptyValues

      public DataContext withEmptyValues(boolean renderEmptyValues)
      Set to false to not render empty values (default to true)
      Parameters:
      renderEmptyValues - true to render the empty values, false otherwise
      Returns:
      the current DataContext