Class RelationType
- All Implemented Interfaces:
Serializable,Comparable
Physically these relations are backed by the Link item. Therefore all relation
type instances are subtype of the composed type describing the Link item.
Relation types consists of the source and target (item) type, the source and target type role and a unique relation
name. Since it distinguishes between source and target relation types are directed. The relation
end points are described as RelationDescriptor belonging to source or target
type. This allows accessing a relation as two item collection attributes from both types. Creation and removal
of the actual relation tuples (means Link items) is done automatically. Moreove relations may be localized, which
means there may exist different relation elements per language.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class de.hybris.platform.jalo.type.ComposedType
ComposedType.ComposedTypeImplNested 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 Stringstatic final StringThe localized attribute string constant.static final Stringstatic final StringThe source type attribute attribute string constant.static final StringThe source type attribute string constant.static final StringThe source type role attribute string constant.static final StringThe target type attribute attribute string constant.static final StringThe target type attribute string constant.static final StringThe target type role attribute string constant.Fields inherited from class de.hybris.platform.jalo.type.ComposedType
ABSTRACT, ALLSUBTYPES, ALLSUPERTYPES, ATTRIBUTEDESCRIPTORS, DECLAREDATTRIBUTEDESCRIPTORS, DUMPPROPERTYTABLE, DYNAMIC, INHERITANCEPATH, INHERITEDATTRIBUTEDESCRIPTORS, JALOCLASS, JALOONLY, JNDINAME, SINGLETON, SUBTYPES, SUPERTYPE, TABLEFields 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 voidInternal helper forgetXMLDefinition().protected voidappendModfierXMLDefinition(RelationDescriptor des, org.znerd.xmlenc.XMLOutputter xout) protected ItemcreateItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) exportXMLDefinition(org.znerd.xmlenc.XMLOutputter xout) For 1-n relations only: the attribute which is used to map elements to different languages.protected Item.ItemAttributeMapgetNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes) Removes the following attributes from attribute values map:Type.CODELOCALIZEDSOURCE_ATTRIBUTESOURCE_TYPESOURCE_TYPE_ROLETARGET_ATTRIBUTETARGET_TYPETARGET_TYPE_ROLEFor 1-n relations only: the attribute which is used to store the element order.Returns the relation attribute belonging to the source type of this relation.Returns the source type of this relation.Return the role name of the source type within this relation.Returns the relation attribute belonging to the target type of this relation.Returns the target type of this relation.Return the role name of the target type within this relation.Assembles the XML definition of this relation to put insideitems.xml.booleanbooleanbooleanbooleanTells whether this relation is a root relation type.booleanbooleanbooleanbooleanMethods inherited from class de.hybris.platform.jalo.type.ComposedType
_sortAttributesByQualifier, checkItemPermission, checkTypePermission, checkTypePermission, createAttributeDescriptor, createAttributeDescriptor, createJaloOnlyInstance, exportXMLDefinition, getAllConcreteItemTypeCodes, getAllDefaultValues, getAllDefaultValues, getAllInstances, getAllInstances, getAllInstancesCount, getAllSubTypes, getAllSuperTypes, getAttributeDescriptor, getAttributeDescriptorIncludingPrivate, getAttributeDescriptors, getAttributeDescriptorsIncludingPrivate, getAttributeDescriptorsIncludingPrivate, getComposedTypeImpl, getCreatorInstance, getDeclaredAttributeDescriptor, getDeclaredAttributeDescriptors, getDeclaredJaloClass, getDefaultValues, getDefaultValues, getDumpPropertyTable, getEveryAttributeDescriptor, getInheritancePathString, getInheritedAttributeDescriptors, getInitialAttributeDescriptors, getItemTypeCode, getJaloClass, getJNDIName, getPartOfAutoRemovalAttributeDescriptors, getRelations, getSingletonInstance, getSubTypes, getSuperType, getTable, getXMLCustomProperties, getXMLDefinition, hasAttribute, hasOwnDeployment, isAbstract, isAssignableFrom, isDynamic, isInstance, isJaloClassAbstract, isJaloOnly, isSameOrSuperTypeOf, isSingleton, newInstance, newInstance, newInstance, newInstance, newInstance, newInstance, parseValue, setDeclaredAttributeDescriptors, setJaloClass, setJaloOnly, setSingleton, setTypeSearchSessionContex, toString, toString, unsetTypeSearchContextMethods inherited from class de.hybris.platform.jalo.type.Type
compareTo, getAllDescriptions, getAllDescriptions, getCode, getDefaultValue, getDefaultValue, getDescription, getDescription, getTypeImpl, setAllDescriptions, setAllDescriptions, setDefaultValue, setDefaultValue, setDescription, setDescriptionMethods 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, 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
-
SOURCE_ATTRIBUTE
The source type attribute attribute string constant.This names is the collection attribute which makes the relation accessible from source type.
- See Also:
-
TARGET_ATTRIBUTE
The target type attribute attribute string constant.This names is the collection attribute which makes the relation accessible from target type.
- See Also:
-
ORDERING_ATTRIBUTE
- See Also:
-
LOCALIZATION_ATTRIBUTE
- See Also:
-
SOURCE_TYPE
The source type attribute string constant.- See Also:
-
TARGET_TYPE
The target type attribute string constant.- See Also:
-
SOURCE_TYPE_ROLE
The source type role attribute string constant.- See Also:
-
TARGET_TYPE_ROLE
The target type role attribute string constant.- See Also:
-
LOCALIZED
The localized attribute string constant.- See Also:
-
-
Constructor Details
-
RelationType
public RelationType()
-
-
Method Details
-
createItem
protected Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) throws JaloBusinessException The generic creator method which requires: . Besides for both ends either an existing attribute has to be provided or its role and type. Usually the following attributes should be defined:- Overrides:
createItemin classComposedType- 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) Removes the following attributes from attribute values map:- Overrides:
getNonInitialAttributesin classComposedType- Parameters:
ctx- session context with language = NULLallAttributes- aItemAttributeMapcontaning attribute values.- Returns:
- a
ItemAttributeMapcontaining all attribute values, which belong to non-initial attributes.
-
getXMLDefinition
Assembles the XML definition of this relation to put insideitems.xml.- Overrides:
getXMLDefinitionin classComposedType- See Also:
-
exportXMLDefinition
- Overrides:
exportXMLDefinitionin classComposedType
-
appendModfierXMLDefinition
Internal helper forgetXMLDefinition(). -
appendModfierXMLDefinition
protected void appendModfierXMLDefinition(RelationDescriptor des, org.znerd.xmlenc.XMLOutputter xout) throws IOException - Throws:
IOException
-
isRootRelationType
public boolean isRootRelationType()Tells whether this relation is a root relation type. Only relations with a own deployment are called root relation type.To declare a relation as root the deployment has to be defined in
items.xml:<relation code="MyRelation" autocreate="true" generate="false" localized="false" deployment="MyRelationDeplpyment"> ... -
isLocalized
public boolean isLocalized()- Returns:
- true if the relation is localized, means each relation end attribute may have different values per language
-
getSourceAttributeDescriptor
Returns the relation attribute belonging to the source type of this relation. This attribute is named after the target type role and holds a collection type with the target type as element type. In case the target type is not navigable there is noAttributeDescriptorand this method returns null. -
getTargetAttributeDescriptor
Returns the relation attribute belonging to the target type of this relation. This attribute is named after the source type role and holds a collection type with the source type as element type. In case the source type is not navigable there is noAttributeDescriptorand this method returns null. -
isOrdered
public boolean isOrdered() -
getOrderingAttribute
For 1-n relations only: the attribute which is used to store the element order. This attribute always belongs to the n-end type of the relation. -
getLocalizationAttribute
For 1-n relations only: the attribute which is used to map elements to different languages. This attribute always belongs to the n-end type of the relation. -
getSourceTypeRole
Return the role name of the source type within this relation. -
getTargetTypeRole
Return the role name of the target type within this relation. -
getSourceType
Returns the source type of this relation. -
getTargetType
Returns the target type of this relation. -
isOneToMany
public boolean isOneToMany() -
isSourceTypeOne
public boolean isSourceTypeOne() -
getSourceTypeCardinality
-
isTargetTypeOne
public boolean isTargetTypeOne() -
getTargetTypeCardinality
-