Package org.opencms.relations
Class CmsRelation
java.lang.Object
org.opencms.relations.CmsRelation
A relation between two opencms resources.
- Since:
- 6.3.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Comparator<CmsRelation>
A comparator for the source & target path plus the relation type of 2 relations. -
Constructor Summary
ConstructorDescriptionCmsRelation
(CmsResource source, CmsResource target, CmsRelationType type) Creates a new relation object of the given type between the given resources.CmsRelation
(CmsUUID sourceId, String sourcePath, CmsUUID targetId, String targetPath, CmsRelationType type) Base constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getSource
(CmsObject cms, CmsResourceFilter filter) Returns the source resource when possible to read with the given filter.Returns the structure id of the source resource.Returns the path of the source resource.getTarget
(CmsObject cms, CmsResourceFilter filter) Returns the target resource when possible to read with the given filter.Returns the structure id of the target resource.Returns the path of the target resource.getType()
Returns the relation type.int
hashCode()
toString()
withTargetId
(CmsUUID id) Copies this relation, but sets the target id in the copy to the given value.
-
Field Details
-
COMPARATOR
A comparator for the source & target path plus the relation type of 2 relations.
-
-
Constructor Details
-
CmsRelation
Creates a new relation object of the given type between the given resources.- Parameters:
source
- the source resourcetarget
- the target resourcetype
- the relation type
-
CmsRelation
public CmsRelation(CmsUUID sourceId, String sourcePath, CmsUUID targetId, String targetPath, CmsRelationType type) Base constructor.- Parameters:
sourceId
- the source structure idsourcePath
- the source pathtargetId
- the target structure idtargetPath
- the target pathtype
- the relation type
-
-
Method Details
-
equals
-
getSource
Returns the source resource when possible to read with the given filter.- Parameters:
cms
- the current user contextfilter
- the filter to use- Returns:
- the source resource
- Throws:
CmsException
- if something goes wrong
-
getSourceId
Returns the structure id of the source resource.- Returns:
- the structure id of the source resource
-
getSourcePath
Returns the path of the source resource.- Returns:
- the path of the source resource
-
getTarget
Returns the target resource when possible to read with the given filter.- Parameters:
cms
- the current user contextfilter
- the filter to use- Returns:
- the target resource
- Throws:
CmsException
- if something goes wrong
-
getTargetId
Returns the structure id of the target resource.- Returns:
- the structure id of the target resource
-
getTargetPath
Returns the path of the target resource.- Returns:
- the path of the target resource
-
getType
Returns the relation type.- Returns:
- the relation type
-
hashCode
-
toString
-
withTargetId
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
-