Class ModelValueHistory

java.lang.Object
de.hybris.platform.servicelayer.internal.model.impl.ModelValueHistory
All Implemented Interfaces:
Serializable

public class ModelValueHistory extends Object implements 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:
  • Constructor Details

    • ModelValueHistory

      public ModelValueHistory()
    • ModelValueHistory

      public ModelValueHistory(AttributeProvider attributeProvider)
  • Method Details

    • setAttributeLoadingError

      public void setAttributeLoadingError(String qualifier, ModelLoadingException e)
    • resetAttributeLoadingError

      public void resetAttributeLoadingError(String qualifier)
    • throwAttributeError

      public void throwAttributeError(String qualifier) throws ModelLoadingException
      Throws:
      ModelLoadingException
    • setLocAttributeLoadingError

      public void setLocAttributeLoadingError(String qualifier, Locale loc, ModelLoadingException e)
    • resetLocAttributeLoadingError

      public void resetLocAttributeLoadingError(String qualifier, Locale loc)
    • throwLocAttributeError

      public void throwLocAttributeError(String qualifier, Locale loc) throws ModelLoadingException
      Throws:
      ModelLoadingException
    • getListener

      public ModelValueHistory.HistoryListener getListener()
    • setListener

      public void setListener(ModelValueHistory.HistoryListener givenListener)
    • getOriginalValue

      public Object getOriginalValue(String qualifier)
      Returns original unlocalized value for specified attribute qualifier. This operation can throw an IllegalStateException if original value is not loaded yet . Usually should be guarded isValueLoaded(String).
      Parameters:
      qualifier - the attribute qualifier
      Throws:
      IllegalStateException - if no value has been loaded for this attribute
    • getOriginalValue

      public Object getOriginalValue(String qualifier, Locale locale)
      Returns original localized value for specified attribute qualifier and language qualifier (iso code). This operation can throw an IllegalStateException if original value is not loaded yet . Usually should be guarded isValueLoaded(String, java.util.Locale).
      Parameters:
      qualifier - the attribute qualifier
      locale - the locale
      Throws:
      IllegalStateException - if no value has been loaded for this attribute
    • loadOriginalValue

      public void loadOriginalValue(String qualifier, Object value)
      Loads unlocalized original value.
      Parameters:
      qualifier - the attribute qualifier
      value - the original value
    • loadOriginalValue

      public void loadOriginalValue(String qualifier, Object value, boolean resetDirtyFlag)
    • clearOriginalValue

      public void clearOriginalValue(String qualifier)
      Clears originally loaded value for a given attribute. The attribute appears to be not loaded afterwards.
    • markUnchanged

      public void markUnchanged(String qualifier)
      Signals that a 'dirty' attribute finally has been tested and found unchanged. So this is a shortcut to loadOriginalValue(String, Object)!
    • loadOriginalValue

      public void loadOriginalValue(String qualifier, Locale locale, Object value)
      Loads localized original value.
      Parameters:
      qualifier - the attribute qualifier
      locale - the locale
      value - the original value
    • loadOriginalValue

      public void loadOriginalValue(String qualifier, Locale locale, Object value, boolean resetDirtyFlag)
    • clearOriginalValue

      public void clearOriginalValue(String qualifier, Locale locale)
      Clears localized original value.
      Parameters:
      qualifier - the attribute qualifier
      locale - the locale
    • markUnchanged

      public void markUnchanged(String qualifier, Locale locale)
      Signals that a 'dirty' attribute finally has been tested and found unchanged. So this is a shortcut to loadOriginalValue(String, Object)!
    • isValueLoaded

      public boolean isValueLoaded(String qualifier)
      Tells if this history contains a unlocalized original value for the specified attribute.
      Parameters:
      qualifier - the attribute qualifier.
    • isValueLoaded

      public boolean isValueLoaded(String qualifier, Locale locale)
      Tells if this history contains a localized original value for the specified attribute.
      Parameters:
      qualifier - the attribute qualifier.
      locale - the locale
    • markDirty

      public void markDirty(String qualifier)
      Marks unlocalized attribute as 'dirty' which means that it has been set by model user.
      Parameters:
      qualifier - the attribute qualifier
    • markDirty

      public void markDirty(String qualifier, Locale locale)
      Marks localized attribute as 'dirty' which means that it has been set by model user.
      Parameters:
      qualifier - the attribute qualifier
      locale - the language qualifier
    • mergeDirty

      public void mergeDirty(Map<Locale,Set<Locale>> data2nonDataLocales)
    • isDirty

      public boolean isDirty(String qualifier)
      Tells if a unlocalized attribute has been marked as dirty.
      Parameters:
      qualifier - the attribute qualifier
    • isDirty

      public boolean isDirty()
    • isDirty

      public boolean isDirty(String qualifier, Locale locale)
      Tells if a localized attribute has been marked as dirty. If the given Locale is null this method checks in all Locales for modifications for the given attribute (qualifier).
      Parameters:
      qualifier - the attribute qualifier
      locale - the locale
    • getDirtyAttributes

      public Set<String> getDirtyAttributes()
      Returns all dirty unlocalized attributes.
    • getDirtyLocalizedAttributes

      public Map<Locale,Set<String>> getDirtyLocalizedAttributes()
      Returns all localized dirty attributes.
      Returns:
      a map <attribute qualifier>->( <language qualifier> )
    • getAllDirtyAttributes

      public Map<String,Set<Locale>> getAllDirtyAttributes()
    • getLoadedAttributes

      public Set<String> getLoadedAttributes()
    • getLoadedLocAttributes

      public Set<Key<Locale,String>> getLoadedLocAttributes()
    • getPersistenceVersion

      public long getPersistenceVersion()
      Returns:
      the persistenceVersion
    • setPersistenceVersion

      public void setPersistenceVersion(long persistenceVersion)
      Parameters:
      persistenceVersion - the persistenceVersion to set
    • setAttributeProvider

      public void setAttributeProvider(AttributeProvider attributeProvider)