Interface ItemModelContext
-
- All Known Subinterfaces:
ItemModelInternalContext
- All Known Implementing Classes:
ItemModelContextImpl
public interface ItemModelContextThis is the public context API for models based onAbstractItemModel.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanexists()Checks if the model is still valid.java.util.Set<java.lang.String>getDirtyAttributes()Returns all changed attributes.java.util.Map<java.util.Locale,java.util.Set<java.lang.String>>getDirtyLocalizedAttributes()Returns all changed localized attributes with the locale.java.lang.StringgetItemType()Retrieves the item type of the model.<T> TgetOriginalValue(java.lang.String attribute)Retrieves the original loaded value of the attribute.<T> TgetOriginalValue(java.lang.String attribute, java.util.Locale loc)Retrieves the original loaded value of the localized attribute with the locale.longgetPersistenceVersion()Retrieves the persistence version of the model.PKgetPK()Retrieves the pk of the model.java.lang.ObjectgetSource()Retrieves the item of the model.java.lang.StringgetTenantId()Retrieves the tenant id of the model.booleanisDirty()Checks if the model has been modified.booleanisDirty(java.lang.String attribute)Checks if the specific attribute has been changed.booleanisDirty(java.lang.String attribute, java.util.Locale loc)Checks if the specific localized attribute has been changed with the locale.booleanisLoaded(java.lang.String attribute)Checks if the specific attribute has been loaded from the database.booleanisLoaded(java.lang.String attribute, java.util.Locale loc)Checks if the specific localized attribute has been loaded with the locale from the database.booleanisNew()Checks if the model is a new model.booleanisRemoved()Checks if the model has been removed from the database.booleanisUpToDate()Checks if the model is still up to date with.
-
-
-
Method Detail
-
getDirtyAttributes
java.util.Set<java.lang.String> getDirtyAttributes()
Returns all changed attributes.- Returns:
- the set of all changed attributes.
-
isDirty
boolean isDirty(java.lang.String attribute)
Checks if the specific attribute has been changed.- Returns:
- true if changed, false otherwise.
-
isLoaded
boolean isLoaded(java.lang.String attribute)
Checks if the specific attribute has been loaded from the database.- Returns:
- true if loaded, false otherwise.
-
getOriginalValue
<T> T getOriginalValue(java.lang.String attribute)
Retrieves the original loaded value of the attribute.- Returns:
- the original value.
-
isDirty
boolean isDirty(java.lang.String attribute, java.util.Locale loc)Checks if the specific localized attribute has been changed with the locale.- Returns:
- true if changed, false otherwise.
-
isLoaded
boolean isLoaded(java.lang.String attribute, java.util.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(java.lang.String attribute, java.util.Locale loc)Retrieves the original loaded value of the localized attribute with the locale.- Returns:
- the original localized value with the locale.
-
getDirtyLocalizedAttributes
java.util.Map<java.util.Locale,java.util.Set<java.lang.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
java.lang.String getItemType()
Retrieves the item type of the model.
-
getTenantId
java.lang.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
java.lang.Object getSource()
Retrieves the item of the model.- Returns:
- the behind scene jalo item.
-
-