Class DefaultModelContext
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.model.impl.DefaultModelContext
-
- All Implemented Interfaces:
ModelContext
public class DefaultModelContext extends java.lang.Object implements ModelContext
Default model context implementation. Use spring scoped proxy mechanism to bind it toHybrisRequestScope. Any other scope could lead to memory problems since models are held forever (until scope dies)!
-
-
Field Summary
-
Fields inherited from interface de.hybris.platform.servicelayer.internal.model.ModelContext
loading
-
-
Constructor Summary
Constructors Constructor Description DefaultModelContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidafterDirectPersist(ModelWrapper wr)Clear context after save with generic DAOvoidafterDirectPersist(java.util.Collection<ModelWrapper> wrappers)Clear context after save with generic DAOvoidafterPersist(java.util.Collection<ModelWrapper> saved)voidattach(java.lang.Object model, java.lang.Object source, ModelConverter conv)Attaches a new model to the context.voidclear()Removes all attached models.protected java.lang.ObjectconvertKey(java.lang.Object key)Deprecated, for removal: This API element is subject to removal in a future version.since agesvoiddetach(java.lang.Object model, java.lang.Object source, ModelConverter conv)Removes a model from context.java.lang.ObjectgetAttached(java.lang.Object source, ModelConverter conv)Returns a attached model for a given source element and converter.java.util.Set<java.lang.Object>getModified()Returns all attached model instances which are currently modified.java.util.Set<java.lang.Object>getNew()Returns all attached model instances which are currently new.java.lang.StringgetStats()booleanisAttached(java.lang.Object model, ModelConverter conv)protected voidmodificationStatusChanged(java.lang.Object model, ModelConverter conv)protected java.lang.ObjectunwrapKey(java.lang.Object key)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.servicelayer.internal.model.ModelContext
clearLoading, isLoading, markLoading
-
-
-
-
Method Detail
-
isAttached
public boolean isAttached(java.lang.Object model, ModelConverter conv)Description copied from interface:ModelContext- Specified by:
isAttachedin interfaceModelContext- Returns:
falseotherwise.
-
afterPersist
public void afterPersist(java.util.Collection<ModelWrapper> saved)
- Specified by:
afterPersistin interfaceModelContext
-
afterDirectPersist
public void afterDirectPersist(java.util.Collection<ModelWrapper> wrappers)
Description copied from interface:ModelContextClear context after save with generic DAO- Specified by:
afterDirectPersistin interfaceModelContext
-
afterDirectPersist
public void afterDirectPersist(ModelWrapper wr)
Description copied from interface:ModelContextClear context after save with generic DAO- Specified by:
afterDirectPersistin interfaceModelContext
-
modificationStatusChanged
protected void modificationStatusChanged(java.lang.Object model, ModelConverter conv)
-
getStats
public java.lang.String getStats()
-
attach
public void attach(java.lang.Object model, java.lang.Object source, ModelConverter conv)Description copied from interface:ModelContextAttaches a new model to the context.- Specified by:
attachin interfaceModelContext- Parameters:
model- the model to holdsource- the source element - may be null for new modelsconv- the converter used
-
convertKey
@Deprecated(since="ages", forRemoval=true) protected java.lang.Object convertKey(java.lang.Object key)Deprecated, for removal: This API element is subject to removal in a future version.since agesUseunwrapKey(Object)insteaddeprecated @since 5.0
-
unwrapKey
protected java.lang.Object unwrapKey(java.lang.Object key)
-
detach
public void detach(java.lang.Object model, java.lang.Object source, ModelConverter conv)Description copied from interface:ModelContextRemoves a model from context.- Specified by:
detachin interfaceModelContext- Parameters:
model- the model to removesource- its source - may be null for new modelsconv- the converter which manages the model
-
getAttached
public java.lang.Object getAttached(java.lang.Object source, ModelConverter conv)Description copied from interface:ModelContextReturns a attached model for a given source element and converter.- Specified by:
getAttachedin interfaceModelContext- Parameters:
source- the source element - must not be nullconv- the converter
-
clear
public void clear()
Description copied from interface:ModelContextRemoves all attached models.- Specified by:
clearin interfaceModelContext
-
getNew
public java.util.Set<java.lang.Object> getNew()
Description copied from interface:ModelContextReturns all attached model instances which are currently new.- Specified by:
getNewin interfaceModelContext
-
getModified
public java.util.Set<java.lang.Object> getModified()
Description copied from interface:ModelContextReturns all attached model instances which are currently modified.- Specified by:
getModifiedin interfaceModelContext
-
-