Class ModelValueHistory
java.lang.Object
de.hybris.platform.servicelayer.internal.model.impl.ModelValueHistory
- All Implemented Interfaces:
Serializable
Keeps track of original (loaded) values of a item model. It also stores which fields have been set explicitly even if
the value had been null.
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclearOriginalValue(String qualifier) Clears originally loaded value for a given attribute.voidclearOriginalValue(String qualifier, Locale locale) Clears localized original value.Returns all dirty unlocalized attributes.Returns all localized dirty attributes.getOriginalValue(String qualifier) Returns original unlocalized value for specified attribute qualifier.getOriginalValue(String qualifier, Locale locale) Returns original localized value for specified attribute qualifier and language qualifier (iso code).longbooleanisDirty()booleanTells if a unlocalized attribute has been marked as dirty.booleanTells if a localized attribute has been marked as dirty.booleanisValueLoaded(String qualifier) Tells if this history contains a unlocalized original value for the specified attribute.booleanisValueLoaded(String qualifier, Locale locale) Tells if this history contains a localized original value for the specified attribute.voidloadOriginalValue(String qualifier, Object value) Loads unlocalized original value.voidloadOriginalValue(String qualifier, Object value, boolean resetDirtyFlag) voidloadOriginalValue(String qualifier, Locale locale, Object value) Loads localized original value.voidloadOriginalValue(String qualifier, Locale locale, Object value, boolean resetDirtyFlag) voidMarks unlocalized attribute as 'dirty' which means that it has been set by model user.voidMarks localized attribute as 'dirty' which means that it has been set by model user.voidmarkUnchanged(String qualifier) Signals that a 'dirty' attribute finally has been tested and found unchanged.voidmarkUnchanged(String qualifier, Locale locale) Signals that a 'dirty' attribute finally has been tested and found unchanged.voidmergeDirty(Map<Locale, Set<Locale>> data2nonDataLocales) voidresetAttributeLoadingError(String qualifier) voidresetLocAttributeLoadingError(String qualifier, Locale loc) voidsetAttributeLoadingError(String qualifier, ModelLoadingException e) voidsetAttributeProvider(AttributeProvider attributeProvider) voidsetListener(ModelValueHistory.HistoryListener givenListener) voidsetLocAttributeLoadingError(String qualifier, Locale loc, ModelLoadingException e) voidsetPersistenceVersion(long persistenceVersion) voidthrowAttributeError(String qualifier) voidthrowLocAttributeError(String qualifier, Locale loc)
-
Constructor Details
-
ModelValueHistory
public ModelValueHistory() -
ModelValueHistory
-
-
Method Details
-
setAttributeLoadingError
-
resetAttributeLoadingError
-
throwAttributeError
- Throws:
ModelLoadingException
-
setLocAttributeLoadingError
-
resetLocAttributeLoadingError
-
throwLocAttributeError
- Throws:
ModelLoadingException
-
getListener
-
setListener
-
getOriginalValue
Returns original unlocalized value for specified attribute qualifier. This operation can throw anIllegalStateExceptionif original value is not loaded yet . Usually should be guardedisValueLoaded(String).- Parameters:
qualifier- the attribute qualifier- Throws:
IllegalStateException- if no value has been loaded for this attribute
-
getOriginalValue
Returns original localized value for specified attribute qualifier and language qualifier (iso code). This operation can throw anIllegalStateExceptionif original value is not loaded yet . Usually should be guardedisValueLoaded(String, java.util.Locale).- Parameters:
qualifier- the attribute qualifierlocale- the locale- Throws:
IllegalStateException- if no value has been loaded for this attribute
-
loadOriginalValue
Loads unlocalized original value.- Parameters:
qualifier- the attribute qualifiervalue- the original value
-
loadOriginalValue
-
clearOriginalValue
Clears originally loaded value for a given attribute. The attribute appears to be not loaded afterwards. -
markUnchanged
Signals that a 'dirty' attribute finally has been tested and found unchanged. So this is a shortcut toloadOriginalValue(String, Object)! -
loadOriginalValue
Loads localized original value.- Parameters:
qualifier- the attribute qualifierlocale- the localevalue- the original value
-
loadOriginalValue
-
clearOriginalValue
Clears localized original value.- Parameters:
qualifier- the attribute qualifierlocale- the locale
-
markUnchanged
Signals that a 'dirty' attribute finally has been tested and found unchanged. So this is a shortcut toloadOriginalValue(String, Object)! -
isValueLoaded
Tells if this history contains a unlocalized original value for the specified attribute.- Parameters:
qualifier- the attribute qualifier.
-
isValueLoaded
Tells if this history contains a localized original value for the specified attribute.- Parameters:
qualifier- the attribute qualifier.locale- the locale
-
markDirty
Marks unlocalized attribute as 'dirty' which means that it has been set by model user.- Parameters:
qualifier- the attribute qualifier
-
markDirty
Marks localized attribute as 'dirty' which means that it has been set by model user.- Parameters:
qualifier- the attribute qualifierlocale- the language qualifier
-
mergeDirty
-
isDirty
Tells if a unlocalized attribute has been marked as dirty.- Parameters:
qualifier- the attribute qualifier
-
isDirty
public boolean isDirty() -
isDirty
Tells if a localized attribute has been marked as dirty. If the given Locale isnullthis method checks in all Locales for modifications for the given attribute (qualifier).- Parameters:
qualifier- the attribute qualifierlocale- the locale
-
getDirtyAttributes
Returns all dirty unlocalized attributes. -
getDirtyLocalizedAttributes
Returns all localized dirty attributes.- Returns:
- a map <attribute qualifier>->( <language qualifier> )
-
getAllDirtyAttributes
-
getLoadedAttributes
-
getLoadedLocAttributes
-
getPersistenceVersion
public long getPersistenceVersion()- Returns:
- the persistenceVersion
-
setPersistenceVersion
public void setPersistenceVersion(long persistenceVersion) - Parameters:
persistenceVersion- the persistenceVersion to set
-
setAttributeProvider
-