[MAGNOLIA-5052] DelegateNodeWrapper should have its own implementation of isSame() method Created: 22/May/13  Updated: 25/Jul/13  Resolved: 06/Jun/13

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 4.5.8
Fix Version/s: 4.5.10

Type: Bug Priority: Neutral
Reporter: Roman Kovařík Assignee: Roman Kovařík
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
is related to MAGNOLIA-5200 DelegatePropertyWrapper should have i... Open
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 Description   

Javadoc for javax.jcr.Item.isSame says:

Returns true if this Item object (the Java object instance) represents the same actual workspace item as
the object otherItem.
Two Item objects represent the same workspace item if and only if all the following are true:

  • Both objects were acquired through Session objects that were created by the same Repository
    object.
  • Both objects were acquired through Session objects bound to the same repository workspace.
  • The objects are either both Node objects or both Property objects.
  • If they are Node objects, they have the same identifier.
  • If they are Property objects they have identical names and isSame is true of their parent nodes.
    This method does not compare the states of the two items. For example, if two Item objects
    representing the same actual workspace item have been retrieved through two different sessions and
    one has been modified, then this method will still return true when comparing these two objects. Note
    that if two Item objects representing the same workspace item are retrieved through the same session
    they will always reflect the same state.

But that's not fulfilled for DelegateNodeWrapped class, which calls ItemImpl.isSame():

public boolean isSame(Item otherItem) throws RepositoryException {
	...
        if (this == otherItem) {
            return true;
        }
        if (otherItem instanceof ItemImpl) {
            ...
        }
        return false;
    }

Generated at Mon Feb 12 04:01:31 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.