Package de.hybris.platform.catalog
Interface CatalogTypeService
-
- All Known Implementing Classes:
DefaultCatalogTypeService
public interface CatalogTypeServiceProvides methods for using the catalog type system.
-
-
Method Summary
All Methods Instance Methods Abstract 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.
-
-
-
Method Detail
-
isCatalogVersionAwareType
boolean isCatalogVersionAwareType(java.lang.String typeCode)
Returnstrueif the giventypeCodestring represents a type that is catalog version aware.- Parameters:
typeCode- the typeCode of ComposedType- Returns:
falseif thetypeCodeis not a catalog item type.- Throws:
java.lang.IllegalArgumentException- if thetypeCodeis null.UnknownIdentifierException- if thetypeCodedoes not correspond to a valid type.
-
getCatalogVersionContainerAttribute
java.lang.String getCatalogVersionContainerAttribute(java.lang.String typeCode)
Returns 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.- Parameters:
typeCode- the typeCode of the targetComposedTypeModel- Returns:
- the catalog version attribute qualifier
- Throws:
java.lang.IllegalArgumentException- if- the
typeCodeis null OR - corresponding type has no catalog version container attribute
- the
AmbiguousIdentifierException- - when more than one composed type for giventypeCodeis found.UnknownIdentifierException- - when no composed type for giventypeCodeis found.
-
getCatalogVersionUniqueKeyAttribute
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.- Parameters:
typeCode- the ComposedType's code- Returns:
- an empty set if the given
typeCodehas no such attributes - Throws:
java.lang.IllegalArgumentException- if thetypeCodeis null.
-
getCatalogVersionAwareModel
ItemModel getCatalogVersionAwareModel(CatalogVersionModel version, java.lang.String typeCode, java.util.Map<java.lang.String,java.lang.Object> uniqueKeyValues) throws CatalogAwareObjectResolvingException
Returns for the givenCatalogVersionModel, thetypeCodeand the map with the unique catalog key attributes and their values anItemModel(or a given subtype).Please refer to
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;- 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:
java.lang.IllegalArgumentException- if:- the
versionis null - the
typeCodeis null - the
uniqueKeyValuesis null - the
typeCodeis not a catalog item type -
if
uniqueKeyValuesmap does not contain all unique attributes for the given catalog item type
- the
java.lang.IllegalStateException- if:- the given
typeCodehas no unique catalog attributes defined - if a unique catalog key attribute is not searchable
- the given
UnknownIdentifierException- if:- the given
typeCodedoes not correspond to a system type
- the given
AmbiguousIdentifierException- if:- the given
typeCodecorresponds to more than one system type
- the given
CatalogAwareObjectResolvingException- ifversionin not persisted OR one of the unique parameters is a model and is not persisted.
-
getAllCatalogVersionAwareTypes
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 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
- 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
boolean isCatalogVersionAwareType(ComposedTypeModel type)
Checks if the giventypeis catalog version aware (catalog contained type).- Parameters:
type- targetComposedTypeModel- Returns:
- boolean value
- Throws:
java.lang.IllegalArgumentException- iftypeis null.
-
isCatalogVersionAwareModel
boolean isCatalogVersionAwareModel(ItemModel model)
Checks if the givenmodelis catalogVersion aware (catalog contained type).- Parameters:
model- the target item model- Returns:
- boolean value
- Throws:
java.lang.IllegalArgumentException- ifmodelis null.
-
getCatalogVersionForCatalogVersionAwareModel
CatalogVersionModel getCatalogVersionForCatalogVersionAwareModel(ItemModel model)
Retrieves the owning catalog version for a catalog version contained itemmodel.- Parameters:
model- the target item model- Throws:
java.lang.IllegalArgumentException- ifmodelis nulljava.lang.IllegalStateException- if- catalog version attribute was of unexpected type, or
- the model given is not catalog version aware
- See Also:
isCatalogVersionAwareModel(ItemModel)
-
getCatalogVersionOverview
CatalogVersionOverview getCatalogVersionOverview(CatalogVersionModel catalogVersion)
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.- Parameters:
catalogVersion- the catalog version- Returns:
CatalogVersionOverviewobject
-
-