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 classDefaultTypeService.MyClassificationTypeprotected classDefaultTypeService.MyInvalidationListenerprotected classDefaultTypeService.MyItemTypeprotected classDefaultTypeService.MyTypedObjectprotected classDefaultTypeService.MyWidgetType
-
Constructor Summary
Constructors Constructor Description DefaultTypeService()
-
Method Summary
All Methods Instance Methods Concrete 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 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.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(ClassAttributeAssignment caa)protected java.lang.StringgetDefaultEditorType(AttributeDescriptorModel attributeDescriptorModel)protected java.lang.StringgetDefaultEditorType(TypeModel type, boolean localized)ExtendedTypegetExtendedType(java.lang.String code)Gets the extended type.protected TypeCachegetExtendedTypeCache()protected ExtendedTypegetExtendedTypeCached(java.lang.String code)protected InvalidationListenergetItemInvalidationListener()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 PropertyDescriptorCodeResolvergetPropertyDescriptorCodeResolver()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 ClassificationTypeloadClassificationType(java.lang.String code)protected ObjectTemplateloadItemTemplate(java.lang.String code)protected ItemTypeloadItemType(java.lang.String code)protected WidgetTypeloadWidgetType(java.lang.String code)protected java.lang.StringresolveClassificationPropertyPath(java.lang.String code, java.lang.String classificationAttributeCode)voidsetBaseTypeCache(TypeCache typeCache)voidsetBaseTypePropertyCache(PropertyCache propCache)voidsetExtendedTypeCache(TypeCache typeCache)voidsetModelService(ModelService modelService)voidsetObjectTemplateCache(TypeCache typeCache)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
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
-
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
-
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
-
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)
-
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: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)
-
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: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"
-
getPropertyDescriptorCodeResolver
protected PropertyDescriptorCodeResolver getPropertyDescriptorCodeResolver()
-
-