Class CmsRelationType

    • Field Detail

      • INDEX_CONTENT

        public static final CmsRelationType INDEX_CONTENT
        Constant for the index content relation, telling the content of a linked resource should be merged into the content of the linking XML.
      • JSP_STRONG

        public static final CmsRelationType JSP_STRONG
        Constant for the all types of links in a jsp file using the link.strong macro.
      • JSP_WEAK

        public static final CmsRelationType JSP_WEAK
        Constant for the all types of links in a jsp file using the link.weak macro.
      • XML_STRONG

        public static final CmsRelationType XML_STRONG
        Constant for the OpenCmsVfsFile values in xml content that were defined as 'strong' links.
      • XML_WEAK

        public static final CmsRelationType XML_WEAK
        Constant for the OpenCmsVfsFile values in xml content that were defined as 'weak' links.
      • LOCALE_VARIANT

        public static final CmsRelationType LOCALE_VARIANT
        Constant for the type of relations between resources which are locale variants.
      • DETAIL_ONLY

        public static final CmsRelationType DETAIL_ONLY
        Constant for the type of relations between a detail content and its detail-only container pages.
      • XSD

        public static final CmsRelationType XSD
        Constant for the weak links from xmlcontent to the used xsd.
    • Constructor Detail

      • CmsRelationType

        public CmsRelationType​(int id,
                               java.lang.String name,
                               java.lang.String type)
        Public constructor for user defined relation types.

        Parameters:
        id - the id of the relation type
        name - the name of the relation
        type - the type of relation type, strong or weak
    • Method Detail

      • filterDefinedInContent

        public static java.util.List<CmsRelationTypefilterDefinedInContent​(java.util.Collection<CmsRelationType> relationTypes)
        Returns all relation types in the given list that define relations in the content.

        Parameters:
        relationTypes - the collection of relation types to filter
        Returns:
        a list of CmsRelationType objects
      • filterInternal

        public static java.util.List<CmsRelationTypefilterInternal​(java.util.Collection<CmsRelationType> relationTypes)
        Returns all internal defined relation types in the given list.

        Parameters:
        relationTypes - the collection of relation types to filter
        Returns:
        a list of CmsRelationType objects
      • filterNotDefinedInContent

        public static java.util.List<CmsRelationTypefilterNotDefinedInContent​(java.util.Collection<CmsRelationType> relationTypes)
        Returns all relation types in the given list that are not defined in the content.

        Parameters:
        relationTypes - the collection of relation types to filter
        Returns:
        a list of CmsRelationType objects
      • filterStrong

        public static java.util.List<CmsRelationTypefilterStrong​(java.util.Collection<CmsRelationType> relationTypes)
        Returns all strong relation types in the given list.

        Parameters:
        relationTypes - the collection of relation types to filter
        Returns:
        a list of CmsRelationType objects
      • filterUserDefined

        public static java.util.List<CmsRelationTypefilterUserDefined​(java.util.Collection<CmsRelationType> relationTypes)
        Returns all user defined relation types in the given list.

        Parameters:
        relationTypes - the collection of relation types to filter
        Returns:
        a list of CmsRelationType objects
      • filterWeak

        public static java.util.List<CmsRelationTypefilterWeak​(java.util.Collection<CmsRelationType> relationTypes)
        Returns all weak relation types in the given list.

        Parameters:
        relationTypes - the collection of relation types to filter
        Returns:
        a list of CmsRelationType objects
      • valueOfJsp

        public static CmsRelationType valueOfJsp​(java.lang.String name)
        Parses the given value into a valid enumeration element for a JSP relation type.

        This should be used to extend Strings like "weak" or "strong" to full relation type descriptors for JSP pages like "JSP_WEAK" or "JSP_STRONG".

        Parameters:
        name - the name to get the JSP type for
        Returns:
        the JSP enumeration element
        See Also:
        valueOf(String)
      • valueOfXml

        public static CmsRelationType valueOfXml​(java.lang.String name)
        Parses the given value into a valid enumeration element for a XML relation type.

        This should be used to extend Strings like "weak" or "strong" to full relation type descriptors for XML documents like "XML_WEAK" or "XML_STRONG".

        Parameters:
        name - the name to get the XML type for
        Returns:
        the XML enumeration element
        See Also:
        valueOf(String)
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • getCopyBehavior

        public CmsRelationType.CopyBehavior getCopyBehavior()
        Gets the 'copy behavior' of the relation type, which is how relations of a resource should be handled when copying that resource.

        Returns:
        the copy behavior of the relation type
      • getId

        public int getId()
        Returns the internal representation of this type.

        Returns:
        the internal representation of this type
      • getLocalizedName

        public java.lang.String getLocalizedName​(CmsMessages messages)
        Returns a localized name for the given relation type.

        Parameters:
        messages - the message bundle to use to resolve the name
        Returns:
        a localized name
      • getLocalizedName

        public java.lang.String getLocalizedName​(java.util.Locale locale)
        Returns a localized name for the given relation type.

        Parameters:
        locale - the locale
        Returns:
        a localized name
      • getName

        public java.lang.String getName()
        Returns the type name.

        Returns:
        the type name
        See Also:
        valueOf(String)
      • getNameForXml

        public java.lang.String getNameForXml()
        Returns the type name for xml output.

        The short type name of XML or JSP types is only "WEAK" or "STRONG". For other types the short name is equal to the name.

        In case you need the full type name, use getName().

        Returns:
        the short type name
        See Also:
        getName(), valueOfJsp(String), valueOfXml(String)
      • getType

        public java.lang.String getType()
        Returns the string strong or weak.

        Returns:
        the string strong or weak
        See Also:
        isStrong()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()
      • isDefinedInContent

        public boolean isDefinedInContent()
        Checks if this relation type is defined in the content of a resource or not.

        Returns:
        true if this relation type is defined in the content of a resource
      • isInternal

        public boolean isInternal()
        Checks if this is an internal relation type.

        Returns:
        true if this is an internal relation type
      • isStrong

        public boolean isStrong()
        Checks if the relation type is strong or weak.

        Returns:
        true if the relation type is strong
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()