public class TypeTools extends Object
| Constructor and Description |
|---|
TypeTools() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkInstanceOfCatalogVersion(TypeService typeService,
TypedObject object)
Check instance of catalog version.
|
static boolean |
checkInstanceOfCategory(TypeService typeService,
TypedObject object)
Check instance of category.
|
static boolean |
checkInstanceOfMedia(TypeService typeService,
TypedObject object)
Check instance of media.
|
static boolean |
checkInstanceOfProduct(TypeService typeService,
TypedObject object)
Check instance of product.
|
static Object |
container2Item(TypeService typeService,
Object containerValue)
Converts typed object or collection of typed objects to item (or collection of them.
|
static <E> Collection<E> |
createCollection(Class<? extends Collection> clazz,
Collection<E> items)
Creates a new collection with the same or similar* type to
clazz. |
static ObjectValueContainer |
createValueContainer(ObjectValueHandlerRegistry valueHandlerRegistry,
TypedObject typedObject,
Set<PropertyDescriptor> propertyDescriptors,
Set<String> langIsos,
boolean lazyLoad)
Creates the value container.
|
static ObjectValueContainer |
createValueContainer(TypedObject typedObject,
Set<PropertyDescriptor> propertyDescriptors,
Set<String> langIsos)
Creates the value container.
|
static ObjectValueContainer |
createValueContainer(TypedObject typedObject,
Set<PropertyDescriptor> propertyDescriptors,
Set<String> langIsos,
boolean lazyLoad)
egacy API relying on ZK dependency injection
|
static void |
filterOutRemovedItems(List<? extends TypedObject> items)
Filters out removed items.
|
static Map<String,Object> |
getAllAttributes(TypedObject typedObject)
Gets all attributes and their possible values from TypedObject.
|
static Map<PropertyDescriptor,Object> |
getAllDefaultValues(TypeService typeService,
ObjectTemplate template,
Set<String> languageIsos)
Gets the all default values.
|
static Set<ObjectType> |
getAllSubtypes(ObjectType type)
Gets the all subtypes.
|
static List<ObjectType> |
getAllSupertypes(ObjectType type)
Gets the all supertypes.
|
static TypeService |
getCoreTypeService()
Deprecated.
Will be removed without replacement. Use proper dependency injection to get the typeService.
|
static String |
getEnumName(HybrisEnumValue hybrisEnum)
Get the localized name of an hybris enum.
|
static Map<String,Object> |
getInitialValues(ObjectType type,
TypedObject baseItem,
TypeService typeService,
UIConfigurationService configurationService)
Gets the initial values.
|
static Set<PropertyDescriptor> |
getMandatoryAttributes(ObjectType type,
boolean creationMode)
Gets the mandatory attributes.
|
static Set<PropertyDescriptor> |
getMandatoryAttributes(ObjectType type,
boolean creationMode,
PropertyService propertyService)
Same as
getMandatoryAttributes(ObjectType, boolean) but uses PropertyService to check if
mandatory. |
static ModelService |
getModelService()
Deprecated.
Will be removed without replacement. Use proper dependency injection to get the modelService.
|
static String |
getMultiplicityString(PropertyDescriptor propertyDescriptor)
Deprecated.
|
static Object |
getObjectAttributeValue(TypedObject object,
String attributeQualifier,
TypeService typeService)
Deprecated.
|
static Set<PropertyDescriptor> |
getOmittedProperties(ObjectValueContainer valueContainer,
ObjectTemplate template,
boolean creationMode)
Gets the omitted properties.
|
static Set<PropertyDescriptor> |
getOmittedProperties(ObjectValueContainer valueContainer,
Set<PropertyDescriptor> descriptors,
boolean creationMode)
Gets the omitted properties basing on given set of property descriptors.
|
static Object |
getPropertyValue(ValueService valueService,
TypedObject object,
PropertyDescriptor propertyDescriptor)
Reads the value of the given pd.
|
static String |
getPropertyValueAsString(ValueService valueService,
TypedObject object,
PropertyDescriptor propertyDescriptor)
Reads the value of the given pd and retuns is as a String.
|
static List<ObjectTemplate> |
getTemplatesForCreation(TypeService typeService,
BaseType type)
Gets the templates for creation.
|
static List<Map<ObjectTemplate,Integer>> |
getTemplatesForCreationWithDepth(TypeService typeService,
BaseType type,
int initialDepth,
boolean showAbstract)
Gets the templates for creation with depth.
|
static String |
getTypeDescription(BaseType type,
TypeService typeService)
Deprecated.
Use
ObjectType.getDescription() instead. |
static String |
getTypeName(BaseType type,
TypeService typeService)
Deprecated.
Use
ObjectType.getName() instead. |
static String |
getValueAsString(LabelService labelService,
Object value)
Returns a string representation of a value, where value can be a TypedObject, a collection of TypedObject (the
LabelService is used to get the labels) or any other Object (toString() is used).
|
static String |
getValueAsString(LabelService labelService,
Object value,
int size) |
static ObjectTemplate |
getValueTypeAsObjectTemplate(PropertyDescriptor propertyDescriptor,
TypeService typeService)
Gets the value type as object template.
|
static boolean |
hasSupertype(ObjectType type,
ObjectType supertype)
Checks for supertype.
|
static boolean |
isEditable(SystemService systemService,
ObjectType type,
PropertyDescriptor propertyDescriptor,
boolean creationMode)
Deprecated.
Use
UIAccessRightService isWritable methods instead. |
protected static boolean |
isEmptyLocalizedValue(Map<String,Object> value)
Checks if is empty localized value.
|
protected static boolean |
isEmptyValue(Object value)
Checks if is empty value.
|
static boolean |
isInitial(PropertyDescriptor propertyDescriptor)
Deprecated.
Use
PropertyService.isInitial(PropertyDescriptor) instead. |
static boolean |
isMandatory(PropertyDescriptor propertyDescriptor,
boolean creationMode)
Deprecated.
|
static boolean |
isPartof(PropertyDescriptor propertyDescriptor)
Deprecated.
Use
PropertyService.isPartof(PropertyDescriptor) instead. |
static boolean |
isReadable(SystemService systemService,
ObjectType type,
PropertyDescriptor propertyDescriptor,
boolean creationMode)
Deprecated.
Use
UIAccessRightService isReadable methods instead. |
static Object |
item2Container(TypeService typeService,
Object value)
Converts item or collection of items to typed objects (or collection of them).
|
static List<PK> |
itemToPkList(Collection<? extends Item> items)
Deprecated.
Will be removed without replacement.
|
static List<String> |
multiEdit(PropertyDescriptor propertyDesc,
String languageIso,
List<TypedObject> items,
Object value)
Multi edit.
|
static boolean |
primitiveValue(Boolean value)
Deprecated.
use
BooleanUtils#toBoolean(Boolean) instead. |
static int |
primitiveValue(Integer value)
Returns the primitive value for the given integer or 0 if null.
|
static boolean |
propertyBelongsTo(TypeService typeService,
Set<ObjectType> types,
PropertyDescriptor propertyDescriptor)
Property belongs to.
|
public static String getValueAsString(LabelService labelService, Object value)
labelService - the label servicevalue - the valuepublic static String getValueAsString(LabelService labelService, Object value, int size)
@Deprecated public static String getTypeName(BaseType type, TypeService typeService)
ObjectType.getName() instead.type - the typetypeService - the typeservice@Deprecated public static String getTypeDescription(BaseType type, TypeService typeService)
ObjectType.getDescription() instead.type - the typetypeService - the typeservicepublic static Map<String,Object> getInitialValues(ObjectType type, TypedObject baseItem, TypeService typeService, UIConfigurationService configurationService)
type - the typebaseItem - the base itemtypeService - the type serviceconfigurationService - the configuration service@Deprecated public static String getMultiplicityString(PropertyDescriptor propertyDescriptor)
PropertyService.getMultiplicityString(PropertyDescriptor) instead.propertyDescriptor - the property descriptorpublic static ObjectTemplate getValueTypeAsObjectTemplate(PropertyDescriptor propertyDescriptor, TypeService typeService)
propertyDescriptor - the property descriptortypeService - the type service@Deprecated public static Object getObjectAttributeValue(TypedObject object, String attributeQualifier, TypeService typeService)
ValueService.getValue(TypedObject, PropertyDescriptor) instead.object - the objectattributeQualifier - the attribute qualifiertypeService - the type servicepublic static ObjectValueContainer createValueContainer(TypedObject typedObject, Set<PropertyDescriptor> propertyDescriptors, Set<String> langIsos)
typedObject - the typed objectpropertyDescriptors - the property descriptorslangIsos - the lang isospublic static ObjectValueContainer createValueContainer(ObjectValueHandlerRegistry valueHandlerRegistry, TypedObject typedObject, Set<PropertyDescriptor> propertyDescriptors, Set<String> langIsos, boolean lazyLoad)
typedObject - the typed objectpropertyDescriptors - the property descriptorslangIsos - the lang isoslazyLoad - the lazy loadpublic static ObjectValueContainer createValueContainer(TypedObject typedObject, Set<PropertyDescriptor> propertyDescriptors, Set<String> langIsos, boolean lazyLoad)
typedObject - propertyDescriptors - langIsos - lazyLoad - public static List<ObjectType> getAllSupertypes(ObjectType type)
type - the typepublic static Set<ObjectType> getAllSubtypes(ObjectType type)
type - the typepublic static boolean hasSupertype(ObjectType type, ObjectType supertype)
type - the typesupertype - the supertype@Deprecated public static List<PK> itemToPkList(Collection<? extends Item> items)
items - the itemspublic static List<ObjectTemplate> getTemplatesForCreation(TypeService typeService, BaseType type)
typeService - the type servicetype - the typepublic static List<Map<ObjectTemplate,Integer>> getTemplatesForCreationWithDepth(TypeService typeService, BaseType type, int initialDepth, boolean showAbstract)
typeService - the type servicetype - the typeinitialDepth - the initial depthshowAbstract - the show abstract@Deprecated public static boolean isEditable(SystemService systemService, ObjectType type, PropertyDescriptor propertyDescriptor, boolean creationMode)
UIAccessRightService isWritable methods instead.systemService - the system servicetype - object typepropertyDescriptor - property descriptorcreationMode - the creation mode@Deprecated public static boolean isReadable(SystemService systemService, ObjectType type, PropertyDescriptor propertyDescriptor, boolean creationMode)
UIAccessRightService isReadable methods instead.systemService - the system servicetype - object typepropertyDescriptor - property descriptorcreationMode - the creation mode@Deprecated public static boolean isInitial(PropertyDescriptor propertyDescriptor)
PropertyService.isInitial(PropertyDescriptor) instead.propertyDescriptor - the pd@Deprecated public static boolean isPartof(PropertyDescriptor propertyDescriptor)
PropertyService.isPartof(PropertyDescriptor) instead.public static Object item2Container(TypeService typeService, Object value)
typeService - the TypeServicevalue - the valuepublic static Object container2Item(TypeService typeService, Object containerValue)
typeService - the TypeServicecontainerValue - the valuepublic static boolean checkInstanceOfCategory(TypeService typeService, TypedObject object)
typeService - the type serviceobject - the objectpublic static boolean checkInstanceOfCatalogVersion(TypeService typeService, TypedObject object)
typeService - the type serviceobject - the objectpublic static boolean checkInstanceOfProduct(TypeService typeService, TypedObject object)
typeService - the type serviceobject - the objectpublic static boolean checkInstanceOfMedia(TypeService typeService, TypedObject object)
typeService - the type serviceobject - the objectpublic static List<String> multiEdit(PropertyDescriptor propertyDesc, String languageIso, List<TypedObject> items, Object value)
propertyDesc - the property desclanguageIso - the language isoitems - the itemsvalue - the value@Deprecated public static boolean primitiveValue(Boolean value)
BooleanUtils#toBoolean(Boolean) instead.value - the valuepublic static int primitiveValue(Integer value)
@Deprecated public static TypeService getCoreTypeService()
@Deprecated public static ModelService getModelService()
public static Set<PropertyDescriptor> getOmittedProperties(ObjectValueContainer valueContainer, ObjectTemplate template, boolean creationMode)
valueContainer - the value containertemplate - the templatecreationMode - the creation modepublic static Set<PropertyDescriptor> getOmittedProperties(ObjectValueContainer valueContainer, Set<PropertyDescriptor> descriptors, boolean creationMode)
valueContainer - the value containerdescriptors - the descriptorscreationMode - the creation modepublic static Set<PropertyDescriptor> getMandatoryAttributes(ObjectType type, boolean creationMode)
getMandatoryAttributes(ObjectType, boolean, PropertyService) from outside zk.type - the typecreationMode - the creation modepublic static Set<PropertyDescriptor> getMandatoryAttributes(ObjectType type, boolean creationMode, PropertyService propertyService)
getMandatoryAttributes(ObjectType, boolean) but uses PropertyService to check if
mandatory.@Deprecated public static boolean isMandatory(PropertyDescriptor propertyDescriptor, boolean creationMode)
PropertyService.isMandatory(PropertyDescriptor, boolean) instead.propertyDescriptor - the pdcreationMode - the creation modepublic static boolean propertyBelongsTo(TypeService typeService, Set<ObjectType> types, PropertyDescriptor propertyDescriptor)
typeService - the type servicetypes - the typespropertyDescriptor - the pdpublic static Map<PropertyDescriptor,Object> getAllDefaultValues(TypeService typeService, ObjectTemplate template, Set<String> languageIsos)
typeService - the type servicetemplate - the templatelanguageIsos - the language isosprotected static boolean isEmptyValue(Object value)
value - the valueprotected static boolean isEmptyLocalizedValue(Map<String,Object> value)
value - the valuepublic static Map<String,Object> getAllAttributes(TypedObject typedObject)
typedObject - the typed objectpublic static String getEnumName(HybrisEnumValue hybrisEnum)
hybrisEnum - the hybris enumpublic static void filterOutRemovedItems(List<? extends TypedObject> items)
items - the itemspublic static String getPropertyValueAsString(ValueService valueService, TypedObject object, PropertyDescriptor propertyDescriptor)
public static Object getPropertyValue(ValueService valueService, TypedObject object, PropertyDescriptor propertyDescriptor)
public static <E> Collection<E> createCollection(Class<? extends Collection> clazz, Collection<E> items)
Creates a new collection with the same or similar* type to clazz. The created collection will contains
elements stored by items collection.
*If cannot create a new instance with the same type, then it will creates:
clazz - the requested type for new collection.items - the collection whose elements are to be placed into this collection.Copyright © 2017 SAP SE. All Rights Reserved.