Class RelationType

  • 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
    • 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
    • Constructor Detail

      • RelationType

        public RelationType()
    • Method Detail

      • exportXMLDefinition

        public java.lang.String exportXMLDefinition​(org.znerd.xmlenc.XMLOutputter xout)
        Overrides:
        exportXMLDefinition in class ComposedType
      • 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 no AttributeDescriptor and this method returns null.
        See Also:
        getTargetAttributeDescriptor(), getTargetTypeRole()
      • 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 no AttributeDescriptor and this method returns null.
        See Also:
        getSourceAttributeDescriptor(), getSourceTypeRole()
      • 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()
      • isTargetTypeOne

        public boolean isTargetTypeOne()
      • isSourceNavigable

        public boolean isSourceNavigable()
      • isTargetNavigable

        public boolean isTargetNavigable()