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 TypeMethodDescriptionbooleanexists()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> TgetOriginalValue(String attribute) Retrieves the original loaded value of the attribute.<T> TgetOriginalValue(String attribute, Locale loc) Retrieves the original loaded value of the localized attribute with the locale.longRetrieves the persistence version of the model.getPK()Retrieves the pk of the model.Retrieves the item of the model.Retrieves the tenant id of the model.booleanisDirty()Checks if the model has been modified.booleanChecks if the specific attribute has been changed.booleanChecks if the specific localized attribute has been changed with the locale.booleanChecks if the specific attribute has been loaded from the database.booleanChecks if the specific localized attribute has been loaded with the locale from the database.booleanisNew()Checks if the model is a new model.booleanChecks if the model has been removed from the database.booleanChecks if the model is still up to date with.
-
Method Details
-
getDirtyAttributes
Returns all changed attributes.- Returns:
- the set of all changed attributes.
-
isDirty
Checks if the specific attribute has been changed.- Returns:
- true if changed, false otherwise.
-
isLoaded
Checks if the specific attribute has been loaded from the database.- Returns:
- true if loaded, false otherwise.
-
getOriginalValue
Retrieves the original loaded value of the attribute.- Returns:
- the original value.
-
isDirty
Checks if the specific localized attribute has been changed with the locale.- Returns:
- true if changed, false otherwise.
-
isLoaded
Checks if the specific localized attribute has been loaded with the locale from the database.- Returns:
- true if loaded, false otherwise.
-
getOriginalValue
Retrieves the original loaded value of the localized attribute with the locale.- Returns:
- the original localized value with the locale.
-
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.
-