The diff of Notes edited can't be included in a Notifications Body
Situation:
Since DMX 5.x value integration operate the following way if, e.g. a user edits a "Note" topic.
If a user edits the "Note Text" (value) child of a "Note" the former "Note Text" is dis-associated from the list of children
and a new "Note Text" value is created/ or re-used and takes its place in the "children" array of the just edited "Note"
Problem:
In the postUpdateTopic
the oldTopicModel
(tm1
below) comes with an empty children
array. This makes it impossible, e.g. for the notifications module, to include some kind of "diff" which includes the previous "Note Text" and the new "Note Text" into a notification.
Note: Observing "Note Text" topics with postUpdateTopic
will never work as it is a value type and those are never updated.
Currently, I don't know how to replicate this feature as it was included in DM 4 Notifications.
Code:
@Override
public void postUpdateTopic(Topic topic, TopicModel tm, TopicModel tm1) {
if (topic.getTypeUri().equals(NOTE) || topic.getTypeUri().equals(EVENT)) {
notifyTopicSubscribersAboutChangeset(topic, tm, tm1);
}
}
See the following debug output:
INFORMATION: Updating topic 6295 (typeUri="dmx.notes.note")
Jan 03, 2021 6:28:54 PM systems.dmx.core.impl.DMXObjectModelImpl update
INFORMATION: Updating association 6298 (typeUri="dmx.core.composition")
Jan 03, 2021 6:28:54 PM systems.dmx.core.impl.DMXObjectModelImpl delete
INFORMATION: Deleting association 6532 (typeUri="dmx.core.instantiation")
Jan 03, 2021 6:28:54 PM systems.dmx.core.impl.DMXObjectModelImpl delete
INFORMATION: Deleting association 6531 (typeUri="dmx.workspaces.workspace_assignment")
Jan 03, 2021 6:28:54 PM systems.dmx.core.impl.DMXObjectModelImpl delete
INFORMATION: Deleting association 6530 (typeUri="dmx.core.instantiation")
Jan 03, 2021 6:28:54 PM systems.dmx.core.impl.DMXObjectModelImpl delete
INFORMATION: Deleting association 6529 (typeUri="dmx.core.composition")
Jan 03, 2021 6:28:54 PM systems.dmx.core.impl.DMXObjectModelImpl update
INFORMATION: Updating association 6663 (typeUri="dmx.core.composition")
Jan 03, 2021 6:28:54 PM systems.dmx.notifications.NotificationsPlugin notifyTopicSubscribersAboutChangeset
INFORMATION: TopicModel 1: {"id":6295,"uri":"","typeUri":"dmx.notes.note","value":"Note 1","children":{"dmx.notes.text":{"id":6658,"uri":"","typeUri":"dmx.notes.text","value":"<p>Bla, Blub.<\/p><p>Yeah, Yeah Yeah<\/p>","children":{}},"dmx.notes.title":{"id":6290,"uri":"","typeUri":"dmx.notes.title","value":"Note 1","children":{}}}}, TopicModel 2: {"id":6295,"uri":"","typeUri":"dmx.notes.note","value":"Note 1","children":{}}
FYI: @jri