Interface ItemModelContext

All Known Subinterfaces:
ItemModelInternalContext
All Known Implementing Classes:
ItemModelContextImpl

public interface ItemModelContext
This is the public context API for models based on AbstractItemModel.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if the model is still valid.
    Returns all changed attributes.
    Returns all changed localized attributes with the locale.
    Retrieves the item type of the model.
    <T> T
    Retrieves the original loaded value of the attribute.
    <T> T
    getOriginalValue(String attribute, Locale loc)
    Retrieves the original loaded value of the localized attribute with the locale.
    long
    Retrieves the persistence version of the model.
    Retrieves the pk of the model.
    Retrieves the item of the model.
    Retrieves the tenant id of the model.
    boolean
    Checks if the model has been modified.
    boolean
    isDirty(String attribute)
    Checks if the specific attribute has been changed.
    boolean
    isDirty(String attribute, Locale loc)
    Checks if the specific localized attribute has been changed with the locale.
    boolean
    isLoaded(String attribute)
    Checks if the specific attribute has been loaded from the database.
    boolean
    isLoaded(String attribute, Locale loc)
    Checks if the specific localized attribute has been loaded with the locale from the database.
    boolean
    Checks if the model is a new model.
    boolean
    Checks if the model has been removed from the database.
    boolean
    Checks if the model is still up to date with.
  • Method Details

    • getDirtyAttributes

      Set<String> getDirtyAttributes()
      Returns all changed attributes.
      Returns:
      the set of all changed attributes.
    • isDirty

      boolean isDirty(String attribute)
      Checks if the specific attribute has been changed.
      Returns:
      true if changed, false otherwise.
    • isLoaded

      boolean isLoaded(String attribute)
      Checks if the specific attribute has been loaded from the database.
      Returns:
      true if loaded, false otherwise.
    • getOriginalValue

      <T> T getOriginalValue(String attribute)
      Retrieves the original loaded value of the attribute.
      Returns:
      the original value.
    • isDirty

      boolean isDirty(String attribute, Locale loc)
      Checks if the specific localized attribute has been changed with the locale.
      Returns:
      true if changed, false otherwise.
    • isLoaded

      boolean isLoaded(String attribute, Locale loc)
      Checks if the specific localized attribute has been loaded with the locale from the database.
      Returns:
      true if loaded, false otherwise.
    • getOriginalValue

      <T> T getOriginalValue(String attribute, Locale loc)
      Retrieves the original loaded value of the localized attribute with the locale.
      Returns:
      the original localized value with the locale.
    • getDirtyLocalizedAttributes

      Map<Locale,Set<String>> getDirtyLocalizedAttributes()
      Returns all changed localized attributes with the locale.
      Returns:
      the set of all changed localized attributes with the locale.
    • getPK

      PK getPK()
      Retrieves the pk of the model.
    • getItemType

      String getItemType()
      Retrieves the item type of the model.
    • getTenantId

      String getTenantId()
      Retrieves the tenant id of the model.
    • getPersistenceVersion

      long getPersistenceVersion()
      Retrieves the persistence version of the model.
    • isDirty

      boolean isDirty()
      Checks if the model has been modified.
      Returns:
      true if the model has been modified, false otherwise
    • isNew

      boolean isNew()
      Checks if the model is a new model. That means it is not persisted in the database.
      Returns:
      true if it is new, false otherwise.
    • exists

      boolean exists()
      Checks if the model is still valid. NOTE: if the model is a new one, this method must return false, because it is not persisted in the database yet.
      Returns:
      true if it is valid, false otherwise.
    • isRemoved

      boolean isRemoved()
      Checks if the model has been removed from the database. NOTE: if the model is a new one, this method must return false, because a new model cannot be removed.
      Returns:
      true if removed, false otherwise.
    • isUpToDate

      boolean isUpToDate()
      Checks if the model is still up to date with.
        This method must return false under one of these situations:
      • the model is new,
      • the model has been removed,
      • the model has been modified, or
      • there is newer version persisted in the database.
      Returns:
      true if it is up to date, false otherwise.
    • getSource

      Object getSource()
      Retrieves the item of the model.
      Returns:
      the behind scene jalo item.