[OPENIDM-14528] Relationship signal propagation not working for patch operations against singleton relationships Created: 31/Mar/20  Updated: 23/Jul/20  Resolved: 23/Jul/20

Status: Closed
Project: OpenIDM
Component/s: Module - Relationships
Affects Version/s: OpenIDM 6.0.0, 6.5.0, 7.0.0
Fix Version/s: 7.0.0

Type: Bug Priority: Major
Reporter: Dirk Hogan Assignee: Dirk Hogan
Resolution: Fixed Votes: 0
Labels: CLARK, release-notes
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
is related to OPENIDM-11601 OpenIDM Needs to Rework how it Querie... Closed
Target Version/s:
Verified Version/s:
QA Assignee: Chris Drake
Story Points: 2
Sprint: 2020.04 - IDM, 2020.05 - IDM, 2020.06 - IDM, 2020.07 - IDM


The notifyRelationships configuration can be applied to any managed object field. Its value is an array of relationship fields which should be signaled when the managed object field in question is changed. Any time a managed object is updated, or a signal received, this configuration is consulted to determine whether the signal should be sent/propagated. The configuration includes a JsonPointer of the field in question, and the List of roles to be signaled.

Now consider a patch on the manager field:

PATCH http://localhost:8080/openidm/managed/user/brmiller
{"operation":"replace","field":"manager", "value" : {"_ref":"managed/user/jnelson"}}  

oldValue In MOS.propagateVertexStateChange

{ "mail": "brendan.miller@forgerock.com", "sn": "Miller", "givenName": "Brendan", "userName": "brmiller", "accountStatus": "active", "managerManager": {  }, "effectiveAssignments": [ ], "effectiveRoles": [ ], "_rev": "0000000073807ea6", "_id": "brmiller", "manager": { "_ref": "managed/user/bjensen", "_refResourceCollection": "managed/user", "_refResourceId": "bjensen", "_refProperties":
{ "_id": "d4bfa652-77b9-4981-91a0-bd8014bbee11", "_rev": "00000000c15b93db" }}}

newValue in MOS.propagateStateChange

{ "mail": "brendan.miller@forgerock.com", "sn": "Miller", "givenName": "Brendan", "userName": "brmiller", "accountStatus": "active", "managerManager": {  }, "effectiveAssignments": [ ], "effectiveRoles": [ ], "_rev": "0000000073807ea6", "_id": "brmiller", "manager": { "_ref": "managed/user/jnelson" } } 

(note that the managerManager field is a new virtual property used to test the relationship-derived virtual property mechanism)

VertexStatePropagator#propagateVertexStateChange is invoked with each of the path fields from the resulting JsonPatch.diff(oldValue, newValue)

The results of JsonPatch.diff:

[ { "op": "replace", "path": "/manager/_ref", "value": "managed/user/jnelson" }, { "op": "remove", "path": "/manager/_refResourceCollection" }, { "op": "remove", "path": "/manager/_refResourceId" }, { "op": "remove", "path": "/manager/_refProperties" } ]

The propagation config in the manager field for my example is

"notifyRelationships" : ["reports"]

But we never notify reports because manager/_ref or manager/_ref* is changed - not the bare relationship field.

This change should examine all parents of the path elements of the JsonPatch.diff elements, and then remove all duplicates so that relationship fields are not signaled redundantly.


Comment by Chris Drake [ 22/Jul/20 ]

Tests Passed
Suite: relationships.relationship_derived_virtual_props
OpenIDM: 97af0b2474
pyforge 40f748f778

Comment by Lana Frost [ 23/Jul/20 ]

Reopening to add to release notes

Generated at Mon Mar 08 12:32:35 UTC 2021 using Jira 7.13.12#713012-sha1:6e07c38070d5191bbf7353952ed38f111754533a.