Class DefaultModelServiceInterceptorContext
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.model.impl.DefaultModelServiceInterceptorContext
-
- All Implemented Interfaces:
InterceptorContext
public class DefaultModelServiceInterceptorContext extends java.lang.Object implements InterceptorContext
Default implementation of theInterceptorContext.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.hybris.platform.servicelayer.interceptor.InterceptorContext
InterceptorContext.TransientStorage
-
-
Constructor Summary
Constructors Constructor Description DefaultModelServiceInterceptorContext(DefaultModelService parent, PersistenceOperation defaultPersistenceOperation, java.util.Collection<? extends java.lang.Object> initialElements, ModelWrapperContext wrapperContext)DefaultModelServiceInterceptorContext(DefaultModelService parent, java.util.Collection<java.lang.Object> initialElements, ModelWrapperContext wrapperContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancontains(java.lang.Object model)Deprecated, for removal: This API element is subject to removal in a future version.since agesbooleancontains(java.lang.Object model, PersistenceOperation operation)Checks is the given model is already registered in this InterceptorContext with the given operation.InterceptorContextSnapshotcreateSnapshot()RegisteredElementselementsRegisteredFor(PersistenceOperation operation)booleanexists(java.lang.Object model)java.util.Set<java.lang.Object>getAllRegisteredElements()java.lang.ObjectgetAttribute(java.lang.String key)java.util.Map<java.lang.String,java.util.Set<java.util.Locale>>getDirtyAttributes(java.lang.Object model)Returns a map with all modified attribute qualifiers for the given model.java.util.Set<java.lang.Object>getElementsRegisteredFor(PersistenceOperation operation)RegisteredElementsgetInitialElements()java.util.Collection<ModelWrapper>getInitialWrappers()ModelServicegetModelService()SchedulegetSchedule()java.lang.ObjectgetSource(java.lang.Object model)Deprecated, for removal: This API element is subject to removal in a future version.since agesInterceptorContext.TransientStoragegetTransientStorage()Returns theInterceptorContext.TransientStoragewhich can be used to share attributes among all interceptors involved in theModelServiceoperation.WrapperRegistrygetWrapperRegistry()booleanisAlreadyNotified(java.lang.Object model)booleanisModified(java.lang.Object model)booleanisModified(java.lang.Object model, java.lang.String attribute)booleanisNew(java.lang.Object model)Tells if the model has been created and has not been saved yet.booleanisRemoved(java.lang.Object model)voidmarkAsNotified(java.lang.Object model)voidregisterElement(java.lang.Object model)Register the givenmodelto this InterceptorContext using the InterceptorContext's default operation.voidregisterElement(java.lang.Object model, java.lang.Object source)Register the givenmodelto this InterceptorContext using the InterceptorContext's default operation.voidregisterElementFor(java.lang.Object model, PersistenceOperation operation)Register the givenmodelto this InterceptorContext using the given operation.voidregisterWrappedElementsFor(java.util.Collection<ModelWrapper> wrappers, PersistenceOperation operation)voidschedule(ModelWrapper wrapper)voidsetAttribute(java.lang.String key, java.lang.Object value)java.util.Collection<ModelWrapper>wrap(java.util.Collection<? extends java.lang.Object> models, PersistenceOperation operation)
-
-
-
Constructor Detail
-
DefaultModelServiceInterceptorContext
public DefaultModelServiceInterceptorContext(DefaultModelService parent, PersistenceOperation defaultPersistenceOperation, java.util.Collection<? extends java.lang.Object> initialElements, ModelWrapperContext wrapperContext)
-
DefaultModelServiceInterceptorContext
public DefaultModelServiceInterceptorContext(DefaultModelService parent, java.util.Collection<java.lang.Object> initialElements, ModelWrapperContext wrapperContext)
-
-
Method Detail
-
registerElement
public void registerElement(java.lang.Object model, java.lang.Object source)Description copied from interface:InterceptorContextRegister the givenmodelto this InterceptorContext using the InterceptorContext's default operation.- Specified by:
registerElementin interfaceInterceptorContext- Parameters:
model- the model to be registered.source- the source of the model (optional)
-
registerElement
public void registerElement(java.lang.Object model)
Description copied from interface:InterceptorContextRegister the givenmodelto this InterceptorContext using the InterceptorContext's default operation.- Specified by:
registerElementin interfaceInterceptorContext- Parameters:
model- the model to be registered.
-
registerElementFor
public void registerElementFor(java.lang.Object model, PersistenceOperation operation)Description copied from interface:InterceptorContextRegister the givenmodelto this InterceptorContext using the given operation.- Specified by:
registerElementForin interfaceInterceptorContext- Parameters:
model- the model to be registered.operation- the operation to be performed with the given model
-
elementsRegisteredFor
public RegisteredElements elementsRegisteredFor(PersistenceOperation operation)
-
getAllRegisteredElements
public java.util.Set<java.lang.Object> getAllRegisteredElements()
- Specified by:
getAllRegisteredElementsin interfaceInterceptorContext- Returns:
- unmodifiable set of models registered using the default operation
-
getElementsRegisteredFor
public java.util.Set<java.lang.Object> getElementsRegisteredFor(PersistenceOperation operation)
- Specified by:
getElementsRegisteredForin interfaceInterceptorContext- Returns:
- unmodifiable set of models registered for the given operation
-
contains
@Deprecated(since="ages", forRemoval=true) public boolean contains(java.lang.Object model)Deprecated, for removal: This API element is subject to removal in a future version.since agesDescription copied from interface:InterceptorContextChecks is the given model is already registered in this InterceptorContext with the default operation.- Specified by:
containsin interfaceInterceptorContext- Parameters:
model- model instance to be searched for- Returns:
- true if context interceptor contains model
-
contains
public boolean contains(java.lang.Object model, PersistenceOperation operation)Description copied from interface:InterceptorContextChecks is the given model is already registered in this InterceptorContext with the given operation.- Specified by:
containsin interfaceInterceptorContext- Parameters:
model- model instance to be searched foroperation- the operation to be searched for- Returns:
- true if context interceptor contains model
-
getSource
@Deprecated(since="ages", forRemoval=true) public java.lang.Object getSource(java.lang.Object model)Deprecated, for removal: This API element is subject to removal in a future version.since ages- Specified by:
getSourcein interfaceInterceptorContext- Parameters:
model- passed in- Returns:
- source for model 'cached' into context instance, see also
DefaultModelService.get(Object)
-
isNew
public boolean isNew(java.lang.Object model)
Description copied from interface:InterceptorContextTells if the model has been created and has not been saved yet.- Specified by:
isNewin interfaceInterceptorContext- Parameters:
model- model instance to be searched for- Returns:
- result of the
ModelConverter.isNew(Object)for registered model converter for passed model
-
exists
public boolean exists(java.lang.Object model)
- Specified by:
existsin interfaceInterceptorContext- Parameters:
model- model instance to be searched for- Returns:
- result of the
ModelConverter.exists(Object)for registered model converter for passed model
-
isModified
public boolean isModified(java.lang.Object model)
- Specified by:
isModifiedin interfaceInterceptorContext- Parameters:
model- model instance to be searched for- Returns:
- result of the
ModelConverter.isModified(Object)for registered model converter for passed model
-
isModified
public boolean isModified(java.lang.Object model, java.lang.String attribute)- Specified by:
isModifiedin interfaceInterceptorContext- Parameters:
model- model instance to be searched forattribute- attribute name to be searched for- Returns:
- result of the
ModelConverter.isModified(Object, String)for registered model converter for passed model , attribute
-
isRemoved
public boolean isRemoved(java.lang.Object model)
- Specified by:
isRemovedin interfaceInterceptorContext- Parameters:
model- model instance to be searched for- Returns:
- result of the
ModelConverter.isRemoved(Object)for registered model converter for passed model
-
getModelService
public ModelService getModelService()
- Specified by:
getModelServicein interfaceInterceptorContext- Returns:
- model service instance for context instance
-
getAttribute
public java.lang.Object getAttribute(java.lang.String key)
- Specified by:
getAttributein interfaceInterceptorContext- Parameters:
key- attribute name- Returns:
- attribute for key
-
setAttribute
public void setAttribute(java.lang.String key, java.lang.Object value)- Specified by:
setAttributein interfaceInterceptorContext- Parameters:
key- attribute namevalue- attribute passed into context
-
getDirtyAttributes
public java.util.Map<java.lang.String,java.util.Set<java.util.Locale>> getDirtyAttributes(java.lang.Object model)
Description copied from interface:InterceptorContextReturns a map with all modified attribute qualifiers for the given model. The keys are all localized and non-localized attribute qualifier which were modified. If the map value isnullthe key is a non-localized attribute qualifier else the map value contains the locale in which language the localized attribute was modified.- Specified by:
getDirtyAttributesin interfaceInterceptorContext- Parameters:
model- the new (not saved) model- Returns:
- a map with all modified attribute qualifier.
-
getTransientStorage
public InterceptorContext.TransientStorage getTransientStorage()
Description copied from interface:InterceptorContextReturns theInterceptorContext.TransientStoragewhich can be used to share attributes among all interceptors involved in theModelServiceoperation.- Specified by:
getTransientStoragein interfaceInterceptorContext- Returns:
- a storage attached to this
InterceptorContext
-
registerWrappedElementsFor
public void registerWrappedElementsFor(java.util.Collection<ModelWrapper> wrappers, PersistenceOperation operation)
-
createSnapshot
public InterceptorContextSnapshot createSnapshot()
-
getInitialElements
public RegisteredElements getInitialElements()
-
markAsNotified
public void markAsNotified(java.lang.Object model)
-
isAlreadyNotified
public boolean isAlreadyNotified(java.lang.Object model)
-
getInitialWrappers
public java.util.Collection<ModelWrapper> getInitialWrappers()
-
schedule
public void schedule(ModelWrapper wrapper)
-
getSchedule
public Schedule getSchedule()
-
wrap
public java.util.Collection<ModelWrapper> wrap(java.util.Collection<? extends java.lang.Object> models, PersistenceOperation operation)
-
getWrapperRegistry
public WrapperRegistry getWrapperRegistry()
-
-