Class RelationType
- java.lang.Object
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable
public class RelationType extends ComposedType
A special composed type describing binary relations between items.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:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.type.ComposedType
ComposedType.ComposedTypeImpl
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.type.Type
Type.TypeImpl
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.type.TypeManagerManaged
TypeManagerManaged.TypeManagerManagedImpl
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LocalizableItem.LocalizableItemImpl
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.ExtensibleItem
ExtensibleItem.ExtensibleItemImpl
-
Nested 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
Fields Modifier and Type Field Description static java.lang.String
LOCALIZATION_ATTRIBUTE
static java.lang.String
LOCALIZED
The localized attribute string constant.static java.lang.String
ORDERING_ATTRIBUTE
static java.lang.String
SOURCE_ATTRIBUTE
The source type attribute attribute string constant.static java.lang.String
SOURCE_TYPE
The source type attribute string constant.static java.lang.String
SOURCE_TYPE_ROLE
The source type role attribute string constant.static java.lang.String
TARGET_ATTRIBUTE
The target type attribute attribute string constant.static java.lang.String
TARGET_TYPE
The target type attribute string constant.static java.lang.String
TARGET_TYPE_ROLE
The 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, TABLE
-
Fields inherited from class de.hybris.platform.jalo.type.Type
CODE, DEFAULTVALUE, DESCRIPTION, XMLDEFINITION
-
Fields inherited from class de.hybris.platform.jalo.type.TypeManagerManaged
AUTOCREATE, DEPRECATED, EXTENSION_NAME, GENERATE, NAME
-
Fields inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LANGUAGE_FALLBACK_ENABLED
-
Fields 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, TYPE
-
Fields inherited from class de.hybris.platform.util.BridgeAbstraction
impl, tenant
-
-
Constructor Summary
Constructors Constructor Description RelationType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
appendModfierXMLDefinition(RelationDescriptor des, java.lang.StringBuilder sb)
Internal helper forgetXMLDefinition()
.protected void
appendModfierXMLDefinition(RelationDescriptor des, org.znerd.xmlenc.XMLOutputter xout)
protected Item
createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes)
java.lang.String
exportXMLDefinition(org.znerd.xmlenc.XMLOutputter xout)
AttributeDescriptor
getLocalizationAttribute()
For 1-n relations only: the attribute which is used to map elements to different languages.protected Item.ItemAttributeMap
getNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes)
Removes the following attributes from attribute values map:Type.CODE
LOCALIZED
SOURCE_ATTRIBUTE
SOURCE_TYPE
SOURCE_TYPE_ROLE
TARGET_ATTRIBUTE
TARGET_TYPE
TARGET_TYPE_ROLE
AttributeDescriptor
getOrderingAttribute()
For 1-n relations only: the attribute which is used to store the element order.RelationDescriptor
getSourceAttributeDescriptor()
Returns the relation attribute belonging to the source type of this relation.ComposedType
getSourceType()
Returns the source type of this relation.EnumerationValue
getSourceTypeCardinality()
java.lang.String
getSourceTypeRole()
Return the role name of the source type within this relation.RelationDescriptor
getTargetAttributeDescriptor()
Returns the relation attribute belonging to the target type of this relation.ComposedType
getTargetType()
Returns the target type of this relation.EnumerationValue
getTargetTypeCardinality()
java.lang.String
getTargetTypeRole()
Return the role name of the target type within this relation.java.lang.String
getXMLDefinition()
Assembles the XML definition of this relation to put insideitems.xml
.boolean
isLocalized()
boolean
isOneToMany()
boolean
isOrdered()
boolean
isRootRelationType()
Tells whether this relation is a root relation type.boolean
isSourceNavigable()
boolean
isSourceTypeOne()
boolean
isTargetNavigable()
boolean
isTargetTypeOne()
-
Methods 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, unsetTypeSearchContext
-
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
-
Methods inherited from class de.hybris.platform.jalo.type.TypeManagerManaged
getAllNames, getAllNames, getExtensionName, getImpl, getName, getName, isAutocreate, isDeprecated, isGenerate, setAllNames, setAllNames, setAutocreate, setExtensionName, setGenerate, setName, setName
-
Methods 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, setLocalizedProperty
-
Methods inherited from class de.hybris.platform.jalo.ExtensibleItem
createNonClassAccessor, getAllProperties, getAllProperties, getImplementation, getProperty, getProperty, getPropertyNames, getPropertyNames, removeProperty, removeProperty, setAllProperties, setAllProperties, setProperty, setProperty
-
Methods 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, getPermissionMap, getPermissions, getPersistenceVersion, getPK, getPositivePermissions, 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, useTA, writeReplace
-
Methods inherited from class de.hybris.platform.util.BridgeAbstraction
setTenant
-
-
-
-
Field Detail
-
SOURCE_ATTRIBUTE
public static final java.lang.String 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:
- Constant Field Values
-
TARGET_ATTRIBUTE
public static final java.lang.String 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:
- Constant Field Values
-
ORDERING_ATTRIBUTE
public static final java.lang.String ORDERING_ATTRIBUTE
- See Also:
- Constant Field Values
-
LOCALIZATION_ATTRIBUTE
public static final java.lang.String LOCALIZATION_ATTRIBUTE
- See Also:
- Constant Field Values
-
SOURCE_TYPE
public static final java.lang.String SOURCE_TYPE
The source type attribute string constant.- See Also:
- Constant Field Values
-
TARGET_TYPE
public static final java.lang.String TARGET_TYPE
The target type attribute string constant.- See Also:
- Constant Field Values
-
SOURCE_TYPE_ROLE
public static final java.lang.String SOURCE_TYPE_ROLE
The source type role attribute string constant.- See Also:
- Constant Field Values
-
TARGET_TYPE_ROLE
public static final java.lang.String TARGET_TYPE_ROLE
The target type role attribute string constant.- See Also:
- Constant Field Values
-
LOCALIZED
public static final java.lang.String LOCALIZED
The localized attribute string constant.- See Also:
- Constant Field Values
-
-
Method Detail
-
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:
createItem
in 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:
getNonInitialAttributes
in classComposedType
- Parameters:
ctx
- session context with language = NULLallAttributes
- aItemAttributeMap
contaning attribute values.- Returns:
- a
ItemAttributeMap
containing all attribute values, which belong to non-initial attributes.
-
getXMLDefinition
public java.lang.String getXMLDefinition()
Assembles the XML definition of this relation to put insideitems.xml
.- Overrides:
getXMLDefinition
in classComposedType
- See Also:
ComposedType.getXMLDefinition(String)
-
exportXMLDefinition
public java.lang.String exportXMLDefinition(org.znerd.xmlenc.XMLOutputter xout)
- Overrides:
exportXMLDefinition
in classComposedType
-
appendModfierXMLDefinition
protected void appendModfierXMLDefinition(RelationDescriptor des, java.lang.StringBuilder sb)
Internal helper forgetXMLDefinition()
.
-
appendModfierXMLDefinition
protected void appendModfierXMLDefinition(RelationDescriptor des, org.znerd.xmlenc.XMLOutputter xout) throws java.io.IOException
- Throws:
java.io.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
public RelationDescriptor 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 noAttributeDescriptor
and this method returns null.
-
getTargetAttributeDescriptor
public RelationDescriptor 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 noAttributeDescriptor
and this method returns null.
-
isOrdered
public boolean isOrdered()
-
getOrderingAttribute
public AttributeDescriptor 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
public AttributeDescriptor 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
public java.lang.String getSourceTypeRole()
Return the role name of the source type within this relation.
-
getTargetTypeRole
public java.lang.String getTargetTypeRole()
Return the role name of the target type within this relation.
-
getSourceType
public ComposedType getSourceType()
Returns the source type of this relation.
-
getTargetType
public ComposedType getTargetType()
Returns the target type of this relation.
-
isOneToMany
public boolean isOneToMany()
-
isSourceTypeOne
public boolean isSourceTypeOne()
-
getSourceTypeCardinality
public EnumerationValue getSourceTypeCardinality()
-
isTargetTypeOne
public boolean isTargetTypeOne()
-
getTargetTypeCardinality
public EnumerationValue getTargetTypeCardinality()
-
isSourceNavigable
public boolean isSourceNavigable()
-
isTargetNavigable
public boolean isTargetNavigable()
-
-