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 AtomicTypeModelgetAtomicType(java.lang.String typeCode)Deprecated.since agesAtomicTypeModelgetAtomicTypeForCode(java.lang.String code)Gets the atomic type for code.AtomicTypeModelgetAtomicTypeForJavaClass(java.lang.Class javaClass)Returns the atomic type for java class.AttributeDescriptorModelgetAttributeDescriptor(ComposedTypeModel composedType, java.lang.String qualifier)Returns a specific attribute descriptor for a given composed type.AttributeDescriptorModelgetAttributeDescriptor(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.ComposedTypeModelgetComposedType(java.lang.Class modelClass)Deprecated.since agesComposedTypeModelgetComposedType(java.lang.String typeCode)Deprecated.since agesComposedTypeModelgetComposedTypeForClass(java.lang.Class modelClass)Returns the specific composed type for the model class.ComposedTypeModelgetComposedTypeForCode(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.EnumerationManagergetEnumerationManager()Deprecated.since agesEnumerationMetaTypeModelgetEnumerationType(java.lang.String code)Deprecated.since agesEnumerationMetaTypeModelgetEnumerationTypeForCode(java.lang.String code)Gets the enumeration type for code.EnumerationValueModelgetEnumerationValue(HybrisEnumValue plainEnum)Converts a plain enum value into its underlying model.EnumerationValueModelgetEnumerationValue(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.TypeModelgetType(java.lang.String typeCode)Deprecated.since agesTypeDaogetTypeDao()TypeModelgetTypeForCode(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.StringgetUniqueModelRootType(java.lang.String composedTypeCode)This method finds for the givencomposedtypecodethe root ComposedType which contains/declares the same unique attributes as the given ComposedType.booleanhasAttribute(ComposedTypeModel type, java.lang.String qualifier)Checks if type has attribute.booleanisAssignableFrom(TypeModel target, TypeModel source)booleanisAssignableFrom(java.lang.String superModelTypeCode, java.lang.String subModelTypeCode)Returnstrueif 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.booleanisInstance(TypeModel typemodel, java.lang.Object obj)Tests if the given object is an item instance of Type type.voidsetConverterRegistry(ConverterRegistry converterRegistry)voidsetEnumerationManager(EnumerationManager enumerationManager)voidsetTypeDao(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:TypeServiceReturns a specific atomic type.- Specified by:
getAtomicTypein interfaceTypeService- Parameters:
typeCode- the unique code of this type
-
getAtomicTypeForCode
public AtomicTypeModel getAtomicTypeForCode(java.lang.String code)
Description copied from interface:TypeServiceGets the atomic type for code.- Specified by:
getAtomicTypeForCodein interfaceTypeService- Parameters:
code- the code- Returns:
- the atomic type for code
-
getAtomicTypeForJavaClass
public AtomicTypeModel getAtomicTypeForJavaClass(java.lang.Class javaClass)
Description copied from interface:TypeServiceReturns the atomic type for java class.- Specified by:
getAtomicTypeForJavaClassin 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:TypeServiceReturns a specific composed type.- Specified by:
getComposedTypein interfaceTypeService- Parameters:
typeCode- the unique code of this type
-
getComposedTypeForCode
public ComposedTypeModel getComposedTypeForCode(java.lang.String code)
Description copied from interface:TypeServiceReturns the specific composed type for code.- Specified by:
getComposedTypeForCodein 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:TypeServiceReturns the composed type for a specified model class.- Specified by:
getComposedTypein interfaceTypeService- Parameters:
modelClass- the model class
-
getComposedTypeForClass
public ComposedTypeModel getComposedTypeForClass(java.lang.Class modelClass)
Description copied from interface:TypeServiceReturns the specific composed type for the model class.- Specified by:
getComposedTypeForClassin 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:TypeServiceReturns a specific type. This includes composed, atomic, collection and map types.- Specified by:
getTypein interfaceTypeService- Parameters:
typeCode- the unique code of this type
-
getTypeForCode
public TypeModel getTypeForCode(java.lang.String code)
Description copied from interface:TypeServiceReturns a specific type. This includes composed, atomic, collection and map types.- Specified by:
getTypeForCodein 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:TypeServiceReturns a specific attribute descriptor for a given composed type. This includes declared and inherited attributes.- Specified by:
getAttributeDescriptorin 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:TypeServiceReturns a specific attribute descriptor for a given composed type. This includes declared and inherited attributes.- Specified by:
getAttributeDescriptorin 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:TypeServiceReturns all attribute descriptors of a single composed type. This includes declared and inherited ones.- Specified by:
getAttributeDescriptorsin 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:
getAttributeDescriptorsForTypein 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:TypeServiceReturns 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:
getAttributeDescriptorsin 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:TypeServiceReturns 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:
getInitialAttributeDescriptorsForTypein 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:TypeServiceReturns a specific enumeration type.- Specified by:
getEnumerationTypein interfaceTypeService- Parameters:
code- the unique code of this type
-
getEnumerationTypeForCode
public EnumerationMetaTypeModel getEnumerationTypeForCode(java.lang.String code)
Description copied from interface:TypeServiceGets the enumeration type for code.- Specified by:
getEnumerationTypeForCodein 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:TypeServiceReturns a specific enumeration value.- Specified by:
getEnumerationValuein interfaceTypeService- Parameters:
type- the enumeration type codecode- the value code
-
getEnumerationValue
public EnumerationValueModel getEnumerationValue(HybrisEnumValue plainEnum)
Description copied from interface:TypeServiceConverts a plain enum value into its underlying model.- Specified by:
getEnumerationValuein 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:TypeServiceProvides 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:
getMandatoryAttributesin 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:TypeServiceProvides all attributes marked as unique within the given type.- Specified by:
getUniqueAttributesin 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:TypeServiceThis method finds for the givencomposedtypecodethe 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:
getUniqueModelRootTypein interfaceTypeService- Parameters:
composedTypeCode- any composed type code of the platform- Returns:
nullif 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:TypeServiceFetches all configured default values for a specified type.- Specified by:
getDefaultValuesin 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:TypeServiceFetches a subset of all configured default values for a specified type.- Specified by:
getDefaultValuesin 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:TypeServiceReturnstrueif theTypeModel, given by the parametersuperModelType, is a super type of theTypeModelOR the same type as theTypeModel, given by the parametersubModelTypeCode.- Specified by:
isAssignableFromin interfaceTypeService- Returns:
trueif source type can be assigned to target type
-
isInstance
public boolean isInstance(TypeModel typemodel, java.lang.Object obj)
Description copied from interface:TypeServiceTests if the given object is an item instance of Type type.- Specified by:
isInstancein interfaceTypeService- Returns:
trueif 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:TypeServiceReturnstrueif 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:
isAssignableFromin interfaceTypeService- Parameters:
superModelTypeCode- - the type code (TypeModel) of the super typesubModelTypeCode- - the type code (TypeModel) of the sub type- Returns:
falseif 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:TypeServiceProvides all attribute qualifiers marked as part-of within the given type.- Specified by:
getPartOfAttributesin 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:TypeServiceChecks if type has attribute.- Specified by:
hasAttributein 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:TypeServiceReturns model class for a type.- Specified by:
getModelClassin 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:TypeServiceReturns model class for a type code.- Specified by:
getModelClassin 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:TypeServiceGets 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:
getAttributesForModifiersin interfaceTypeService- Parameters:
composedTypeCode- the composed type codecriteria- the criteria- Returns:
- the attributes for modifiers
-
-