Obtaining the user who originated the change event in Vaadin Collaboration Kit when subscribing to changes in a NamedMap within a Topic

huangapple go评论52阅读模式
英文:

Obtaining the user who originated the change event in Vaadin Collaboration Kit when subscribing to changes in a NamedMap within a Topic

问题

I am using Vaadin Collaboration Kit and have subscribed to changes in a NamedMap within a Topic in Vaadin Collaboration Engine. I would like to obtain the user who originated the change event when updates occur in the map.

Here is the code I am using to subscribe to changes in the NamedMap:

CollaborationEngine.getInstance().openTopicConnection(this, "topic",
        localUser, topicConnection -> {
            CollaborationMap formManagerCollaborationMap = topicConnection.getNamedMap("mapvalues");
            formManagerCollaborationMap.subscribe(event -> {
   // How can I obtain the user who originated the change event?
    // I want to access the user who made the change in the map
    // ...
            });
            return null;
        }
);

How can I retrieve the user ID who originated the change event? Is there any specific method or property to access this information?

I have tried to use the event, but is of type MapChangeEvent which only has the attributes key:String, oldValue:JsonNode, value:JsonNode. I couldn't find the user information associated with the event.

Any help would be greatly appreciated. Thank you!

英文:

I am using Vaadin Collaboration Kit and have subscribed to changes in a NamedMap within a Topic in Vaadin Collaboration Engine. I would like to obtain the user who originated the change event when updates occur in the map.

Here is the code I am using to subscribe to changes in the NamedMap:

CollaborationEngine.getInstance().openTopicConnection(this, "topic",
        localUser, topicConnection -> {
            CollaborationMap formManagerCollaborationMap = topicConnection.getNamedMap("mapvalues");
            formManagerCollaborationMap.subscribe(event -> {
   // How can I obtain the user who originated the change event?
    // I want to access the user who made the change in the map
    // ...
            });
            return null;
        }
);

How can I retrieve the user ID who originated the change event? Is there any specific method or property to access this information?

I have tried to use the event, but is of type MapChangeEvent which only has the attributes key:String, oldValue:JsonNode, value:JsonNode. I couldn't find the user information associated with the event

Any help would be greatly appreciated. Thank you!

答案1

得分: 2

Collaboration Kit 不追踪该信息。如果需要知道,可以将其嵌入存储在地图中的值中。

英文:

Collaboration Kit does not track that information. If you need to know it, then you can embed it in the value that you store in the map itself.

huangapple
  • 本文由 发表于 2023年5月15日 01:44:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76248897.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定