Package de.hybris.platform.jalo.type
Class CollectionType
- All Implemented Interfaces:
Serializable,Comparable
A type representing a typed collection.
The actual type of the collection may be one of the following:
- collection ( use
COLLECTION) - set ( use
SET) which contains unique elements - list ( use
LIST) which is ordered
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThe presistence layer implementation interface.Nested classes/interfaces inherited from class de.hybris.platform.jalo.type.Type
Type.TypeImplNested classes/interfaces inherited from class de.hybris.platform.jalo.type.TypeManagerManaged
TypeManagerManaged.TypeManagerManagedImplNested classes/interfaces inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LocalizableItem.LocalizableItemImplNested classes/interfaces inherited from class de.hybris.platform.jalo.ExtensibleItem
ExtensibleItem.ExtensibleItemImplNested classes/interfaces inherited from class de.hybris.platform.jalo.Item
Item.AttributeFilter, Item.AttributeMode, Item.CachedGetter, Item.CachedSetter, Item.ItemAttributeMap, Item.ItemConstraint, Item.ItemImpl, Item.JaloCachedComputationException -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default collection type constants.static final StringThe default collection enum code .static final StringThe collection element type attribute string constant.static final intThe list collection type constants.static final StringThe list collection enum code.static final intThe set collection type constants.static final StringThe set collection enum code.static final intDeprecated.since agesstatic final StringDeprecated.since agesstatic final StringThe type of collection attribute string constant.static final StringThe code of the typeOfCollection enumeration type.static final StringThe internal type of collection attribute string constant.Fields inherited from class de.hybris.platform.jalo.type.Type
CODE, DEFAULTVALUE, DESCRIPTION, XMLDEFINITIONFields inherited from class de.hybris.platform.jalo.type.TypeManagerManaged
AUTOCREATE, DEPRECATED, EXTENSION_NAME, GENERATE, NAMEFields inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LANGUAGE_FALLBACK_ENABLEDFields inherited from class de.hybris.platform.jalo.Item
_CREATION_TIME_INTERNAL, _MODIFIED_TIME_INTERNAL, accessorLog, CREATION_TIME, DISABLE_ATTRIBUTE_CHECK, DISABLE_ITEMCHECK_BEFORE_REMOVABLE, EVEN, FEATURE_ACCESSMAP_QUALIFIER, HJMPTS, INITIAL_CREATION_FLAG, isJaloOnly, MODIFIED_TIME, NEGATIVE, NOT_FOUND, OWNER, PK, POSITIVE, SAVE_FROM_SERVICE_LAYER, staticTransientObjects, TYPEFields inherited from class de.hybris.platform.util.BridgeAbstraction
impl, tenant -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intconvertTypeOfCollectionEnumToInt(EnumerationValue enumeration) Converts typeOfCollection enums into intern int codes.protected EnumerationValueconvertTypeOfCollectionIntToEnum(int type) Converts typeOfCollection internal int representation int enum values.protected ItemcreateItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) Generic item creation method.protected static final StringexportXMLDefinition(org.znerd.xmlenc.XMLOutputter xout) protected CollectionType.CollectionTypeImplInternal access to persistence layer implementation.Returns the type of the elements of this collection type.Returns the type of the elements of this collection.static int[]getEscapedCollectionPositions(String escaped, int startFrom) protected Item.ItemAttributeMapgetNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes) Cuts the following attribute values which are already set during actual item creation:Type.CODEELEMENT_TYPETYPE_OF_COLLECTIONintReturns the type of this collection as enumeration value.Assembles the XML definition string to put inside aitems.xml.booleanisAssignableFrom(Type type) Tests whether this collection type is assignable from another collection type.booleanisInstance(Object o) Tests if a given object is instance of this collection type.protected booleanisTypeAssignableFrom(int type1, int type2) Checks assignability between types of collection:COLLECTIONis assignable from allSETis assignable fromSETandSORTED_SETLISTis assignable fromLISTandSORTED_SETSORTED_SETis assignable fromSORTED_SETonlyReturns an empty collection if the specified type (see @link #getTypeOfCollection()}).parseValue(SessionContext ctx, String value) reads a collection of '(' + escaped element string + ')'.toString(SessionContext ctx, Object value) Writes a collection as '(' + escaped element string + ')'.protected static final StringunescapeForCollection(String escaped) Methods inherited from class de.hybris.platform.jalo.type.Type
compareTo, getAllDescriptions, getAllDescriptions, getCode, getDefaultValue, getDefaultValue, getDescription, getDescription, getTypeImpl, setAllDescriptions, setAllDescriptions, setDefaultValue, setDefaultValue, setDescription, setDescription, toStringMethods inherited from class de.hybris.platform.jalo.type.TypeManagerManaged
getAllNames, getAllNames, getExtensionName, getImpl, getName, getName, isAutocreate, isDeprecated, isGenerate, setAllNames, setAllNames, setAutocreate, setExtensionName, setGenerate, setName, setNameMethods inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
getAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllValuesSessionContext, getLocalizedProperty, getLocalizedProperty, getLocalizedPropertyInternal, getLocalizedPropertyNames, getLocalizedPropertyNames, hasLanguage, isEmptyValue, isFallbackEnabled, removeLocalizedProperty, removeLocalizedProperty, setAllLocalizedProperties, setAllLocalizedProperties, setLocalizedProperty, setLocalizedPropertyMethods inherited from class de.hybris.platform.jalo.ExtensibleItem
createNonClassAccessor, getAllProperties, getAllProperties, getImplementation, getProperty, getProperty, getPropertyNames, getPropertyNames, removeProperty, removeProperty, setAllProperties, setAllProperties, setProperty, setPropertyMethods inherited from class de.hybris.platform.jalo.Item
addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addNegativePermission, addPermission, addPositivePermission, assureExtensionsLoaded, changeTypeAfterCreation, checkConstraint, checkItemPermission, checkMandatoryAttribute, checkMandatoryAttribute, checkPermission, checkPermission, checkRemovable, clearPermission, ctx, doAfterRemove, doBeforeRemove, equals, getAccessorFor, getAllAttributes, getAllAttributes, getAllAttributes, getAllAttributes, getAllAttributesInternal, getAllLinkedItems, getAndCheckCacheBoundItem, getAttribute, getAttribute, getCacheBoundItem, getComposedType, getComposedTypePK, getCreationTime, getCurrentlyRemovingCount, getDefaultAttributeModes, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItemsCount, getLinkedItemsCount, getLinkedItemsCount, getModificationTime, getNegativePermissions, getOwner, getPartOfRemovedSessionMarker, getPermissionMap, getPermissions, getPersistenceVersion, getPK, getPositivePermissions, getRelatedItems, getRelatedItems, getRestrictedPrincipals, getSession, getSyncObject, getTenant, getTransientObject, getTransientObjectMap, hashCode, hasRegisteredClassAccessorFor, internal_registerClassAccessorFor, internal_registerNonClassAccessorFor, invalidateLocalCaches, isAlive, isCacheBound, isCurrentlyRemoving, isCurrentlyRemoving, isEmptyRelationValue, isInCreate, isInstanceOf, isItemCheckBeforeRemoveableDisabled, isMarkModifiedDisabled, isRelationLocalizationFallbackEnabled, newInstance, notifyExtensionsAfterItemCreation, notifyExtensionsBeforeItemCreation, notifyItemRemoval, notifyManagerAboutItemRemoval, readResolve, registerAccessFor, registerAccessFor, registerJaloInvalidationListeners, remove, remove, removeItemCollection, removeItemCollection, removeLinkedItems, removeLinkedItems, removeLinkedItems, removeLinkedItems, removeLinks, removePartOfItems, removePartOfItems, setAllAttributes, setAllAttributes, setAllAttributesInternal, setAllLinkedItems, setAllLinkedItems, setAllLinkedItems, setAllLinkedItems, setAttribute, setAttribute, setAttributeFromString, setAttributeFromString, setCacheBound, setComposedType, setCreationTime, setImplementation, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setModificationTime, setNonInitialAttributes, setOwner, setPermissionsByMap, setRelatedItems, setTransientObject, setUseTA, suppressRelation, useTA, writeReplaceMethods inherited from class de.hybris.platform.util.BridgeAbstraction
setTenant
-
Field Details
-
TYPE_OF_COLLECTION_ENUM_CODE
The code of the typeOfCollection enumeration type. -
COLLECTION
public static final int COLLECTIONThe default collection type constants.- See Also:
-
COLLECTION_ENUM_CODE
The default collection enum code . -
SET
public static final int SETThe set collection type constants.- See Also:
-
SET_ENUM_CODE
The set collection enum code. -
LIST
public static final int LISTThe list collection type constants.- See Also:
-
LIST_ENUM_CODE
The list collection enum code. -
SORTED_SET
Deprecated.since agesThe sorted set collection type constants.- See Also:
-
SORTED_SET_ENUM_CODE
Deprecated.since agesThe sorted set collection enum code. -
ELEMENT_TYPE
The collection element type attribute string constant.- See Also:
-
TYPE_OF_COLLECTION
The type of collection attribute string constant.- See Also:
-
TYPE_OF_COLLECTION_INTERNAL
The internal type of collection attribute string constant.Since this attribute is private is may only be used for FlexibleSearch queries like this example:
"... WHERE {" + CollectionType.TYPE_OF_COLLECTION_INTERNAL + "} = " + CollectionType.SET + " ..."Its value can be retrieved manually by
getTypeOfCollection().- See Also:
-
-
Constructor Details
-
CollectionType
public CollectionType()
-
-
Method Details
-
convertTypeOfCollectionEnumToInt
protected int convertTypeOfCollectionEnumToInt(EnumerationValue enumeration) throws JaloInvalidParameterException Converts typeOfCollection enums into intern int codes.- Throws:
JaloInvalidParameterException
-
convertTypeOfCollectionIntToEnum
protected EnumerationValue convertTypeOfCollectionIntToEnum(int type) throws JaloInvalidParameterException Converts typeOfCollection internal int representation int enum values.- Throws:
JaloInvalidParameterException
-
createItem
protected Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) throws JaloBusinessException Generic item creation method.Requires the following attributes:
Optionally the type of collection may be defined byTYPE_OF_COLLECTION.- Specified by:
createItemin classItem- Parameters:
ctx- the current session context which this item is created withintype- the actual item type ( since subtypes may not provide a own jalo class this may be different from the type which this method was implemented for )- Returns:
- the new item instance
- Throws:
JaloBusinessException- indicates an error during creation - any changes will be rollbacked
-
getNonInitialAttributes
protected Item.ItemAttributeMap getNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes) Cuts the following attribute values which are already set during actual item creation:- Overrides:
getNonInitialAttributesin classItem- Parameters:
ctx- session context with language = NULLallAttributes- aItemAttributeMapcontaning attribute values.- Returns:
- a
ItemAttributeMapcontaining all attribute values, which belong to non-initial attributes.
-
toString
Writes a collection as '(' + escaped element string + ')'. The element string representation is escaped so that each occurence of '(', ')' or ',' is prepended by a '\'.- Specified by:
toStringin classType- Throws:
JaloInvalidParameterException- Since:
- 2.10
-
getEscapedCollectionPositions
- Since:
- 2.10
-
escapeForCollection
- Since:
- 2.10
-
unescapeForCollection
- Since:
- 2.10
-
parseValue
reads a collection of '(' + escaped element string + ')'. The element string representation must be escaped so that each occurence of '(', ')' or ',' is prepended by a '\'.- Specified by:
parseValuein classType- Throws:
JaloInvalidParameterException- Since:
- 2.10
-
getElementType
Returns the type of the elements of this collection type. -
getElementType
Returns the type of the elements of this collection. -
getTypeOfCollection
public int getTypeOfCollection()- Returns:
- the internal type of the collection as one of
SET,LIST,COLLECTION.
-
getTypeOfCollectionEnum
Returns the type of this collection as enumeration value. The enumeration type can be retrieved using ist code constantTYPE_OF_COLLECTION_ENUM_CODE. Its values got the codes -
newInstance
Returns an empty collection if the specified type (see @link #getTypeOfCollection()}). -
getXMLDefinition
Assembles the XML definition string to put inside aitems.xml.- Specified by:
getXMLDefinitionin classType
-
exportXMLDefinition
- Specified by:
exportXMLDefinitionin classTypeManagerManaged
-
getCollectionTypeImpl
Internal access to persistence layer implementation. -
isAssignableFrom
Tests whether this collection type is assignable from another collection type. This is only true if this type's element type is assignable from the other collection type's element type and the type of collections are assignable.- Specified by:
isAssignableFromin classType- Parameters:
type- the type to be checked.- See Also:
-
isTypeAssignableFrom
protected boolean isTypeAssignableFrom(int type1, int type2) Checks assignability between types of collection:-
COLLECTIONis assignable from all -
SETis assignable fromSETandSORTED_SET -
LISTis assignable fromLISTandSORTED_SET -
SORTED_SETis assignable fromSORTED_SETonly
-
-
isInstance
Tests if a given object is instance of this collection type. This checks the type of collection and each element of being instance of the element type.Since all elements are checked this method is considerably costly so use with care!
- Specified by:
isInstancein classType- Parameters:
o- the object to be checked.
-