Package org.dspace.versioning.utils
Class RelationshipVersioningUtils
- java.lang.Object
-
- org.dspace.versioning.utils.RelationshipVersioningUtils
-
public class RelationshipVersioningUtils extends Object
Class with utility methods to manipulate relationships that are linked to versioned items. Specifically focussed on the "latest version status" of relationships, which controls which related items are relevant (visible) to any given item.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRelationshipVersioningUtils.LatestVersionStatusChangelog
-
Constructor Summary
Constructors Constructor Description RelationshipVersioningUtils()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanotherSideIsLatest(boolean isLeft, Relationship.LatestVersionStatus latestVersionStatus)Given a latest version status, check if the other side is "latest".RelationshipVersioningUtils.LatestVersionStatusChangelogupdateLatestVersionStatus(Relationship relationship, boolean updateLeftSide, boolean isLatest)UpdateRelationship.latestVersionStatusof the given relationship.
-
-
-
Method Detail
-
otherSideIsLatest
public boolean otherSideIsLatest(boolean isLeft, Relationship.LatestVersionStatus latestVersionStatus)Given a latest version status, check if the other side is "latest". If we look from the left, this implies BOTH and RIGHT_ONLY return true. If we look from the right, this implies BOTH and LEFT_ONLY return true.- Parameters:
isLeft- whether we should look from the left or right side.latestVersionStatus- the latest version status.- Returns:
- true if the other side has "latest" status, false otherwise.
-
updateLatestVersionStatus
public RelationshipVersioningUtils.LatestVersionStatusChangelog updateLatestVersionStatus(Relationship relationship, boolean updateLeftSide, boolean isLatest) throws IllegalStateException
UpdateRelationship.latestVersionStatusof the given relationship. If isLatest = true, this method will never throw IllegalStateException. If isLatest = false, you should make sure that the selected side of given relationship currently has "latest" status, otherwise IllegalStateException will be thrown.- Parameters:
relationship- the relationship.updateLeftSide- whether the status of the left item or the right item should be updated.isLatest- to what the status should be set.- Throws:
IllegalStateException- if the operation would result in both the left side and the right side being set to non-latest.
-
-