Class CmsRelation


  • public class CmsRelation
    extends java.lang.Object
    A relation between two opencms resources.

    Since:
    6.3.0
    • Field Detail

      • COMPARATOR

        public static final java.util.Comparator<CmsRelation> COMPARATOR
        A comparator for the source & target path plus the relation type of 2 relations.

    • Constructor Detail

      • CmsRelation

        public CmsRelation​(CmsResource source,
                           CmsResource target,
                           CmsRelationType type)
        Creates a new relation object of the given type between the given resources.

        Parameters:
        source - the source resource
        target - the target resource
        type - the relation type
      • CmsRelation

        public CmsRelation​(CmsUUID sourceId,
                           java.lang.String sourcePath,
                           CmsUUID targetId,
                           java.lang.String targetPath,
                           CmsRelationType type)
        Base constructor.

        Parameters:
        sourceId - the source structure id
        sourcePath - the source path
        targetId - the target structure id
        targetPath - the target path
        type - the relation type
    • Method Detail

      • equals

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

        public CmsUUID getSourceId()
        Returns the structure id of the source resource.

        Returns:
        the structure id of the source resource
      • getSourcePath

        public java.lang.String getSourcePath()
        Returns the path of the source resource.

        Returns:
        the path of the source resource
      • getTargetId

        public CmsUUID getTargetId()
        Returns the structure id of the target resource.

        Returns:
        the structure id of the target resource
      • getTargetPath

        public java.lang.String getTargetPath()
        Returns the path of the target resource.

        Returns:
        the path of the target resource
      • hashCode

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

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

        public CmsRelation withTargetId​(CmsUUID id)
        Copies this relation, but sets the target id in the copy to the given value.
        Parameters:
        id - the new target id for the copy
        Returns:
        the copy with the target id