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.CATALOGITEMTYPE
equal TRUE will be returned. If the supertypesOnly argument is true : the method will return allComposedTypeModel
s which fulfill the following:ComposedTypeModel.CATALOGITEMTYPE
flag 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 typeItemModel
getCatalogVersionAwareModel(CatalogVersionModel version, java.lang.String typeCode, java.util.Map<java.lang.String,java.lang.Object> uniqueKeyValues)
Returns for the givenCatalogVersionModel
, thetypeCode
and the map with the unique catalog key attributes and their values anItemModel
(or a given subtype).java.lang.String
getCatalogVersionContainerAttribute(java.lang.String typeCode)
Returns for the giventypeCode
the qualifier of the CatalogVersion attribute.CatalogVersionModel
getCatalogVersionForCatalogVersionAwareModel(ItemModel model)
Retrieves the owning catalog version for a catalog version contained itemmodel
.
CatalogVersionOverview
getCatalogVersionOverview(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 giventypeCode
can be identified as unique within any catalog version.boolean
isCatalogVersionAwareModel(ItemModel model)
Checks if the givenmodel
is catalogVersion aware (catalog contained type).
boolean
isCatalogVersionAwareType(ComposedTypeModel type)
Checks if the giventype
is catalog version aware (catalog contained type).
boolean
isCatalogVersionAwareType(java.lang.String typeCode)
Returnstrue
if the giventypeCode
string represents a type that is catalog version aware.void
setCatalogTypeDao(CatalogTypeDao catalogTypeDao)
void
setFlexibleSearchService(FlexibleSearchService flexibleSearchService)
void
setSearchRestrictionService(SearchRestrictionService searchRestrictionService)
void
setTypeService(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:CatalogTypeService
Returns for the giventypeCode
the qualifier of the CatalogVersion attribute. This method will try to examine the giventype
for attribute where the CatalogVersion is stored and return it's qualifier.
- Specified by:
getCatalogVersionContainerAttribute
in 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:CatalogTypeService
Returns for the givenCatalogVersionModel
, thetypeCode
and 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
version
is not persisted or one of the
uniqueKeyValues
members is a non-persisted model, the method will throw
CatalogAwareObjectResolvingException
;- Specified by:
getCatalogVersionAwareModel
in interfaceCatalogTypeService
- Parameters:
version
- theCatalogVersionModel
typeCode
- String typeCode of theComposedTypeModel
uniqueKeyValues
- 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
null
if any item model in theuniqueKeyValues
map was not persisted yet. - Throws:
CatalogAwareObjectResolvingException
- ifversion
in 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:CatalogTypeService
Returns a set of attribute qualifiers by which an instance with the giventypeCode
can be identified as unique within any catalog version.- Specified by:
getCatalogVersionUniqueKeyAttribute
in interfaceCatalogTypeService
- Parameters:
typeCode
- the ComposedType's code- Returns:
- an empty set if the given
typeCode
has no such attributes
-
isCatalogVersionAwareType
public boolean isCatalogVersionAwareType(java.lang.String typeCode)
Description copied from interface:CatalogTypeService
Returnstrue
if the giventypeCode
string represents a type that is catalog version aware.- Specified by:
isCatalogVersionAwareType
in interfaceCatalogTypeService
- Parameters:
typeCode
- the typeCode of ComposedType- Returns:
false
if thetypeCode
is not a catalog item type.
-
getAllCatalogVersionAwareTypes
public java.util.Collection<ComposedTypeModel> getAllCatalogVersionAwareTypes(boolean superTypesOnly)
Description copied from interface:CatalogTypeService
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 with
ComposedTypeModel.CATALOGITEMTYPE
equal TRUE will be returned. - If the supertypesOnly argument is true : the method will return all
ComposedTypeModel
s which fulfill the following:ComposedTypeModel.CATALOGITEMTYPE
flag 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:
getAllCatalogVersionAwareTypes
in interfaceCatalogTypeService
- Parameters:
superTypesOnly
- if set to true only root types will be returned.- Returns:
- collection of
ComposedTypeModel
s which haveComposedTypeModel.CATALOGITEMTYPE
equal TRUE.
- If the supertypesOnly argument is false : all the types with
-
isCatalogVersionAwareType
public boolean isCatalogVersionAwareType(ComposedTypeModel type)
Description copied from interface:CatalogTypeService
Checks if the giventype
is catalog version aware (catalog contained type).
- Specified by:
isCatalogVersionAwareType
in interfaceCatalogTypeService
- Parameters:
type
- targetComposedTypeModel
- Returns:
- boolean value
-
isCatalogVersionAwareModel
public boolean isCatalogVersionAwareModel(ItemModel model)
Description copied from interface:CatalogTypeService
Checks if the givenmodel
is catalogVersion aware (catalog contained type).
- Specified by:
isCatalogVersionAwareModel
in interfaceCatalogTypeService
- Parameters:
model
- the target item model- Returns:
- boolean value
-
getCatalogVersionForCatalogVersionAwareModel
public CatalogVersionModel getCatalogVersionForCatalogVersionAwareModel(ItemModel model)
Description copied from interface:CatalogTypeService
Retrieves the owning catalog version for a catalog version contained itemmodel
.
- Specified by:
getCatalogVersionForCatalogVersionAwareModel
in interfaceCatalogTypeService
- Parameters:
model
- the target item model- See Also:
CatalogTypeService.isCatalogVersionAwareModel(ItemModel)
-
getCatalogVersionOverview
public CatalogVersionOverview getCatalogVersionOverview(CatalogVersionModel catalogVersion)
Description copied from interface:CatalogTypeService
Collects 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:
getCatalogVersionOverview
in interfaceCatalogTypeService
- Parameters:
catalogVersion
- the catalog version- Returns:
CatalogVersionOverview
object
-
setTypeService
public void setTypeService(TypeService typeService)
-
setCatalogTypeDao
public void setCatalogTypeDao(CatalogTypeDao catalogTypeDao)
-
setFlexibleSearchService
public void setFlexibleSearchService(FlexibleSearchService flexibleSearchService)
-
setSearchRestrictionService
public void setSearchRestrictionService(SearchRestrictionService searchRestrictionService)
-
-