Package de.hybris.platform.catalog.impl
Class DefaultCatalogTypeService
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.service.AbstractService
-
- de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
-
- de.hybris.platform.catalog.impl.DefaultCatalogTypeService
-
- All Implemented Interfaces:
CatalogTypeService,java.io.Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
public class DefaultCatalogTypeService extends AbstractBusinessService implements CatalogTypeService
Default implementation of theCatalogTypeService.- 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.AbstractBusinessService
modelService, sessionService, txManager
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant
-
-
Constructor Summary
Constructors Constructor Description DefaultCatalogTypeService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<ComposedTypeModel>getAllCatalogVersionAwareTypes(boolean superTypesOnly)Returns all composed types which are catalog version aware (or catalog contained). The method has two modes of operation: If the supertypesOnly argument is false : all the types withComposedTypeModel.CATALOGITEMTYPEequal TRUE will be returned. If the supertypesOnly argument is true : the method will return allComposedTypeModels which fulfill the following:ComposedTypeModel.CATALOGITEMTYPEflag equal TRUE super type is not catalog version aware OR super type is catalog version aware but it's unique attributes are different than unique attributes of the given typeItemModelgetCatalogVersionAwareModel(CatalogVersionModel version, java.lang.String typeCode, java.util.Map<java.lang.String,java.lang.Object> uniqueKeyValues)Returns for the givenCatalogVersionModel, thetypeCodeand the map with the unique catalog key attributes and their values anItemModel(or a given subtype).java.lang.StringgetCatalogVersionContainerAttribute(java.lang.String typeCode)Returns for the giventypeCodethe qualifier of the CatalogVersion attribute.CatalogVersionModelgetCatalogVersionForCatalogVersionAwareModel(ItemModel model)Retrieves the owning catalog version for a catalog version contained itemmodel.CatalogVersionOverviewgetCatalogVersionOverview(CatalogVersionModel catalogVersion)Collects all catalog version aware types, where at least one item exists, which belongs to given catalog version.java.util.Set<java.lang.String>getCatalogVersionUniqueKeyAttribute(java.lang.String typeCode)Returns a set of attribute qualifiers by which an instance with the giventypeCodecan be identified as unique within any catalog version.booleanisCatalogVersionAwareModel(ItemModel model)Checks if the givenmodelis catalogVersion aware (catalog contained type).booleanisCatalogVersionAwareType(ComposedTypeModel type)Checks if the giventypeis catalog version aware (catalog contained type).booleanisCatalogVersionAwareType(java.lang.String typeCode)Returnstrueif the giventypeCodestring represents a type that is catalog version aware.voidsetCatalogTypeDao(CatalogTypeDao catalogTypeDao)voidsetFlexibleSearchService(FlexibleSearchService flexibleSearchService)voidsetSearchRestrictionService(SearchRestrictionService searchRestrictionService)voidsetTypeService(TypeService typeService)-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManager
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
-
-
-
Method Detail
-
getCatalogVersionContainerAttribute
public java.lang.String getCatalogVersionContainerAttribute(java.lang.String typeCode)
Description copied from interface:CatalogTypeServiceReturns for the giventypeCodethe qualifier of the CatalogVersion attribute. This method will try to examine the giventypefor attribute where the CatalogVersion is stored and return it's qualifier.- Specified by:
getCatalogVersionContainerAttributein interfaceCatalogTypeService- Parameters:
typeCode- the typeCode of the targetComposedTypeModel- Returns:
- the catalog version attribute qualifier
-
getCatalogVersionAwareModel
public ItemModel getCatalogVersionAwareModel(CatalogVersionModel version, java.lang.String typeCode, java.util.Map<java.lang.String,java.lang.Object> uniqueKeyValues) throws CatalogAwareObjectResolvingException
Description copied from interface:CatalogTypeServiceReturns for the givenCatalogVersionModel, thetypeCodeand the map with the unique catalog key attributes and their values anItemModel(or a given subtype).Please refer to
CatalogTypeService.getCatalogVersionUniqueKeyAttribute(String)to see how a set of the unique catalog key attributes for a given type can be recognized.If the
versionis not persisted or one of theuniqueKeyValuesmembers is a non-persisted model, the method will throwCatalogAwareObjectResolvingException;- Specified by:
getCatalogVersionAwareModelin interfaceCatalogTypeService- Parameters:
version- theCatalogVersionModeltypeCode- String typeCode of theComposedTypeModeluniqueKeyValues- a map with ALL unique catalog key attribute and their values to be searched for. Any non-unique catalog key attribute in the given map will be ignored.- Returns:
- an ItemModel or a subtype of ItemModel which matches the given parameters OR
nullif any item model in theuniqueKeyValuesmap was not persisted yet. - Throws:
CatalogAwareObjectResolvingException- ifversionin not persisted OR one of the unique parameters is a model and is not persisted.
-
getCatalogVersionUniqueKeyAttribute
public java.util.Set<java.lang.String> getCatalogVersionUniqueKeyAttribute(java.lang.String typeCode)
Description copied from interface:CatalogTypeServiceReturns a set of attribute qualifiers by which an instance with the giventypeCodecan be identified as unique within any catalog version.- Specified by:
getCatalogVersionUniqueKeyAttributein interfaceCatalogTypeService- Parameters:
typeCode- the ComposedType's code- Returns:
- an empty set if the given
typeCodehas no such attributes
-
isCatalogVersionAwareType
public boolean isCatalogVersionAwareType(java.lang.String typeCode)
Description copied from interface:CatalogTypeServiceReturnstrueif the giventypeCodestring represents a type that is catalog version aware.- Specified by:
isCatalogVersionAwareTypein interfaceCatalogTypeService- Parameters:
typeCode- the typeCode of ComposedType- Returns:
falseif thetypeCodeis not a catalog item type.
-
getAllCatalogVersionAwareTypes
public java.util.Collection<ComposedTypeModel> getAllCatalogVersionAwareTypes(boolean superTypesOnly)
Description copied from interface:CatalogTypeServiceReturns all composed types which are catalog version aware (or catalog contained). The method has two modes of operation:- If the supertypesOnly argument is false : all the types with
ComposedTypeModel.CATALOGITEMTYPEequal TRUE will be returned. - If the supertypesOnly argument is true : the method will return all
ComposedTypeModels which fulfill the following:ComposedTypeModel.CATALOGITEMTYPEflag equal TRUE- super type is not catalog version aware OR super type is catalog version aware but it's unique attributes are different than unique attributes of the given type
- Specified by:
getAllCatalogVersionAwareTypesin interfaceCatalogTypeService- Parameters:
superTypesOnly- if set to true only root types will be returned.- Returns:
- collection of
ComposedTypeModels which haveComposedTypeModel.CATALOGITEMTYPEequal TRUE.
- If the supertypesOnly argument is false : all the types with
-
isCatalogVersionAwareType
public boolean isCatalogVersionAwareType(ComposedTypeModel type)
Description copied from interface:CatalogTypeServiceChecks if the giventypeis catalog version aware (catalog contained type).- Specified by:
isCatalogVersionAwareTypein interfaceCatalogTypeService- Parameters:
type- targetComposedTypeModel- Returns:
- boolean value
-
isCatalogVersionAwareModel
public boolean isCatalogVersionAwareModel(ItemModel model)
Description copied from interface:CatalogTypeServiceChecks if the givenmodelis catalogVersion aware (catalog contained type).- Specified by:
isCatalogVersionAwareModelin interfaceCatalogTypeService- Parameters:
model- the target item model- Returns:
- boolean value
-
getCatalogVersionForCatalogVersionAwareModel
public CatalogVersionModel getCatalogVersionForCatalogVersionAwareModel(ItemModel model)
Description copied from interface:CatalogTypeServiceRetrieves the owning catalog version for a catalog version contained itemmodel.- Specified by:
getCatalogVersionForCatalogVersionAwareModelin interfaceCatalogTypeService- Parameters:
model- the target item model- See Also:
CatalogTypeService.isCatalogVersionAwareModel(ItemModel)
-
getCatalogVersionOverview
public CatalogVersionOverview getCatalogVersionOverview(CatalogVersionModel catalogVersion)
Description copied from interface:CatalogTypeServiceCollects all catalog version aware types, where at least one item exists, which belongs to given catalog version. Some statistics, like the amount of items per type are collected as well.- Specified by:
getCatalogVersionOverviewin interfaceCatalogTypeService- Parameters:
catalogVersion- the catalog version- Returns:
CatalogVersionOverviewobject
-
setTypeService
public void setTypeService(TypeService typeService)
-
setCatalogTypeDao
public void setCatalogTypeDao(CatalogTypeDao catalogTypeDao)
-
setFlexibleSearchService
public void setFlexibleSearchService(FlexibleSearchService flexibleSearchService)
-
setSearchRestrictionService
public void setSearchRestrictionService(SearchRestrictionService searchRestrictionService)
-
-