Class AbstractModelService
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.service.AbstractService
-
- de.hybris.platform.servicelayer.internal.model.impl.AbstractModelService
-
- All Implemented Interfaces:
ModelService,java.io.Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
DefaultModelService,MockModelService
public abstract class AbstractModelService extends AbstractService implements ModelService
SeeModelService. The basics of the servicelayer are implemented here.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant
-
-
Constructor Summary
Constructors Constructor Description AbstractModelService()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <T extends java.util.Collection>
TgetAll(java.util.Collection<? extends java.lang.Object> sources, T result)Convenience method to load all objects in a source collection and adding the loaded objects to a result collection.<T extends java.util.Collection>
TgetAll(java.util.Collection<? extends java.lang.Object> sources, T result, java.lang.String conversionType)Convenience method to load all objects in a source collection and adding the loaded objects to a result collection.<T extends java.util.Collection>
TgetAllSources(java.util.Collection<? extends java.lang.Object> models, T result)Convenience method to load all the sources of a given collection of modelsprotected abstract java.lang.ObjectgetModelForPersistentValue(java.lang.Object persistentValue)protected abstract java.lang.ObjectgetPersistentValueForModel(java.lang.Object model)voidsaveAll(java.lang.Object... models)Saves several model model instances at once.<T> TtoModelLayer(java.lang.Object persistentValue)Converts arbitrary values into a representation to be used inside the model layer.<T> TtoPersistenceLayer(java.lang.Object modelValue)Converts arbitrary model layer values into a form which may be used in persistence layer.-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
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.model.ModelService
attach, clearTransactionsSettings, clone, clone, clone, clone, create, create, detach, detach, detachAll, disableTransactions, enableTransactions, get, get, get, getAttributeValue, getAttributeValue, getAttributeValues, getByExample, getModelType, getModelType, getModelTypeClass, getSource, getWithLock, initDefaults, isAttached, isModified, isNew, isRemoved, isSourceAttached, isUniqueConstraintErrorAsRootCause, isUpToDate, lock, lock, refresh, remove, remove, removeAll, removeAll, save, saveAll, saveAll, setAttributeValue, setAttributeValue
-
-
-
-
Method Detail
-
saveAll
public void saveAll(java.lang.Object... models) throws ModelSavingExceptionDescription copied from interface:ModelServiceSaves several model model instances at once. If at least one instance causes a validation error no modifications are written.- Specified by:
saveAllin interfaceModelService- Parameters:
models- the model instances to save- Throws:
ModelSavingException- See Also:
ModelService.save(Object)
-
toModelLayer
public <T> T toModelLayer(java.lang.Object persistentValue)
Description copied from interface:ModelServiceConverts arbitrary values into a representation to be used inside the model layer. Generally this converts all object with existing model converter into their model representation. Collections and maps are copied on demand. Any other objects stay unchanged.- Specified by:
toModelLayerin interfaceModelService- Parameters:
persistentValue- the value loaded from persistence layer.
-
getModelForPersistentValue
protected abstract java.lang.Object getModelForPersistentValue(java.lang.Object persistentValue)
-
toPersistenceLayer
public <T> T toPersistenceLayer(java.lang.Object modelValue)
Description copied from interface:ModelServiceConverts arbitrary model layer values into a form which may be used in persistence layer. Generally this converts all models back into their source. Collections and maps are copied on demand. Any other objects stay unchanged.- Specified by:
toPersistenceLayerin interfaceModelService- Parameters:
modelValue- the value to be translated back into persistence layer form
-
getPersistentValueForModel
protected abstract java.lang.Object getPersistentValueForModel(java.lang.Object model)
-
getAllSources
public <T extends java.util.Collection> T getAllSources(java.util.Collection<? extends java.lang.Object> models, T result)Description copied from interface:ModelServiceConvenience method to load all the sources of a given collection of models- Specified by:
getAllSourcesin interfaceModelService- Parameters:
models- the objects for which to retrieve model instancesresult- the collection to add the model instances to- Returns:
- the result collects
-
getAll
public <T extends java.util.Collection> T getAll(java.util.Collection<? extends java.lang.Object> sources, T result)Description copied from interface:ModelServiceConvenience method to load all objects in a source collection and adding the loaded objects to a result collection.- Specified by:
getAllin interfaceModelService- Parameters:
sources- the objects for which to retrieve model instancesresult- the collection to add the model instances to- Returns:
- the result collects
- See Also:
ModelService.get(Object)
-
getAll
public <T extends java.util.Collection> T getAll(java.util.Collection<? extends java.lang.Object> sources, T result, java.lang.String conversionType)Description copied from interface:ModelServiceConvenience method to load all objects in a source collection and adding the loaded objects to a result collection. This method allows to specify the type to lookup the converter!- Specified by:
getAllin interfaceModelService- Parameters:
sources- the objects for which to retrieve model instancesresult- the collection to add the model instances toconversionType- the type to be used for looking up the model converter- Returns:
- the result collects
- See Also:
ModelService.get(Object)
-
-