Class DefaultTypeService
- java.lang.Object
-
- de.hybris.platform.cockpit.services.meta.impl.DefaultTypeService
-
- All Implemented Interfaces:
TypeService
public class DefaultTypeService extends java.lang.Object implements TypeService
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
DefaultTypeService.MyClassificationType
protected class
DefaultTypeService.MyInvalidationListener
protected class
DefaultTypeService.MyItemType
protected class
DefaultTypeService.MyTypedObject
protected class
DefaultTypeService.MyWidgetType
-
Constructor Summary
Constructors Constructor Description DefaultTypeService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addBaseTypePropertyToCache(java.lang.String qualifier, PropertyDescriptor propDesc)
protected void
addToCache(ObjectType type)
boolean
checkItemAlive(TypedObject typedItem)
Check item alive.void
clear()
int
countAllInstancesOf(ObjectType type)
Count all instances of the given typejava.util.Collection<TypedObject>
getAllInstancesOf(ObjectType type)
Gets all instances of the given type.java.util.Collection<TypedObject>
getAllInstancesOf(ObjectType type, java.lang.String sortBy, java.lang.String sortOrder)
Gets all instances of the given type according to given sort criteria.java.util.Set<ObjectType>
getAllSubtypes(ObjectType type)
Gets the all subtypes.java.util.List<ObjectType>
getAllSupertypes(ObjectType type)
Gets the all supertypes.java.lang.String
getAttributeCodeFromPropertyQualifier(java.lang.String propertyQualifier)
Gets the attribute code from property qualifier.java.util.List<java.lang.Object>
getAvailableValues(PropertyDescriptor propertyDescriptor)
Gets the available values.java.util.List<java.lang.Object>
getAvailableValues(PropertyDescriptor propertyDescriptor, TypedObject object)
Gets the available values.BaseType
getBaseType(java.lang.String code)
Gets the base type.protected TypeCache
getBaseTypeCache()
protected BaseType
getBaseTypeCached(java.lang.String code)
protected PropertyCache
getBaseTypePropertyCache()
protected PropertyDescriptor
getBaseTypePropertyCached(java.lang.String qualifier)
ObjectTemplate
getBestTemplate(TypedObject object)
Gets the best template.protected java.lang.String
getDefaultEditorType(ClassAttributeAssignment caa)
protected java.lang.String
getDefaultEditorType(AttributeDescriptorModel attributeDescriptorModel)
protected java.lang.String
getDefaultEditorType(TypeModel type, boolean localized)
ExtendedType
getExtendedType(java.lang.String code)
Gets the extended type.protected TypeCache
getExtendedTypeCache()
protected ExtendedType
getExtendedTypeCached(java.lang.String code)
protected InvalidationListener
getItemInvalidationListener()
protected ModelService
getModelService()
ObjectTemplate
getObjectTemplate(java.lang.String code)
Gets the object template.protected TypeCache
getObjectTemplateCache()
protected ObjectTemplate
getObjectTemplateCached(java.lang.String code)
java.util.List<ObjectTemplate>
getObjectTemplates(BaseType type)
Gets the object templates.ObjectType
getObjectType(java.lang.String code)
Gets the object type.ObjectType
getObjectTypeFromPropertyQualifier(java.lang.String propertyQualifier)
Gets the object type from property qualifier.PropertyDescriptor
getPropertyDescriptor(ObjectType type, java.lang.String qualifier)
Gets the property descriptor.PropertyDescriptor
getPropertyDescriptor(java.lang.String propertyQualifier)
Gets the property descriptor.protected PropertyDescriptorCodeResolver
getPropertyDescriptorCodeResolver()
java.util.Collection<PropertyDescriptor>
getReverseSelectionOf(PropertyDescriptor descriptor)
returns the list of all property descriptors that the give property descriptor is "selectionOf"PropertyDescriptor
getSelectionOf(PropertyDescriptor descriptor)
returns the "selectionOf" property of the given property descriptorjava.lang.String
getTypeCodeFromPropertyQualifier(java.lang.String propertyQualifier)
The type (base or extended) part of the property qualifier.protected TypeService
getTypeService()
protected TypeModel
getValueType(PropertyDescriptor propertyDescriptor)
java.lang.String
getValueTypeCode(PropertyDescriptor propertyDescriptor)
Gets the value type code.void
init()
protected ClassificationType
loadClassificationType(java.lang.String code)
protected ObjectTemplate
loadItemTemplate(java.lang.String code)
protected ItemType
loadItemType(java.lang.String code)
protected WidgetType
loadWidgetType(java.lang.String code)
protected java.lang.String
resolveClassificationPropertyPath(java.lang.String code, java.lang.String classificationAttributeCode)
void
setBaseTypeCache(TypeCache typeCache)
void
setBaseTypePropertyCache(PropertyCache propCache)
void
setExtendedTypeCache(TypeCache typeCache)
void
setModelService(ModelService modelService)
void
setObjectTemplateCache(TypeCache typeCache)
void
setTypeService(TypeService typeService)
java.util.List<ItemModel>
unwrapItems(java.util.Collection<TypedObject> typedObjects)
Unwrap items to modelsTypedObject
wrapItem(java.lang.Object itemObject)
Wrap item.java.util.List<TypedObject>
wrapItems(java.util.Collection<? extends java.lang.Object> itemObjects)
Wrap items.
-
-
-
Method Detail
-
checkItemAlive
public boolean checkItemAlive(TypedObject typedItem)
Description copied from interface:TypeService
Check item alive.- Specified by:
checkItemAlive
in interfaceTypeService
- Parameters:
typedItem
- the typed item- Returns:
- true, if successful
-
countAllInstancesOf
public int countAllInstancesOf(ObjectType type)
Description copied from interface:TypeService
Count all instances of the given type- Specified by:
countAllInstancesOf
in interfaceTypeService
- Parameters:
type
- the type- Returns:
- the number of instances or -1 if there was an error
-
getAllInstancesOf
public java.util.Collection<TypedObject> getAllInstancesOf(ObjectType type)
Description copied from interface:TypeService
Gets all instances of the given type. Keep in mind that this can be very expensive, so useTypeService.countAllInstancesOf(ObjectType)
before calling this method- Specified by:
getAllInstancesOf
in interfaceTypeService
- Parameters:
type
- the type- Returns:
- the instances of the given type
-
getAllInstancesOf
public java.util.Collection<TypedObject> getAllInstancesOf(ObjectType type, java.lang.String sortBy, java.lang.String sortOrder)
Description copied from interface:TypeService
Gets all instances of the given type according to given sort criteria. Keep in mind that this can be very expensive, so useTypeService.countAllInstancesOf(ObjectType)
before calling this method- Specified by:
getAllInstancesOf
in interfaceTypeService
- Parameters:
type
- the typesortBy
- given sort propertysortOrder
- given sort order- Returns:
- the instances of the given type
-
clear
public void clear()
-
getAllSubtypes
public java.util.Set<ObjectType> getAllSubtypes(ObjectType type)
Description copied from interface:TypeService
Gets the all subtypes.- Specified by:
getAllSubtypes
in interfaceTypeService
- Parameters:
type
- the type- Returns:
- the all subtypes
-
getAllSupertypes
public java.util.List<ObjectType> getAllSupertypes(ObjectType type)
Description copied from interface:TypeService
Gets the all supertypes.- Specified by:
getAllSupertypes
in interfaceTypeService
- Parameters:
type
- the type- Returns:
- the all supertypes
-
getAttributeCodeFromPropertyQualifier
public java.lang.String getAttributeCodeFromPropertyQualifier(java.lang.String propertyQualifier)
Description copied from interface:TypeService
Gets the attribute code from property qualifier.- Specified by:
getAttributeCodeFromPropertyQualifier
in interfaceTypeService
- Parameters:
propertyQualifier
- the property qualifier- Returns:
- the attribute code from property qualifier
-
getAvailableValues
public java.util.List<java.lang.Object> getAvailableValues(PropertyDescriptor propertyDescriptor)
Description copied from interface:TypeService
Gets the available values.- Specified by:
getAvailableValues
in interfaceTypeService
- Parameters:
propertyDescriptor
- the property descriptor- Returns:
- the available values
-
getAvailableValues
public java.util.List<java.lang.Object> getAvailableValues(PropertyDescriptor propertyDescriptor, TypedObject object)
Description copied from interface:TypeService
Gets the available values.- Specified by:
getAvailableValues
in interfaceTypeService
- Parameters:
propertyDescriptor
- the property descriptor- Returns:
- the available values
-
getBaseType
public BaseType getBaseType(java.lang.String code)
Description copied from interface:TypeService
Gets the base type.- Specified by:
getBaseType
in interfaceTypeService
- Parameters:
code
- the code- Returns:
- the base type
-
getBestTemplate
public ObjectTemplate getBestTemplate(TypedObject object)
Description copied from interface:TypeService
Gets the best template.- Specified by:
getBestTemplate
in interfaceTypeService
- Parameters:
object
- the object- Returns:
- the best template
-
getExtendedType
public ExtendedType getExtendedType(java.lang.String code)
Description copied from interface:TypeService
Gets the extended type.- Specified by:
getExtendedType
in interfaceTypeService
- Parameters:
code
- the code- Returns:
- the extended type
-
getObjectTemplate
public ObjectTemplate getObjectTemplate(java.lang.String code)
Description copied from interface:TypeService
Gets the object template.- Specified by:
getObjectTemplate
in interfaceTypeService
- Parameters:
code
- the code- Returns:
- the object template
-
getObjectTemplates
public java.util.List<ObjectTemplate> getObjectTemplates(BaseType type)
Description copied from interface:TypeService
Gets the object templates.- Specified by:
getObjectTemplates
in interfaceTypeService
- Parameters:
type
- the type- Returns:
- the object templates
-
getObjectType
public ObjectType getObjectType(java.lang.String code)
Description copied from interface:TypeService
Gets the object type.- Specified by:
getObjectType
in interfaceTypeService
- Parameters:
code
- the code- Returns:
- the object type
-
getObjectTypeFromPropertyQualifier
public ObjectType getObjectTypeFromPropertyQualifier(java.lang.String propertyQualifier)
Description copied from interface:TypeService
Gets the object type from property qualifier.- Specified by:
getObjectTypeFromPropertyQualifier
in interfaceTypeService
- Parameters:
propertyQualifier
- the property qualifier- Returns:
- the object type from property qualifier
-
getPropertyDescriptor
public PropertyDescriptor getPropertyDescriptor(ObjectType type, java.lang.String qualifier)
Description copied from interface:TypeService
Gets the property descriptor.- Specified by:
getPropertyDescriptor
in interfaceTypeService
- Parameters:
type
- the typequalifier
- the qualifier- Returns:
- the property descriptor
-
getPropertyDescriptor
public PropertyDescriptor getPropertyDescriptor(java.lang.String propertyQualifier)
Description copied from interface:TypeService
Gets the property descriptor.- Specified by:
getPropertyDescriptor
in interfaceTypeService
- Parameters:
propertyQualifier
- the property qualifier- Returns:
- the property descriptor
-
getTypeCodeFromPropertyQualifier
public java.lang.String getTypeCodeFromPropertyQualifier(java.lang.String propertyQualifier)
Description copied from interface:TypeService
The type (base or extended) part of the property qualifier. (E.g. having qualifier "Product.code" this returns "Product".)- Specified by:
getTypeCodeFromPropertyQualifier
in interfaceTypeService
- Parameters:
propertyQualifier
- the property qualifier- Returns:
- the type code from property qualifier
-
getValueTypeCode
public java.lang.String getValueTypeCode(PropertyDescriptor propertyDescriptor)
Description copied from interface:TypeService
Gets the value type code.- Specified by:
getValueTypeCode
in interfaceTypeService
- Parameters:
propertyDescriptor
- the property descriptor- Returns:
- the value type code
-
init
public void init()
-
setBaseTypeCache
public void setBaseTypeCache(TypeCache typeCache)
-
setBaseTypePropertyCache
public void setBaseTypePropertyCache(PropertyCache propCache)
-
setExtendedTypeCache
public void setExtendedTypeCache(TypeCache typeCache)
-
setModelService
public void setModelService(ModelService modelService)
-
setObjectTemplateCache
public void setObjectTemplateCache(TypeCache typeCache)
-
setTypeService
public void setTypeService(TypeService typeService)
-
wrapItem
public TypedObject wrapItem(java.lang.Object itemObject)
Description copied from interface:TypeService
Wrap item.- Specified by:
wrapItem
in interfaceTypeService
- Parameters:
itemObject
- the item- Returns:
- the typed object
-
wrapItems
public java.util.List<TypedObject> wrapItems(java.util.Collection<? extends java.lang.Object> itemObjects)
Description copied from interface:TypeService
Wrap items.- Specified by:
wrapItems
in interfaceTypeService
- Parameters:
itemObjects
- the items- Returns:
- the list< typed object>
-
unwrapItems
public java.util.List<ItemModel> unwrapItems(java.util.Collection<TypedObject> typedObjects)
Description copied from interface:TypeService
Unwrap items to models- Specified by:
unwrapItems
in interfaceTypeService
- Returns:
- the list of ItemModel items
-
addToCache
protected void addToCache(ObjectType type)
-
getBaseTypeCache
protected TypeCache getBaseTypeCache()
-
getBaseTypeCached
protected BaseType getBaseTypeCached(java.lang.String code)
-
addBaseTypePropertyToCache
protected void addBaseTypePropertyToCache(java.lang.String qualifier, PropertyDescriptor propDesc)
-
getBaseTypePropertyCache
protected PropertyCache getBaseTypePropertyCache()
-
getBaseTypePropertyCached
protected PropertyDescriptor getBaseTypePropertyCached(java.lang.String qualifier)
-
getDefaultEditorType
protected java.lang.String getDefaultEditorType(AttributeDescriptorModel attributeDescriptorModel)
-
getDefaultEditorType
protected java.lang.String getDefaultEditorType(TypeModel type, boolean localized)
-
getDefaultEditorType
protected java.lang.String getDefaultEditorType(ClassAttributeAssignment caa)
-
getExtendedTypeCache
protected TypeCache getExtendedTypeCache()
-
getExtendedTypeCached
protected ExtendedType getExtendedTypeCached(java.lang.String code)
-
getItemInvalidationListener
protected InvalidationListener getItemInvalidationListener()
-
getModelService
protected ModelService getModelService()
-
getObjectTemplateCache
protected TypeCache getObjectTemplateCache()
-
getObjectTemplateCached
protected ObjectTemplate getObjectTemplateCached(java.lang.String code)
-
getTypeService
protected TypeService getTypeService()
-
getValueType
protected TypeModel getValueType(PropertyDescriptor propertyDescriptor)
-
loadClassificationType
protected ClassificationType loadClassificationType(java.lang.String code)
-
resolveClassificationPropertyPath
protected java.lang.String resolveClassificationPropertyPath(java.lang.String code, java.lang.String classificationAttributeCode)
-
loadWidgetType
protected WidgetType loadWidgetType(java.lang.String code)
-
loadItemTemplate
protected ObjectTemplate loadItemTemplate(java.lang.String code)
-
loadItemType
protected ItemType loadItemType(java.lang.String code)
-
getSelectionOf
public PropertyDescriptor getSelectionOf(PropertyDescriptor descriptor)
Description copied from interface:TypeService
returns the "selectionOf" property of the given property descriptor- Specified by:
getSelectionOf
in interfaceTypeService
- Parameters:
descriptor
- the source property descriptor- Returns:
- the "selectionOf" property of the given property descriptor
-
getReverseSelectionOf
public java.util.Collection<PropertyDescriptor> getReverseSelectionOf(PropertyDescriptor descriptor)
Description copied from interface:TypeService
returns the list of all property descriptors that the give property descriptor is "selectionOf"- Specified by:
getReverseSelectionOf
in interfaceTypeService
- Parameters:
descriptor
- the source property descriptor- Returns:
- the list of all property descriptors that the give property descriptor is "selectionOf"
-
getPropertyDescriptorCodeResolver
protected PropertyDescriptorCodeResolver getPropertyDescriptorCodeResolver()
-
-