Browse Source

Fix cmds conversion

pull/9717/head
ViacheslavKlimov 3 years ago
parent
commit
73c7abcf86
  1. 14
      application/src/main/java/org/thingsboard/server/service/ws/notification/cmd/NotificationCmdsWrapper.java

14
application/src/main/java/org/thingsboard/server/service/ws/notification/cmd/NotificationCmdsWrapper.java

@ -41,12 +41,16 @@ public class NotificationCmdsWrapper {
@JsonIgnore @JsonIgnore
public WsCommandsWrapper toCommonCmdsWrapper() { public WsCommandsWrapper toCommonCmdsWrapper() {
WsCommandsWrapper wrapper = new WsCommandsWrapper(); WsCommandsWrapper wrapper = new WsCommandsWrapper();
wrapper.setUnreadNotificationsCountSubCmds(List.of(unreadCountSubCmd)); wrapper.setUnreadNotificationsCountSubCmds(toList(unreadCountSubCmd));
wrapper.setUnreadNotificationsSubCmds(List.of(unreadSubCmd)); wrapper.setUnreadNotificationsSubCmds(toList(unreadSubCmd));
wrapper.setMarkNotificationAsReadCmds(List.of(markAsReadCmd)); wrapper.setMarkNotificationAsReadCmds(toList(markAsReadCmd));
wrapper.setMarkAllNotificationsAsReadCmds(List.of(markAllAsReadCmd)); wrapper.setMarkAllNotificationsAsReadCmds(toList(markAllAsReadCmd));
wrapper.setNotificationsUnsubCmds(List.of(unsubCmd)); wrapper.setNotificationsUnsubCmds(toList(unsubCmd));
return wrapper; return wrapper;
} }
private <C> List<C> toList(C cmd) {
return cmd != null ? List.of(cmd) : null;
}
} }

Loading…
Cancel
Save