Class ExtensibleTypeService
- java.lang.Object
-
- de.hybris.platform.cockpit.services.meta.impl.ExtensibleTypeService
-
- All Implemented Interfaces:
TypeService
public class ExtensibleTypeService extends java.lang.Object implements TypeService
Implementation ofTypeServicethat allows one to set anExtendedTypeLoaderto load extended types, which is usually a spring-configured instance ofDefaultExtendedTypeChain.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classExtensibleTypeService.MyInvalidationListenerprotected classExtensibleTypeService.MyItemTypeprotected classExtensibleTypeService.MyTypedObject
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>>usedInSelectionOf
-
Constructor Summary
Constructors Constructor Description ExtensibleTypeService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddBaseTypePropertyToCache(java.lang.String qualifier, PropertyDescriptor propDesc)protected voidaddToCache(ObjectType type)booleancheckItemAlive(TypedObject typedItem)Check item alive.voidclear()intcountAllInstancesOf(ObjectType type)Count all instances of the given typeprotected CockpitItemTemplateModelfetchItemTemplate(ComposedTypeModel composedType, java.lang.String templateCode)Deprecated.since 6.3java.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.protected java.util.Collection<TypedObject>getAllInstancesOf(java.lang.String typecode)java.util.Set<ObjectType>getAllSubtypes(ObjectType type)Gets the all subtypes.java.util.List<ObjectType>getAllSupertypes(ObjectType type)Gets the all supertypes.java.lang.StringgetAttributeCodeFromPropertyQualifier(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.BaseTypegetBaseType(java.lang.String code)Gets the base type.protected TypeCachegetBaseTypeCache()protected BaseTypegetBaseTypeCached(java.lang.String code)protected PropertyCachegetBaseTypePropertyCache()protected PropertyDescriptorgetBaseTypePropertyCached(java.lang.String qualifier)ObjectTemplategetBestTemplate(TypedObject object)Gets the best template.protected java.lang.StringgetDefaultEditorType(AttributeDescriptorModel attributeDescriptor)ExtendedTypegetExtendedType(java.lang.String code)Gets the extended type.protected ExtendedTypeLoadergetExtendedTypeChain()FlexibleSearchServicegetFlexibleSearchService()protected ModelServicegetModelService()ObjectTemplategetObjectTemplate(java.lang.String code)Gets the object template.protected TypeCachegetObjectTemplateCache()protected ObjectTemplategetObjectTemplateCached(java.lang.String code)java.util.List<ObjectTemplate>getObjectTemplates(BaseType type)Gets the object templates.ObjectTypegetObjectType(java.lang.String code)Gets the object type.ObjectTypegetObjectTypeFromPropertyQualifier(java.lang.String propertyQualifier)Gets the object type from property qualifier.PropertyDescriptorgetPropertyDescriptor(ObjectType type, java.lang.String qualifier)Gets the property descriptor.PropertyDescriptorgetPropertyDescriptor(java.lang.String propertyQualifier)Gets the property descriptor.protected PropertyServicegetPropertyService()java.util.Collection<PropertyDescriptor>getReverseSelectionOf(PropertyDescriptor descriptor)returns the list of all property descriptors that the give property descriptor is "selectionOf"PropertyDescriptorgetSelectionOf(PropertyDescriptor descriptor)returns the "selectionOf" property of the given property descriptorjava.lang.StringgetTypeCodeFromPropertyQualifier(java.lang.String propertyQualifier)The type (base or extended) part of the property qualifier.protected TypeServicegetTypeService()protected TypeModelgetValueType(PropertyDescriptor propertyDescriptor)java.lang.StringgetValueTypeCode(PropertyDescriptor propertyDescriptor)Gets the value type code.voidinit()protected ObjectTemplateloadItemTemplate(java.lang.String code)protected ItemTypeloadItemType(java.lang.String code)voidsetBaseTypeCache(TypeCache typeCache)voidsetBaseTypePropertyCache(PropertyCache propCache)voidsetExtendedTypeChain(ExtendedTypeLoader extendedTypeChain)voidsetFlexibleSearchService(FlexibleSearchService flexibleSearchService)voidsetModelService(ModelService modelService)voidsetObjectTemplateCache(TypeCache typeCache)voidsetPropertyService(PropertyService propertyService)voidsetTypeService(TypeService typeService)java.util.List<ItemModel>unwrapItems(java.util.Collection<TypedObject> typedObjects)Unwrap items to modelsTypedObjectwrapItem(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:TypeServiceCheck item alive.- Specified by:
checkItemAlivein interfaceTypeService- Parameters:
typedItem- the typed item- Returns:
- true, if successful
-
countAllInstancesOf
public int countAllInstancesOf(ObjectType type)
Description copied from interface:TypeServiceCount all instances of the given type- Specified by:
countAllInstancesOfin 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:TypeServiceGets 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:
getAllInstancesOfin interfaceTypeService- Parameters:
type- the type- Returns:
- the instances of the given type
-
getAllInstancesOf
protected java.util.Collection<TypedObject> getAllInstancesOf(java.lang.String typecode)
-
getAllInstancesOf
public java.util.Collection<TypedObject> getAllInstancesOf(ObjectType type, java.lang.String sortBy, java.lang.String sortOrder)
Description copied from interface:TypeServiceGets 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:
getAllInstancesOfin 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:TypeServiceGets the all subtypes.- Specified by:
getAllSubtypesin interfaceTypeService- Parameters:
type- the type- Returns:
- the all subtypes
-
getAllSupertypes
public java.util.List<ObjectType> getAllSupertypes(ObjectType type)
Description copied from interface:TypeServiceGets the all supertypes.- Specified by:
getAllSupertypesin interfaceTypeService- Parameters:
type- the type- Returns:
- the all supertypes
-
getAvailableValues
public java.util.List<java.lang.Object> getAvailableValues(PropertyDescriptor propertyDescriptor)
Description copied from interface:TypeServiceGets the available values.- Specified by:
getAvailableValuesin 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:TypeServiceGets the available values.- Specified by:
getAvailableValuesin interfaceTypeService- Parameters:
propertyDescriptor- the property descriptor- Returns:
- the available values
-
getBaseType
public BaseType getBaseType(java.lang.String code)
Description copied from interface:TypeServiceGets the base type.- Specified by:
getBaseTypein interfaceTypeService- Parameters:
code- the code- Returns:
- the base type
-
getBestTemplate
public ObjectTemplate getBestTemplate(TypedObject object)
Description copied from interface:TypeServiceGets the best template.- Specified by:
getBestTemplatein interfaceTypeService- Parameters:
object- the object- Returns:
- the best template
-
getExtendedType
public ExtendedType getExtendedType(java.lang.String code)
Description copied from interface:TypeServiceGets the extended type.- Specified by:
getExtendedTypein interfaceTypeService- Parameters:
code- the code- Returns:
- the extended type
-
getObjectTemplate
public ObjectTemplate getObjectTemplate(java.lang.String code)
Description copied from interface:TypeServiceGets the object template.- Specified by:
getObjectTemplatein interfaceTypeService- Parameters:
code- the code- Returns:
- the object template
-
getObjectTemplates
public java.util.List<ObjectTemplate> getObjectTemplates(BaseType type)
Description copied from interface:TypeServiceGets the object templates.- Specified by:
getObjectTemplatesin interfaceTypeService- Parameters:
type- the type- Returns:
- the object templates
-
getObjectType
public ObjectType getObjectType(java.lang.String code)
Description copied from interface:TypeServiceGets the object type.- Specified by:
getObjectTypein interfaceTypeService- Parameters:
code- the code- Returns:
- the object type
-
getObjectTypeFromPropertyQualifier
public ObjectType getObjectTypeFromPropertyQualifier(java.lang.String propertyQualifier)
Description copied from interface:TypeServiceGets the object type from property qualifier.- Specified by:
getObjectTypeFromPropertyQualifierin 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:TypeServiceGets the property descriptor.- Specified by:
getPropertyDescriptorin interfaceTypeService- Parameters:
type- the typequalifier- the qualifier- Returns:
- the property descriptor
-
getPropertyDescriptor
public PropertyDescriptor getPropertyDescriptor(java.lang.String propertyQualifier)
Description copied from interface:TypeServiceGets the property descriptor.- Specified by:
getPropertyDescriptorin interfaceTypeService- Parameters:
propertyQualifier- the property qualifier- Returns:
- the property descriptor
-
getAttributeCodeFromPropertyQualifier
public java.lang.String getAttributeCodeFromPropertyQualifier(java.lang.String propertyQualifier)
Description copied from interface:TypeServiceGets the attribute code from property qualifier.- Specified by:
getAttributeCodeFromPropertyQualifierin interfaceTypeService- Parameters:
propertyQualifier- the property qualifier- Returns:
- the attribute code from property qualifier
-
getTypeCodeFromPropertyQualifier
public java.lang.String getTypeCodeFromPropertyQualifier(java.lang.String propertyQualifier)
Description copied from interface:TypeServiceThe type (base or extended) part of the property qualifier. (E.g. having qualifier "Product.code" this returns "Product".)- Specified by:
getTypeCodeFromPropertyQualifierin 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:TypeServiceGets the value type code.- Specified by:
getValueTypeCodein 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)
-
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:TypeServiceWrap item.- Specified by:
wrapItemin 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:TypeServiceWrap items.- Specified by:
wrapItemsin 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:TypeServiceUnwrap items to models- Specified by:
unwrapItemsin 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)
-
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)
-
fetchItemTemplate
@Deprecated protected CockpitItemTemplateModel fetchItemTemplate(ComposedTypeModel composedType, java.lang.String templateCode)
Deprecated.since 6.3Don't use this method, it's only there for "stubbing" it in the test and will be removed when there is a slayer replacement forCockpitManager.getCockpitItemTemplate(ComposedType, String).
-
loadItemTemplate
protected ObjectTemplate loadItemTemplate(java.lang.String code)
-
loadItemType
protected ItemType loadItemType(java.lang.String code)
-
getDefaultEditorType
protected java.lang.String getDefaultEditorType(AttributeDescriptorModel attributeDescriptor)
-
getSelectionOf
public PropertyDescriptor getSelectionOf(PropertyDescriptor descriptor)
Description copied from interface:TypeServicereturns the "selectionOf" property of the given property descriptor- Specified by:
getSelectionOfin 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:TypeServicereturns the list of all property descriptors that the give property descriptor is "selectionOf"- Specified by:
getReverseSelectionOfin interfaceTypeService- Parameters:
descriptor- the source property descriptor- Returns:
- the list of all property descriptors that the give property descriptor is "selectionOf"
-
setPropertyService
public void setPropertyService(PropertyService propertyService)
-
getPropertyService
protected PropertyService getPropertyService()
-
setFlexibleSearchService
public void setFlexibleSearchService(FlexibleSearchService flexibleSearchService)
-
getFlexibleSearchService
public FlexibleSearchService getFlexibleSearchService()
-
setExtendedTypeChain
public void setExtendedTypeChain(ExtendedTypeLoader extendedTypeChain)
-
getExtendedTypeChain
protected ExtendedTypeLoader getExtendedTypeChain()
-
-