Interface TypeService
- All Known Implementing Classes:
DefaultTypeService
public interface TypeService
Service covering type system of the platform. Provides a methods to access
TypeModel, DescriptorModel
and related objects.- Since:
- 4.0
- Spring Bean ID:
- typeService
-
Method Summary
Modifier and TypeMethodDescriptiongetAtomicType(String code) Deprecated, for removal: This API element is subject to removal in a future version.getAtomicTypeForCode(String code) Gets the atomic type for code.getAtomicTypeForJavaClass(Class javaClass) Returns the atomic type for java class.getAttributeDescriptor(ComposedTypeModel composedType, String qualifier) Returns a specific attribute descriptor for a given composed type.getAttributeDescriptor(String composedTypeCode, String qualifier) Returns a specific attribute descriptor for a given composed type.getAttributeDescriptors(ComposedTypeModel composedType) Deprecated, for removal: This API element is subject to removal in a future version.since ages - - usegetAttributeDescriptorsForType(ComposedTypeModel)instead.getAttributeDescriptors(String composedTypeCode) Deprecated, for removal: This API element is subject to removal in a future version.since ages - usegetAttributeDescriptorsForType(ComposedTypeModel)instead.getAttributeDescriptorsForType(ComposedTypeModel composedType) Gets the attribute descriptors for type.getAttributesForModifiers(String composedTypeCode, AttributeModifierCriteria criteria) Gets the attributes for modifiers for given composed type and criteria container.getComposedType(Class modelClass) Deprecated, for removal: This API element is subject to removal in a future version.since ages - usegetComposedTypeForClass(Class)instead.getComposedType(String code) Deprecated, for removal: This API element is subject to removal in a future version.since ages - usegetComposedTypeForCode(String)instead.getComposedTypeForClass(Class modelClass) Returns the specific composed type for the model class.getComposedTypeForCode(String code) Returns the specific composed type for code.getDefaultValues(String type) Fetches all configured default values for a specified type.getDefaultValues(String type, Collection<String> attributes) Fetches a subset of all configured default values for a specified type.getEnumerationType(String code) Deprecated, for removal: This API element is subject to removal in a future version.since ages - usegetEnumerationTypeForCode(String)instead.Gets the enumeration type for code.getEnumerationValue(HybrisEnumValue plainEnum) Converts a plain enum value into its underlying model.getEnumerationValue(String type, String code) Returns a specific enumeration value.getInitialAttributeDescriptorsForType(ComposedTypeModel composedTypeModel) Returns all attribute descriptors of this type which are marked as being initial.getMandatoryAttributes(String type, boolean forCreation) Provides all mandatory attributes required to save models of the specified type.Returns model class for a type.getModelClass(String typeCode) Returns model class for a type code.getPartOfAttributes(String composedTypeCode) Provides all attribute qualifiers marked as part-of within the given type.default Collection<AttributeDescriptorModel>getRuntimeAttributeDescriptorsForType(ComposedTypeModel composedType) Gets all runtime attributes for a type.Deprecated, for removal: This API element is subject to removal in a future version.since ages - usegetTypeForCode(String)instead.getTypeForCode(String code) Returns a specific type.getUniqueAttributes(String type) Provides all attributes marked as unique within the given type.getUniqueModelRootType(String composedtypecode) This method finds for the givencomposedtypecodethe root ComposedType which contains/declares the same unique attributes as the given ComposedType.booleanhasAttribute(ComposedTypeModel type, String qualifier) Checks if type has attribute.booleanisAssignableFrom(TypeModel superModelType, TypeModel subModelType) booleanisAssignableFrom(String superModelTypeCode, 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 type, Object obj) Tests if the given object is an item instance of Type type.default BooleanisRuntimeAttribute(AttributeDescriptorModel attributeDescriptorModel) Checks if the attribute descriptor is a runtime one.
-
Method Details
-
getComposedType
Deprecated, for removal: This API element is subject to removal in a future version.since ages - usegetComposedTypeForCode(String)instead.Returns a specific composed type.- Parameters:
code- the unique code of this type- Throws:
UnknownIdentifierException- if no type exist for this code
-
getComposedTypeForCode
Returns the specific composed type for code.- Parameters:
code- the unique code of this type code- Returns:
- the composed type for the specified code
- Throws:
IllegalArgumentException- thrown when given code is nullAmbiguousIdentifierException- the ambiguous identifier exception when more than one composed type for given code is foundUnknownIdentifierException- the unknown identifier exception when no composed type for given code is found
-
getComposedType
Deprecated, for removal: This API element is subject to removal in a future version.since ages - usegetComposedTypeForClass(Class)instead.Returns the composed type for a specified model class.- Parameters:
modelClass- the model class- Throws:
IllegalArgumentException- if no type is mapped to this model
-
getComposedTypeForClass
Returns the specific composed type for the model class.- Parameters:
modelClass- the model class we are looking composed type for- Returns:
- the composed type for class
- Throws:
IllegalArgumentException- thrown when given modelClass is nullUnknownIdentifierException- the unknown identifier exception when no composed type for given modelClass is found
-
getAttributeDescriptor
Returns a specific attribute descriptor for a given composed type. This includes declared and inherited attributes.- Parameters:
composedType- the composed type to get attribute descriptor forqualifier- the attribute qualifier- Throws:
UnknownIdentifierException- if the composed type does not own a matching attribute
-
getAttributeDescriptor
Returns a specific attribute descriptor for a given composed type. This includes declared and inherited attributes.- Parameters:
composedTypeCode- the code of the composed type to get attribute descriptor forqualifier- the attribute qualifier- Throws:
UnknownIdentifierException- if the composed type does not own a matching attribute
-
getAttributeDescriptors
@Deprecated(since="ages", forRemoval=true) Set<AttributeDescriptorModel> getAttributeDescriptors(ComposedTypeModel composedType) Deprecated, for removal: This API element is subject to removal in a future version.since ages - - usegetAttributeDescriptorsForType(ComposedTypeModel)instead.Returns all attribute descriptors of a single composed type. This includes declared and inherited ones.- Parameters:
composedType- the composed type to get attribute descriptors from
-
getAttributeDescriptorsForType
Gets the attribute descriptors for type.- Parameters:
composedType- the composed type- Returns:
- the attribute descriptors for type
- Throws:
IllegalArgumentException- thrown when given type is null
-
getAttributeDescriptors
@Deprecated(since="ages", forRemoval=true) Set<AttributeDescriptorModel> getAttributeDescriptors(String composedTypeCode) Deprecated, for removal: This API element is subject to removal in a future version.since ages - usegetAttributeDescriptorsForType(ComposedTypeModel)instead.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.- Parameters:
composedTypeCode- the code of the composed type to get attribute descriptors from- Throws:
UnknownIdentifierException- if no matching composed type exists
-
getInitialAttributeDescriptorsForType
Set<AttributeDescriptorModel> getInitialAttributeDescriptorsForType(ComposedTypeModel composedTypeModel) 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.
- Parameters:
composedTypeModel- the composed type model we look initial attribute descriptors for- Returns:
- the initial attribute descriptors for the given model
-
getAtomicType
Deprecated, for removal: This API element is subject to removal in a future version.since ages - usegetAtomicTypeForCode(String)instead.Returns a specific atomic type.- Parameters:
code- the unique code of this type- Throws:
UnknownIdentifierException- if no type exist for this code
-
getAtomicTypeForCode
Gets the atomic type for code.- Parameters:
code- the code- Returns:
- the atomic type for code
- Throws:
IllegalArgumentException- thrown when given code is nullUnknownIdentifierException- if no type exist for this code
-
getAtomicTypeForJavaClass
Returns the atomic type for java class.- Parameters:
javaClass- the java class that we are looking atomic type for- Returns:
- the atomic type for java class
- Throws:
IllegalArgumentException- thrown when given class is nullUnknownIdentifierException- if no type exist for this class
-
getType
Deprecated, for removal: This API element is subject to removal in a future version.since ages - usegetTypeForCode(String)instead.Returns a specific type. This includes composed, atomic, collection and map types.- Parameters:
code- the unique code of this type- Throws:
UnknownIdentifierException- if no type exist for this code
-
getTypeForCode
Returns a specific type. This includes composed, atomic, collection and map types.- Parameters:
code- the code for the required type- Returns:
- the type for code
- Throws:
UnknownIdentifierException- if no type exist for this codeIllegalArgumentException- thrown when given code is null
-
getEnumerationType
Deprecated, for removal: This API element is subject to removal in a future version.since ages - usegetEnumerationTypeForCode(String)instead.Returns a specific enumeration type.- Parameters:
code- the unique code of this type- Throws:
UnknownIdentifierException- if no type exist for this code
-
getEnumerationTypeForCode
Gets the enumeration type for code.- Parameters:
code- the code for the required type- Returns:
- the enumeration type for code
- Throws:
UnknownIdentifierException- if no type exist for this codeIllegalArgumentException- thrown when given code is null
-
getEnumerationValue
Returns a specific enumeration value.- Parameters:
type- the enumeration type codecode- the value code- Throws:
UnknownIdentifierException- if either no matching enumeration type exists or no value with matching codeIllegalArgumentException- thrown when given type or code is null
-
getEnumerationValue
Converts a plain enum value into its underlying model.- Parameters:
plainEnum- the enum constant- Throws:
IllegalArgumentException- thrown when given enum is null
-
getMandatoryAttributes
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.- Parameters:
type- the type to get attributes forforCreation- creation or update
-
getUniqueAttributes
Provides all attributes marked as unique within the given type.- Parameters:
type- the type to get unique attributes for- Returns:
- an empty set if type has no unique attributes
-
getUniqueModelRootType
This 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.- Parameters:
composedtypecode- any composed type code of the platform- Returns:
nullif the given ComposedType contains no unique attributes.- Throws:
IllegalArgumentException- if no such ComposedType by the given typecode exists
-
getDefaultValues
Fetches all configured default values for a specified type.- 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
Fetches a subset of all configured default values for a specified type.- 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
Returnstrueif theTypeModel, given by the parametersuperModelType, is a super type of theTypeModelOR the same type as theTypeModel, given by the parametersubModelTypeCode.- Parameters:
superModelType-subModelType-- Returns:
trueif source type can be assigned to target type
-
isAssignableFrom
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. -
isInstance
Tests if the given object is an item instance of Type type.- Parameters:
type-obj-- Returns:
trueif given object is an item instance of Type type
-
getPartOfAttributes
Provides all attribute qualifiers marked as part-of within the given type.- Parameters:
composedTypeCode- the composedType code to get part-of attributes for- Returns:
- an empty set if type has no part-of attributes
-
hasAttribute
Checks if type has attribute.- Parameters:
type- typequalifier- qualifier to check- Returns:
- true if type has attribute
-
getModelClass
Returns model class for a type.- Parameters:
type- type- Returns:
- model class for a given type
-
getModelClass
Returns model class for a type code.- Parameters:
typeCode- code of a type- Returns:
- model class for a given type code
-
getAttributesForModifiers
Set<AttributeDescriptorModel> getAttributesForModifiers(String composedTypeCode, AttributeModifierCriteria criteria) Gets the attributes for modifiers for given composed type and criteria container. To add proper criterias to the argument use constants in the classAttributeModifiers.- Parameters:
composedTypeCode- the composed type codecriteria- the criteria- Returns:
- the attributes for modifiers
-
getRuntimeAttributeDescriptorsForType
default Collection<AttributeDescriptorModel> getRuntimeAttributeDescriptorsForType(ComposedTypeModel composedType) Gets all runtime attributes for a type. A runtime attribute was created from a code and does not have a definition in the *item.xml.- Parameters:
composedType- the composed type model model- Returns:
- runtime attributes
-
isRuntimeAttribute
Checks if the attribute descriptor is a runtime one. A runtime attribute was created from a code and does not have a definition in the *item.xml. For attributes marked as dontoptimize it returns false.- Parameters:
attributeDescriptorModel- the attribute descriptor model- Returns:
- true is the attribute is runtime
-
getAtomicTypeForCode(String)instead.