Class DefaultTypeService
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.service.AbstractService
-
- de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
-
- de.hybris.platform.servicelayer.type.impl.DefaultTypeService
-
- All Implemented Interfaces:
TypeService
,java.io.Serializable
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.InitializingBean
public class DefaultTypeService extends AbstractBusinessService implements TypeService
Default implementation of the type service interface- Since:
- 4.0
- 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 DefaultTypeService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AtomicTypeModel
getAtomicType(java.lang.String typeCode)
Deprecated.since agesAtomicTypeModel
getAtomicTypeForCode(java.lang.String code)
Gets the atomic type for code.AtomicTypeModel
getAtomicTypeForJavaClass(java.lang.Class javaClass)
Returns the atomic type for java class.AttributeDescriptorModel
getAttributeDescriptor(ComposedTypeModel composedType, java.lang.String qualifier)
Returns a specific attribute descriptor for a given composed type.AttributeDescriptorModel
getAttributeDescriptor(java.lang.String composedType, java.lang.String qualifier)
Returns a specific attribute descriptor for a given composed type.java.util.Set<AttributeDescriptorModel>
getAttributeDescriptors(ComposedTypeModel composedType)
Deprecated.since agesjava.util.Set<AttributeDescriptorModel>
getAttributeDescriptors(java.lang.String composedTypeCode)
Deprecated.since agesjava.util.Set<AttributeDescriptorModel>
getAttributeDescriptorsForType(ComposedTypeModel composedType)
!!Note!! this service is not returning VariantAttributeDescriptors if there are any.java.util.Set<AttributeDescriptorModel>
getAttributesForModifiers(java.lang.String composedTypeCode, AttributeModifierCriteria criteria)
Gets the attributes for modifiers for given composed type and criteria container.ComposedTypeModel
getComposedType(java.lang.Class modelClass)
Deprecated.since agesComposedTypeModel
getComposedType(java.lang.String typeCode)
Deprecated.since agesComposedTypeModel
getComposedTypeForClass(java.lang.Class modelClass)
Returns the specific composed type for the model class.ComposedTypeModel
getComposedTypeForCode(java.lang.String code)
Returns the specific composed type for code.java.util.Map<java.lang.String,java.lang.Object>
getDefaultValues(java.lang.String type)
Fetches all configured default values for a specified type.java.util.Map<java.lang.String,java.lang.Object>
getDefaultValues(java.lang.String type, java.util.Collection<java.lang.String> attributes)
Fetches a subset of all configured default values for a specified type.EnumerationManager
getEnumerationManager()
Deprecated.since agesEnumerationMetaTypeModel
getEnumerationType(java.lang.String code)
Deprecated.since agesEnumerationMetaTypeModel
getEnumerationTypeForCode(java.lang.String code)
Gets the enumeration type for code.EnumerationValueModel
getEnumerationValue(HybrisEnumValue plainEnum)
Converts a plain enum value into its underlying model.EnumerationValueModel
getEnumerationValue(java.lang.String type, java.lang.String code)
Returns a specific enumeration value.java.util.Set<AttributeDescriptorModel>
getInitialAttributeDescriptorsForType(ComposedTypeModel composedTypeModel)
Returns all attribute descriptors of this type which are marked as being initial.java.util.Set<java.lang.String>
getMandatoryAttributes(java.lang.String type, boolean forCreation)
Provides all mandatory attributes required to save models of the specified type.<T extends ItemModel>
java.lang.Class<T>getModelClass(ComposedTypeModel type)
Returns model class for a type.<T extends ItemModel>
java.lang.Class<T>getModelClass(java.lang.String typeCode)
Returns model class for a type code.java.util.Set<java.lang.String>
getPartOfAttributes(java.lang.String composedTypeCode)
Provides all attribute qualifiers marked as part-of within the given type.TypeModel
getType(java.lang.String typeCode)
Deprecated.since agesTypeDao
getTypeDao()
TypeModel
getTypeForCode(java.lang.String code)
Returns a specific type.java.util.Set<java.lang.String>
getUniqueAttributes(java.lang.String type)
Provides all attributes marked as unique within the given type.java.lang.String
getUniqueModelRootType(java.lang.String composedTypeCode)
This method finds for the givencomposedtypecode
the root ComposedType which contains/declares the same unique attributes as the given ComposedType.boolean
hasAttribute(ComposedTypeModel type, java.lang.String qualifier)
Checks if type has attribute.boolean
isAssignableFrom(TypeModel target, TypeModel source)
boolean
isAssignableFrom(java.lang.String superModelTypeCode, java.lang.String subModelTypeCode)
Returnstrue
if the model type, given by the parametersuperModelTypeCode
, is a super type of the type of the model OR the same type as the type of the model, given by the parametersubModelTypeCode
.boolean
isInstance(TypeModel typemodel, java.lang.Object obj)
Tests if the given object is an item instance of Type type.void
setConverterRegistry(ConverterRegistry converterRegistry)
void
setEnumerationManager(EnumerationManager enumerationManager)
void
setTypeDao(TypeDao typeDao)
-
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
-
getAtomicType
@Deprecated public AtomicTypeModel getAtomicType(java.lang.String typeCode)
Deprecated.since agesDescription copied from interface:TypeService
Returns a specific atomic type.- Specified by:
getAtomicType
in interfaceTypeService
- Parameters:
typeCode
- the unique code of this type
-
getAtomicTypeForCode
public AtomicTypeModel getAtomicTypeForCode(java.lang.String code)
Description copied from interface:TypeService
Gets the atomic type for code.- Specified by:
getAtomicTypeForCode
in interfaceTypeService
- Parameters:
code
- the code- Returns:
- the atomic type for code
-
getAtomicTypeForJavaClass
public AtomicTypeModel getAtomicTypeForJavaClass(java.lang.Class javaClass)
Description copied from interface:TypeService
Returns the atomic type for java class.- Specified by:
getAtomicTypeForJavaClass
in interfaceTypeService
- Parameters:
javaClass
- the java class that we are looking atomic type for- Returns:
- the atomic type for java class
-
getComposedType
@Deprecated public ComposedTypeModel getComposedType(java.lang.String typeCode)
Deprecated.since agesDescription copied from interface:TypeService
Returns a specific composed type.- Specified by:
getComposedType
in interfaceTypeService
- Parameters:
typeCode
- the unique code of this type
-
getComposedTypeForCode
public ComposedTypeModel getComposedTypeForCode(java.lang.String code)
Description copied from interface:TypeService
Returns the specific composed type for code.- Specified by:
getComposedTypeForCode
in interfaceTypeService
- Parameters:
code
- the unique code of this type code- Returns:
- the composed type for the specified code
-
getComposedType
@Deprecated public ComposedTypeModel getComposedType(java.lang.Class modelClass)
Deprecated.since agesDescription copied from interface:TypeService
Returns the composed type for a specified model class.- Specified by:
getComposedType
in interfaceTypeService
- Parameters:
modelClass
- the model class
-
getComposedTypeForClass
public ComposedTypeModel getComposedTypeForClass(java.lang.Class modelClass)
Description copied from interface:TypeService
Returns the specific composed type for the model class.- Specified by:
getComposedTypeForClass
in interfaceTypeService
- Parameters:
modelClass
- the model class we are looking composed type for- Returns:
- the composed type for class
-
getType
@Deprecated public TypeModel getType(java.lang.String typeCode)
Deprecated.since agesDescription copied from interface:TypeService
Returns a specific type. This includes composed, atomic, collection and map types.- Specified by:
getType
in interfaceTypeService
- Parameters:
typeCode
- the unique code of this type
-
getTypeForCode
public TypeModel getTypeForCode(java.lang.String code)
Description copied from interface:TypeService
Returns a specific type. This includes composed, atomic, collection and map types.- Specified by:
getTypeForCode
in interfaceTypeService
- Parameters:
code
- the code for the required type- Returns:
- the type for code
-
getAttributeDescriptor
public AttributeDescriptorModel getAttributeDescriptor(ComposedTypeModel composedType, java.lang.String qualifier)
Description copied from interface:TypeService
Returns a specific attribute descriptor for a given composed type. This includes declared and inherited attributes.- Specified by:
getAttributeDescriptor
in interfaceTypeService
- Parameters:
composedType
- the composed type to get attribute descriptor forqualifier
- the attribute qualifier
-
getAttributeDescriptor
public AttributeDescriptorModel getAttributeDescriptor(java.lang.String composedType, java.lang.String qualifier)
Description copied from interface:TypeService
Returns a specific attribute descriptor for a given composed type. This includes declared and inherited attributes.- Specified by:
getAttributeDescriptor
in interfaceTypeService
- Parameters:
composedType
- the code of the composed type to get attribute descriptor forqualifier
- the attribute qualifier
-
getAttributeDescriptors
@Deprecated public java.util.Set<AttributeDescriptorModel> getAttributeDescriptors(ComposedTypeModel composedType)
Deprecated.since agesDescription copied from interface:TypeService
Returns all attribute descriptors of a single composed type. This includes declared and inherited ones.- Specified by:
getAttributeDescriptors
in interfaceTypeService
- Parameters:
composedType
- the composed type to get attribute descriptors from
-
getAttributeDescriptorsForType
public java.util.Set<AttributeDescriptorModel> getAttributeDescriptorsForType(ComposedTypeModel composedType)
!!Note!! this service is not returning VariantAttributeDescriptors if there are any.- Specified by:
getAttributeDescriptorsForType
in interfaceTypeService
- Parameters:
composedType
- the composed type- Returns:
- the attribute descriptors for type
-
getAttributeDescriptors
@Deprecated public java.util.Set<AttributeDescriptorModel> getAttributeDescriptors(java.lang.String composedTypeCode)
Deprecated.since agesDescription copied from interface:TypeService
Returns all attribute descriptors (asAttributeDescriptorModel
) of a single composed type. This includes declared and inherited ones. This also includes attributes which are not generated in the model layer.- Specified by:
getAttributeDescriptors
in interfaceTypeService
- Parameters:
composedTypeCode
- the code of the composed type to get attribute descriptors from
-
getInitialAttributeDescriptorsForType
public java.util.Set<AttributeDescriptorModel> getInitialAttributeDescriptorsForType(ComposedTypeModel composedTypeModel)
Description copied from interface:TypeService
Returns all attribute descriptors of this type which are marked as being initial.Initial attributes are normally non-writable attributes intended to be set during item creation only. Therefore having initial and writable attributed does not make much sense.
- Specified by:
getInitialAttributeDescriptorsForType
in interfaceTypeService
- Parameters:
composedTypeModel
- the composed type model we look initial attribute descriptors for- Returns:
- the initial attribute descriptors for the given model
-
getEnumerationType
@Deprecated public EnumerationMetaTypeModel getEnumerationType(java.lang.String code)
Deprecated.since agesDescription copied from interface:TypeService
Returns a specific enumeration type.- Specified by:
getEnumerationType
in interfaceTypeService
- Parameters:
code
- the unique code of this type
-
getEnumerationTypeForCode
public EnumerationMetaTypeModel getEnumerationTypeForCode(java.lang.String code)
Description copied from interface:TypeService
Gets the enumeration type for code.- Specified by:
getEnumerationTypeForCode
in interfaceTypeService
- Parameters:
code
- the code for the required type- Returns:
- the enumeration type for code
-
getEnumerationValue
public EnumerationValueModel getEnumerationValue(java.lang.String type, java.lang.String code)
Description copied from interface:TypeService
Returns a specific enumeration value.- Specified by:
getEnumerationValue
in interfaceTypeService
- Parameters:
type
- the enumeration type codecode
- the value code
-
getEnumerationValue
public EnumerationValueModel getEnumerationValue(HybrisEnumValue plainEnum)
Description copied from interface:TypeService
Converts a plain enum value into its underlying model.- Specified by:
getEnumerationValue
in interfaceTypeService
- Parameters:
plainEnum
- the enum constant
-
getMandatoryAttributes
public java.util.Set<java.lang.String> getMandatoryAttributes(java.lang.String type, boolean forCreation)
Description copied from interface:TypeService
Provides all mandatory attributes required to save models of the specified type. If the model is new (creation) this method will return initial attributes but omit attributes providing default values. Otherwise initial attributes are omitted but all other mandatory ones are returned no matter if they've got default values or not.- Specified by:
getMandatoryAttributes
in interfaceTypeService
- Parameters:
type
- the type to get attributes forforCreation
- creation or update
-
getUniqueAttributes
public java.util.Set<java.lang.String> getUniqueAttributes(java.lang.String type)
Description copied from interface:TypeService
Provides all attributes marked as unique within the given type.- Specified by:
getUniqueAttributes
in interfaceTypeService
- Parameters:
type
- the type to get unique attributes for- Returns:
- an empty set if type has no unique attributes
-
getUniqueModelRootType
public java.lang.String getUniqueModelRootType(java.lang.String composedTypeCode)
Description copied from interface:TypeService
This method finds for the givencomposedtypecode
the root ComposedType which contains/declares the same unique attributes as the given ComposedType. This could be the same typecode or a typecode of any supertype of this ComposedType. The result is returned as typecode String.- Specified by:
getUniqueModelRootType
in interfaceTypeService
- Parameters:
composedTypeCode
- any composed type code of the platform- Returns:
null
if the given ComposedType contains no unique attributes.
-
getDefaultValues
public java.util.Map<java.lang.String,java.lang.Object> getDefaultValues(java.lang.String type)
Description copied from interface:TypeService
Fetches all configured default values for a specified type.- Specified by:
getDefaultValues
in interfaceTypeService
- Parameters:
type
- the type to get default values for- Returns:
- a map containing all attributes and their default values which have got a configured value
-
getDefaultValues
public java.util.Map<java.lang.String,java.lang.Object> getDefaultValues(java.lang.String type, java.util.Collection<java.lang.String> attributes)
Description copied from interface:TypeService
Fetches a subset of all configured default values for a specified type.- Specified by:
getDefaultValues
in interfaceTypeService
- Parameters:
type
- the type to get default values forattributes
- the attributes to consider- Returns:
- a map containing all attributes and their default values which have got a configured value
-
isAssignableFrom
public boolean isAssignableFrom(TypeModel target, TypeModel source)
Description copied from interface:TypeService
Returnstrue
if theTypeModel
, given by the parametersuperModelType
, is a super type of theTypeModel
OR the same type as theTypeModel
, given by the parametersubModelTypeCode
.- Specified by:
isAssignableFrom
in interfaceTypeService
- Returns:
true
if source type can be assigned to target type
-
isInstance
public boolean isInstance(TypeModel typemodel, java.lang.Object obj)
Description copied from interface:TypeService
Tests if the given object is an item instance of Type type.- Specified by:
isInstance
in interfaceTypeService
- Returns:
true
if given object is an item instance of Type type
-
isAssignableFrom
public boolean isAssignableFrom(java.lang.String superModelTypeCode, java.lang.String subModelTypeCode)
Description copied from interface:TypeService
Returnstrue
if the model type, given by the parametersuperModelTypeCode
, is a super type of the type of the model OR the same type as the type of the model, given by the parametersubModelTypeCode
.- Specified by:
isAssignableFrom
in interfaceTypeService
- Parameters:
superModelTypeCode
- - the type code (TypeModel
) of the super typesubModelTypeCode
- - the type code (TypeModel
) of the sub type- Returns:
false
if the sub model type is not addignable from the super model type or if any parameter isnull
-
getPartOfAttributes
public java.util.Set<java.lang.String> getPartOfAttributes(java.lang.String composedTypeCode)
Description copied from interface:TypeService
Provides all attribute qualifiers marked as part-of within the given type.- Specified by:
getPartOfAttributes
in interfaceTypeService
- Parameters:
composedTypeCode
- the composedType code to get part-of attributes for- Returns:
- an empty set if type has no part-of attributes
-
setConverterRegistry
public void setConverterRegistry(ConverterRegistry converterRegistry)
-
getTypeDao
public TypeDao getTypeDao()
-
setTypeDao
public void setTypeDao(TypeDao typeDao)
-
getEnumerationManager
@Deprecated public EnumerationManager getEnumerationManager()
Deprecated.since ages
-
setEnumerationManager
public void setEnumerationManager(EnumerationManager enumerationManager)
-
hasAttribute
public boolean hasAttribute(ComposedTypeModel type, java.lang.String qualifier)
Description copied from interface:TypeService
Checks if type has attribute.- Specified by:
hasAttribute
in interfaceTypeService
- Parameters:
type
- typequalifier
- qualifier to check- Returns:
- true if type has attribute
-
getModelClass
public <T extends ItemModel> java.lang.Class<T> getModelClass(ComposedTypeModel type)
Description copied from interface:TypeService
Returns model class for a type.- Specified by:
getModelClass
in interfaceTypeService
- Parameters:
type
- type- Returns:
- model class for a given type
-
getModelClass
public <T extends ItemModel> java.lang.Class<T> getModelClass(java.lang.String typeCode)
Description copied from interface:TypeService
Returns model class for a type code.- Specified by:
getModelClass
in interfaceTypeService
- Parameters:
typeCode
- code of a type- Returns:
- model class for a given type code
-
getAttributesForModifiers
public java.util.Set<AttributeDescriptorModel> getAttributesForModifiers(java.lang.String composedTypeCode, AttributeModifierCriteria criteria)
Description copied from interface:TypeService
Gets the attributes for modifiers for given composed type and criteria container. To add proper criterias to the argument use constants in the classAttributeModifiers
.- Specified by:
getAttributesForModifiers
in interfaceTypeService
- Parameters:
composedTypeCode
- the composed type codecriteria
- the criteria- Returns:
- the attributes for modifiers
-
-