100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Various notification related updates
Rich Turnerd10a0b441d62
diff --git a/client/src/main/java/org/openremote/app/client/i18n/ManagerMessages.java b/client/src/main/java/org/openremote/app/client/i18n/ManagerMessages.javaindex 730f9621c..ffad02ed5 100644--- a/client/src/main/java/org/openremote/app/client/i18n/ManagerMessages.java+++ b/client/src/main/java/org/openremote/app/client/i18n/ManagerMessages.java@@ -155,6 +155,16 @@ public interface ManagerMessages extends Messages {String createdOn();+ String sentOn();++ String deliveredOn();++ String acknowledgedOn();++ String acknowledgement();++ String error();+String selectedLocation();String assetCreated(String name);diff --git a/client/src/main/java/org/openremote/app/client/notifications/FilterOptions.java b/client/src/main/java/org/openremote/app/client/notifications/FilterOptions.javaindex 22ac4df80..5910ab8e4 100644--- a/client/src/main/java/org/openremote/app/client/notifications/FilterOptions.java+++ b/client/src/main/java/org/openremote/app/client/notifications/FilterOptions.java@@ -23,6 +23,7 @@ import org.openremote.model.notification.Notification;import org.openremote.model.notification.PushNotificationMessage;import org.openremote.model.util.TextUtil;+import java.util.Date;import java.util.HashMap;import java.util.Map;import java.util.Objects;@@ -47,6 +48,7 @@ public class FilterOptions {}final protected Map<String, String> realms;+ final protected Map<String, String> realmIds;final protected BiConsumer<FilterOptions, Consumer<Map<String, String>>> targetsSupplier;protected Map<String, String> targets = new HashMap<>();protected String selectedNotificationType = NOTIFICATION_TYPES[0]; // Only one type at the moment so select it@@ -57,8 +59,9 @@ public class FilterOptions {protected Runnable targetsChangedCallback;protected Runnable changedCallback;- public FilterOptions(Map<String, String> realms, BiConsumer<FilterOptions, Consumer<Map<String, String>>> targetsSupplier) {+ public FilterOptions(Map<String, String> realms, Map<String, String> realmIds, BiConsumer<FilterOptions, Consumer<Map<String, String>>> targetsSupplier) {this.realms = realms;+ this.realmIds = realmIds;this.targetsSupplier = targetsSupplier;}@@ -74,6 +77,10 @@ public class FilterOptions {return realms;}+ public Map<String, String> getRealmIds() {+ return realmIds;+ }+public Map<String, String> getTargets() {return targets;}@@ -106,6 +113,10 @@ public class FilterOptions {return selectedRealm;}+ public String getSelectedRealmId() {+ return selectedRealm == null ? null : realmIds.get(selectedRealm);+ }+public void setSelectedRealm(String selectedRealm) {this.selectedRealm = selectedRealm;this.selectedTarget = null;@@ -161,6 +172,39 @@ public class FilterOptions {this.changedCallback = filterOptionsChangedCallback;}+ public Long getFromTimestamp() {+ Long fromTimestamp = null;++ if (getSelectedSentIn() != null) {+ switch (getSelectedSentIn()) {++ case DAY:+ fromTimestamp = new Date(new Date().getTime() - (24L * 60 * 60 * 1000)).getTime();+ break;+ case WEEK:+ fromTimestamp = new Date(new Date().getTime() - (7L * 24 * 60 * 60 * 1000)).getTime();+ break;+ case MONTH:+ fromTimestamp = new Date(new Date().getTime() - (31L * 24 * 60 * 60 * 1000)).getTime();+ break;+ }+ }++ return fromTimestamp;+ }++ public String getTenantId() {+ return getSelectedTargetType() == Notification.TargetType.TENANT ? getSelectedRealmId() : null;+ }++ public String getUserId() {+ return getSelectedTargetType() == Notification.TargetType.USER ? getSelectedTarget() : null;+ }++ public String getAssetId() {+ return getSelectedTargetType() == Notification.TargetType.ASSET ? getSelectedTarget() : null;+ }+protected void refreshTargets() {setTargets(null);targetsSupplier.accept(this, this::setTargets);diff --git a/client/src/main/java/org/openremote/app/client/notifications/NotificationEditor.java b/client/src/main/java/org/openremote/app/client/notifications/NotificationEditor.javaindex 2e1417fed..db5d1188f 100644--- a/client/src/main/java/org/openremote/app/client/notifications/NotificationEditor.java+++ b/client/src/main/java/org/openremote/app/client/notifications/NotificationEditor.java@@ -29,6 +29,8 @@ public interface NotificationEditor {void setOnSend(Runnable onSend);+ void setOnClose(Runnable onClose);+void show();void setResult(NotificationSendResult result);diff --git a/client/src/main/java/org/openremote/app/client/notifications/NotificationEditorImpl.java b/client/src/main/java/org/openremote/app/client/notifications/NotificationEditorImpl.javaindex c1118d4bb..8895cccc8 100644--- a/client/src/main/java/org/openremote/app/client/notifications/NotificationEditorImpl.java+++ b/client/src/main/java/org/openremote/app/client/notifications/NotificationEditorImpl.java@@ -19,12 +19,13 @@*/package org.openremote.app.client.notifications;-import com.google.gwt.user.client.ui.*;+import com.google.gwt.user.client.ui.FlowPanel;+import com.google.gwt.user.client.ui.InlineLabel;+import com.google.gwt.user.client.ui.IsWidget;import org.openremote.app.client.app.dialog.Dialog;import org.openremote.app.client.i18n.ManagerMessages;import org.openremote.app.client.style.WidgetStyle;import org.openremote.app.client.widget.*;-import org.openremote.app.client.widget.PushButton;import org.openremote.model.interop.Consumer;import org.openremote.model.notification.*;import org.openremote.model.util.Pair;@@ -39,7 +40,6 @@ import java.util.Locale;import java.util.Optional;import static org.openremote.app.client.widget.ValueEditors.createValueEditor;-import static org.openremote.model.util.TextUtil.isNullOrEmpty;public class NotificationEditorImpl implements NotificationEditor {@@ -168,7 +168,7 @@ public class NotificationEditorImpl implements NotificationEditor {sendOptions.setSelectedRealm(realmsList.getSelectedValue());if (sendOptions.getSelectedTargetType() == Notification.TargetType.TENANT) {- sendOptions.setSelectedTarget(realmsList.getSelectedValue());+ sendOptions.setSelectedTarget(sendOptions.getSelectedRealmId());}}});@@ -177,7 +177,7 @@ public class NotificationEditorImpl implements NotificationEditor {if (sendOptions != null) {sendOptions.setSelectedTargetType(targetTypesList.getSelectedValue());if (sendOptions.getSelectedTargetType() == Notification.TargetType.TENANT) {- sendOptions.setSelectedTarget(sendOptions.getSelectedRealm());+ sendOptions.setSelectedTarget(sendOptions.getSelectedRealmId());targetsGroup.setVisible(false);} else {targetsList.selectItem("");@@ -533,6 +533,7 @@ public class NotificationEditorImpl implements NotificationEditor {this.onSend = onSend;}+ @Overridepublic void setOnClose(Runnable onClose) {this.onClose = onClose;}diff --git a/client/src/main/java/org/openremote/app/client/notifications/NotificationsActivity.java b/client/src/main/java/org/openremote/app/client/notifications/NotificationsActivity.javaindex 5590242c4..d57a091c7 100644--- a/client/src/main/java/org/openremote/app/client/notifications/NotificationsActivity.java+++ b/client/src/main/java/org/openremote/app/client/notifications/NotificationsActivity.java@@ -76,7 +76,6 @@ public class NotificationsActivity extends AssetBrowsingActivity<NotificationsPlprotected NotificationsPlace place;protected FilterOptions filterOptions;protected SendOptions sendOptions;- protected SentNotification[] sentNotifications;@Injectpublic NotificationsActivity(Environment environment,@@ -147,7 +146,10 @@ public class NotificationsActivity extends AssetBrowsingActivity<NotificationsPlMap<String, String> realms = Arrays.stream(tenants).collect(Collectors.toMap(Tenant::getRealm, Tenant::getDisplayName));- filterOptions = new FilterOptions(realms, this::loadTargets);+ Map<String, String> realmIds = Arrays.stream(tenants)+ .collect(Collectors.toMap(Tenant::getRealm, Tenant::getId));++ filterOptions = new FilterOptions(realms, realmIds, this::loadTargets);String selectedRealm = !TextUtil.isNullOrEmpty(place.getRealm()) && realms.containsKey(place.getRealm())? place.getRealm() : null;@@ -170,7 +172,6 @@ public class NotificationsActivity extends AssetBrowsingActivity<NotificationsPlpublic void refreshNotifications() {view.setBusy(true);refreshNotifications(notifications -> {- sentNotifications = notifications;view.setNotifications(notifications);view.setDeleteAllEnabled(notifications.length > 0);view.setBusy(false);@@ -193,8 +194,11 @@ public class NotificationsActivity extends AssetBrowsingActivity<NotificationsPlMap<String, String> realms = Arrays.stream(tenants).collect(Collectors.toMap(Tenant::getRealm, Tenant::getDisplayName));+ Map<String, String> realmIds = Arrays.stream(tenants)+ .collect(Collectors.toMap(Tenant::getRealm, Tenant::getId));+if (sendOptions == null) {- sendOptions = new SendOptions(realms, this::loadTargets, this::createMessage);+ sendOptions = new SendOptions(realms, realmIds, this::loadTargets, this::createMessage);}String selectedRealm = !TextUtil.isNullOrEmpty(place.getRealm()) && realms.containsKey(place.getRealm())@@ -210,6 +214,7 @@ public class NotificationsActivity extends AssetBrowsingActivity<NotificationsPlnotificationEditor.setSendOptions(sendOptions);notificationEditor.setOnSend(() -> sendNotification(notificationEditor::setResult));+ notificationEditor.setOnClose(this::refreshNotifications);notificationEditor.show();});}@@ -229,16 +234,20 @@ public class NotificationsActivity extends AssetBrowsingActivity<NotificationsPl@Overridepublic void deleteNotifications() {+ String tenantId = filterOptions.getTenantId();+ String userId = filterOptions.getUserId();+ String assetId = filterOptions.getAssetId();+ Long fromTimestamp = filterOptions.getFromTimestamp();+environment.getApp().getRequests().send(requestParams -> notificationResource.removeNotifications(requestParams,- Arrays.stream(sentNotifications)- .map(SentNotification::getId)- .collect(Collectors.toList()),null,+ filterOptions.getSelectedNotificationType(),+ fromTimestamp,null,- null,- null,- null),+ tenantId,+ userId,+ assetId),204,() -> {environment.getEventBus().dispatch(new ShowSuccessEvent(@@ -412,41 +421,21 @@ public class NotificationsActivity extends AssetBrowsingActivity<NotificationsPlreturn;}- List<String> types = TextUtil.isNullOrEmpty(filterOptions.getSelectedNotificationType())- ? null : Collections.singletonList(filterOptions.getSelectedNotificationType());-- List<String> users = filterOptions.getSelectedTargetType() == Notification.TargetType.USER- ? Collections.singletonList(filterOptions.getSelectedTarget()) : null;+ String tenantId = filterOptions.getTenantId();+ String userId = filterOptions.getUserId();+ String assetId = filterOptions.getAssetId();+ Long fromTimestamp = filterOptions.getFromTimestamp();- List<String> assets = filterOptions.getSelectedTargetType() == Notification.TargetType.ASSET- ? Collections.singletonList(filterOptions.getSelectedTarget()) : null;-- Long timestamp = null;- if (filterOptions.getSelectedSentIn() != null) {- switch (filterOptions.getSelectedSentIn()) {-- case DAY:- timestamp = new Date(new Date().getTime() - (24L * 60 * 60 * 1000)).getTime();- break;- case WEEK:- timestamp = new Date(new Date().getTime() - (7L * 24 * 60 * 60 * 1000)).getTime();- break;- case MONTH:- timestamp = new Date(new Date().getTime() - (31L * 24 * 60 * 60 * 1000)).getTime();- break;- }- }-- Long finalTimestamp = timestamp;environment.getApp().getRequests().sendAndReturn(sentNotificationArrayMapper,requestParams -> notificationResource.getNotifications(requestParams,null,- types,- finalTimestamp,- Collections.singletonList(filterOptions.getSelectedRealm()),- users,- assets),+ filterOptions.getSelectedNotificationType(),+ fromTimestamp,+ null,+ tenantId,+ userId,+ assetId),200,notificationConsumer::accept);}diff --git a/client/src/main/java/org/openremote/app/client/notifications/NotificationsViewImpl.java b/client/src/main/java/org/openremote/app/client/notifications/NotificationsViewImpl.javaindex fb913071a..fb31dc13c 100644--- a/client/src/main/java/org/openremote/app/client/notifications/NotificationsViewImpl.java+++ b/client/src/main/java/org/openremote/app/client/notifications/NotificationsViewImpl.java@@ -27,9 +27,6 @@ import com.google.gwt.user.client.ui.Composite;import com.google.gwt.user.client.ui.FlowPanel;import com.google.gwt.user.client.ui.HTMLPanel;import com.google.gwt.user.client.ui.Label;-import com.google.inject.Provider;-import org.openremote.app.client.Environment;-import org.openremote.app.client.app.dialog.Confirmation;import org.openremote.app.client.assets.browser.AssetBrowser;import org.openremote.app.client.i18n.ManagerMessages;import org.openremote.app.client.style.WidgetStyle;@@ -280,27 +277,51 @@ public class NotificationsViewImpl extends Composite implements NotificationsViethis.notification = notification;setStyleName("flex-none layout vertical or-FormListItem");- FormGroup statusGroup = new FormGroup();- statusGroup.setFormGroupActions(new FormGroupActions());- FormField statusField = new FormField();- FormLabel statusLabel = new FormLabel(managerMessages.status());- statusGroup.setFormLabel(statusLabel);- statusGroup.setFormField(statusField);- FormOutputText statusTxt = new FormOutputText("");- statusField.add(statusTxt);-- FormGroup createdOnGroup = new FormGroup();- createdOnGroup.addStyleName("flex");- createdOnGroup.setFormGroupActions(new FormGroupActions());- FormField createdOnField = new FormField();- FormLabel createdOnLabel = new FormLabel(managerMessages.createdOn());- createdOnGroup.setFormLabel(createdOnLabel);- createdOnGroup.setFormField(createdOnField);- FormOutputText createdOnTxt = new FormOutputText(+ FormGroup sentOnGroup = new FormGroup();+ sentOnGroup.addStyleName("flex");+ sentOnGroup.setFormGroupActions(new FormGroupActions());+ FormField sentOnField = new FormField();+ FormLabel sentOnLabel = new FormLabel(managerMessages.sentOn());+ sentOnGroup.setFormLabel(sentOnLabel);+ sentOnGroup.setFormField(sentOnField);+ FormOutputText sentOnTxt = new FormOutputText(DateTimeFormat.getFormat(Constants.DEFAULT_DATETIME_FORMAT).format(notification.getSentOn()));- createdOnTxt.addStyleName("flex");- createdOnField.add(createdOnTxt);+ sentOnTxt.addStyleName("flex");+ sentOnField.add(sentOnTxt);+ add(sentOnGroup);++ FormGroup deliveredOnGroup = new FormGroup();+ deliveredOnGroup.addStyleName("flex");+ deliveredOnGroup.setFormGroupActions(new FormGroupActions());+ FormField deliveredOnField = new FormField();+ FormLabel deliveredOnLabel = new FormLabel(managerMessages.deliveredOn());+ deliveredOnGroup.setFormLabel(deliveredOnLabel);+ deliveredOnGroup.setFormField(deliveredOnField);+ FormOutputText deliveredOnTxt = new FormOutputText(+ notification.getDeliveredOn() != null+ ? DateTimeFormat.getFormat(Constants.DEFAULT_DATETIME_FORMAT).format(notification.getDeliveredOn())+ : ""+ );+ deliveredOnTxt.addStyleName("flex");+ deliveredOnField.add(deliveredOnTxt);+ add(deliveredOnGroup);++ FormGroup acknowledgedOnGroup = new FormGroup();+ acknowledgedOnGroup.addStyleName("flex");+ acknowledgedOnGroup.setFormGroupActions(new FormGroupActions());+ FormField acknowledgedOnField = new FormField();+ FormLabel acknowledgedOnLabel = new FormLabel(managerMessages.acknowledgedOn());+ acknowledgedOnGroup.setFormLabel(acknowledgedOnLabel);+ acknowledgedOnGroup.setFormField(acknowledgedOnField);+ FormOutputText acknowledgedOnTxt = new FormOutputText(+ notification.getAcknowledgedOn() != null+ ? DateTimeFormat.getFormat(Constants.DEFAULT_DATETIME_FORMAT).format(notification.getAcknowledgedOn())+ : ""+ );+ acknowledgedOnTxt.addStyleName("flex");+ acknowledgedOnField.add(acknowledgedOnTxt);+ add(acknowledgedOnGroup);FormButton deleteButton = new FormButton();deleteButton.setDanger(true);@@ -310,22 +331,16 @@ public class NotificationsViewImpl extends Composite implements NotificationsVieif (presenter != null)presenter.deleteNotification(notification.getId());});- statusGroup.getFormGroupActions().add(deleteButton);-- FlowPanel createdStatusPanel = new FlowPanel();- createdStatusPanel.setStyleName("layout horizontal wrap");- createdStatusPanel.add(createdOnGroup);- createdStatusPanel.add(statusGroup);- add(createdStatusPanel);-- FormGroup titleGroup = new FormGroup();- FormField titleField = new FormField();- FormLabel titleLabel = new FormLabel(managerMessages.title());- titleGroup.setFormLabel(titleLabel);- titleGroup.setFormField(titleField);- FormOutputText titleTxt = new FormOutputText(/*notification.getTitle()*/);- titleField.add(titleTxt);- add(titleGroup);+ sentOnGroup.getFormGroupActions().add(deleteButton);++ FormGroup typeGroup = new FormGroup();+ FormField typeField = new FormField();+ FormLabel typeLabel = new FormLabel(managerMessages.type());+ typeGroup.setFormLabel(typeLabel);+ typeGroup.setFormField(typeField);+ FormOutputText typeTxt = new FormOutputText(notification.getType());+ typeField.add(typeTxt);+ add(typeGroup);FormGroup messageGroup = new FormGroup();FormField messageField = new FormField();@@ -337,36 +352,27 @@ public class NotificationsViewImpl extends Composite implements NotificationsViemessageTxt.setHeight("3em");messageTxt.setResizable(false);messageTxt.setBorder(true);- messageTxt.setText(""/*notification.getBody()*/);+ messageTxt.setText(notification.getMessage().toString());messageField.add(messageTxt);add(messageGroup);-/* for (int i = 0; i < notification.getActions().length(); i++) {- notification.getActions().get(i).ifPresent(action -> {- FormGroup actionGroup = new FormGroup();- FormField actionField = new FormField();- FormLabel actionLabel = new FormLabel(managerMessages.action());- actionGroup.setFormLabel(actionLabel);- actionGroup.setFormField(actionField);- FormTextArea actionTxt = new FormTextArea();- actionTxt.setReadOnly(true);- actionTxt.setResizable(false);- actionTxt.setBorder(true);- actionTxt.setHeight("3em");- actionTxt.setText(action.toJson());- actionField.add(actionTxt);- add(actionGroup);- });- }*/-- FormGroup appUrlGroup = new FormGroup();- FormField appUrlField = new FormField();- FormLabel appUrlLabel = new FormLabel(managerMessages.notificationActionUrl());- appUrlGroup.setFormLabel(appUrlLabel);- appUrlGroup.setFormField(appUrlField);- FormOutputText appUrlTxt = new FormOutputText(/*notification.getAppUrl()*/);- appUrlField.add(appUrlTxt);- add(appUrlGroup);+ FormGroup acknowledgementGroup = new FormGroup();+ FormField acknowledgementField = new FormField();+ FormLabel acknowledgementLabel = new FormLabel(managerMessages.acknowledgement());+ acknowledgementGroup.setFormLabel(acknowledgementLabel);+ acknowledgementGroup.setFormField(acknowledgementField);+ FormOutputText acknowledgementTxt = new FormOutputText(notification.getAcknowledgement());+ acknowledgementField.add(acknowledgementTxt);+ add(acknowledgementGroup);++ FormGroup errorGroup = new FormGroup();+ FormField errorField = new FormField();+ FormLabel errorLabel = new FormLabel(managerMessages.error());+ errorGroup.setFormLabel(errorLabel);+ errorGroup.setFormField(errorField);+ FormOutputText errorTxt = new FormOutputText(notification.getError());+ errorField.add(errorTxt);+ add(errorGroup);}public SentNotification getNotification() {diff --git a/client/src/main/java/org/openremote/app/client/notifications/SendOptions.java b/client/src/main/java/org/openremote/app/client/notifications/SendOptions.javaindex 01ec31ca2..3e010492a 100644--- a/client/src/main/java/org/openremote/app/client/notifications/SendOptions.java+++ b/client/src/main/java/org/openremote/app/client/notifications/SendOptions.java@@ -36,8 +36,8 @@ public class SendOptions extends FilterOptions {protected Supplier<AbstractNotificationMessage> messageSupplier;protected AbstractNotificationMessage message;- public SendOptions(Map<String, String> realms, BiConsumer<FilterOptions, Consumer<Map<String, String>>> targetsSupplier, Supplier<AbstractNotificationMessage> messageSupplier) {- super(realms, targetsSupplier);+ public SendOptions(Map<String, String> realms, Map<String, String> realmIds, BiConsumer<FilterOptions, Consumer<Map<String, String>>> targetsSupplier, Supplier<AbstractNotificationMessage> messageSupplier) {+ super(realms, realmIds, targetsSupplier);this.messageSupplier = messageSupplier;}diff --git a/client/src/main/resources/org/openremote/app/client/i18n/ManagerMessages.properties b/client/src/main/resources/org/openremote/app/client/i18n/ManagerMessages.propertiesindex b59abc29e..9a2d76276 100644--- a/client/src/main/resources/org/openremote/app/client/i18n/ManagerMessages.properties+++ b/client/src/main/resources/org/openremote/app/client/i18n/ManagerMessages.properties@@ -73,6 +73,11 @@ createAsset=Create assetdeleteAsset=Delete assetassetType=Asset typecreatedOn=Created on+sentOn=Sent on+deliveredOn=Delivered on+acknowledgedOn=Acknowledged on+acknowledgement=Acknowledgement+error=ErrorselectedLocation=Selected locationassetCreated=Asset created: {0}assetUpdated=Asset saved: {0}diff --git a/manager/src/main/java/org/openremote/manager/notification/NotificationResourceImpl.java b/manager/src/main/java/org/openremote/manager/notification/NotificationResourceImpl.javaindex c068b9652..833666704 100644--- a/manager/src/main/java/org/openremote/manager/notification/NotificationResourceImpl.java+++ b/manager/src/main/java/org/openremote/manager/notification/NotificationResourceImpl.java@@ -25,16 +25,16 @@ import org.openremote.manager.asset.AssetStorageService;import org.openremote.manager.security.ManagerIdentityService;import org.openremote.model.Constants;import org.openremote.model.asset.Asset;-import org.openremote.model.query.BaseAssetQuery;import org.openremote.model.http.RequestParams;import org.openremote.model.notification.Notification;import org.openremote.model.notification.NotificationResource;import org.openremote.model.notification.SentNotification;+import org.openremote.model.query.BaseAssetQuery;import org.openremote.model.value.Value;import javax.ws.rs.WebApplicationException;+import java.util.Collections;import java.util.HashMap;-import java.util.List;import java.util.Map;import java.util.logging.Logger;@@ -61,18 +61,33 @@ public class NotificationResourceImpl extends WebResource implements Notificatio}@Override- public SentNotification[] getNotifications(RequestParams requestParams, List<Long> ids, List<String> types, Long timestamp, List<String> tenantIds, List<String> userIds, List<String> assetIds) {+ public SentNotification[] getNotifications(RequestParams requestParams, Long id, String type, Long fromTimestamp, Long toTimestamp, String tenantId, String userId, String assetId) {try {- return notificationService.getNotifications(ids, types, timestamp, tenantIds, userIds, assetIds).toArray(new SentNotification[0]);+ return notificationService.getNotifications(+ id != null ? Collections.singletonList(id) : null,+ type != null ? Collections.singletonList(type) : null,+ fromTimestamp,+ toTimestamp,+ tenantId != null ? Collections.singletonList(tenantId) : null,+ userId != null ? Collections.singletonList(userId) : null,+ assetId != null ? Collections.singletonList(assetId) : null+ ).toArray(new SentNotification[0]);} catch (IllegalArgumentException e) {throw new WebApplicationException("Invalid criteria set", BAD_REQUEST);}}@Override- public void removeNotifications(RequestParams requestParams, List<Long> ids, List<String> types, Long timestamp, List<String> tenantIds, List<String> userIds, List<String> assetIds) {+ public void removeNotifications(RequestParams requestParams, Long id, String type, Long fromTimestamp, Long toTimestamp, String tenantId, String userId, String assetId) {try {- notificationService.removeNotifications(ids, types, timestamp, tenantIds, userIds, assetIds);+ notificationService.removeNotifications(+ id != null ? Collections.singletonList(id) : null,+ type != null ? Collections.singletonList(type) : null,+ fromTimestamp,+ toTimestamp,+ tenantId != null ? Collections.singletonList(tenantId) : null,+ userId != null ? Collections.singletonList(userId) : null,+ assetId != null ? Collections.singletonList(assetId) : null);} catch (IllegalArgumentException e) {throw new WebApplicationException("Invalid criteria set", BAD_REQUEST);}diff --git a/manager/src/main/java/org/openremote/manager/notification/NotificationService.java b/manager/src/main/java/org/openremote/manager/notification/NotificationService.javaindex d9d8e4f71..b577d94c4 100644--- a/manager/src/main/java/org/openremote/manager/notification/NotificationService.java+++ b/manager/src/main/java/org/openremote/manager/notification/NotificationService.java@@ -338,11 +338,11 @@ public class NotificationService extends RouteBuilder implements ContainerServicreturn persistenceService.doReturningTransaction(em -> em.find(SentNotification.class, notificationId));}- public List<SentNotification> getNotifications(List<Long> ids, List<String> types, Long timestamp, List<String> tenantIds, List<String> userIds, List<String> assetIds) throws IllegalArgumentException {+ public List<SentNotification> getNotifications(List<Long> ids, List<String> types, Long fromTimestamp, Long toTimestamp, List<String> tenantIds, List<String> userIds, List<String> assetIds) throws IllegalArgumentException {StringBuilder builder = new StringBuilder();builder.append("select n from SentNotification n where 1=1");List<Object> parameters = new ArrayList<>();- processCriteria(builder, parameters, ids, types, timestamp, tenantIds, userIds, assetIds);+ processCriteria(builder, parameters, ids, types, fromTimestamp, toTimestamp, tenantIds, userIds, assetIds);return persistenceService.doReturningTransaction(entityManager -> {TypedQuery<SentNotification> query = entityManager.createQuery(builder.toString(), SentNotification.class);@@ -360,12 +360,12 @@ public class NotificationService extends RouteBuilder implements ContainerServic);}- public void removeNotifications(List<Long> ids, List<String> types, Long timestamp, List<String> tenantIds, List<String> userIds, List<String> assetIds) throws IllegalArgumentException {+ public void removeNotifications(List<Long> ids, List<String> types, Long fromTimestamp, Long toTimestamp, List<String> tenantIds, List<String> userIds, List<String> assetIds) throws IllegalArgumentException {StringBuilder builder = new StringBuilder();builder.append("delete from SentNotification n where 1=1");List<Object> parameters = new ArrayList<>();- processCriteria(builder, parameters, ids, types, timestamp, tenantIds, userIds, assetIds);+ processCriteria(builder, parameters, ids, types, fromTimestamp, toTimestamp, tenantIds, userIds, assetIds);persistenceService.doTransaction(entityManager -> {Query query = entityManager.createQuery(builder.toString());@@ -375,7 +375,7 @@ public class NotificationService extends RouteBuilder implements ContainerServic});}- protected void processCriteria(StringBuilder builder, List<Object> parameters, List<Long> ids, List<String> types, Long timestamp, List<String> tenantIds, List<String> userIds, List<String> assetIds) {+ protected void processCriteria(StringBuilder builder, List<Object> parameters, List<Long> ids, List<String> types, Long fromTimestamp, Long toTimestamp, List<String> tenantIds, List<String> userIds, List<String> assetIds) {boolean hasIds = ids != null && !ids.isEmpty();boolean hasTypes = types != null && !types.isEmpty();boolean hasTenants = tenantIds != null && !tenantIds.isEmpty();@@ -399,7 +399,7 @@ public class NotificationService extends RouteBuilder implements ContainerServiccounter++;}- if (timestamp == null && counter == 0) {+ if (fromTimestamp == null && toTimestamp == null && counter == 0) {LOG.info("No filters set for remove notifications request so not allowed");throw new IllegalArgumentException("No criteria specified");}@@ -417,16 +417,30 @@ public class NotificationService extends RouteBuilder implements ContainerServicparameters.add(types);}- if (hasTenants) {+ if (fromTimestamp != null) {+ builder.append(" AND n.sentOn <= ?")+ .append(parameters.size() + 1);++ parameters.add(new Date(fromTimestamp));+ }++ if (toTimestamp != null) {+ builder.append(" AND n.sentOn <= ?")+ .append(parameters.size() + 1);++ parameters.add(new Date(toTimestamp));+ }++ if (hasAssets) {builder.append(" AND n.target = ?").append(parameters.size() + 1).append(" AND n.targetId IN ?").append(parameters.size() + 2);- parameters.add(Notification.TargetType.TENANT);- parameters.add(tenantIds);- }- if (hasUsers) {+ parameters.add(Notification.TargetType.ASSET);+ parameters.add(assetIds);++ } else if (hasUsers) {builder.append(" AND n.target = ?").append(parameters.size() + 1).append(" AND n.targetId IN ?")@@ -434,23 +448,15 @@ public class NotificationService extends RouteBuilder implements ContainerServicparameters.add(Notification.TargetType.USER);parameters.add(userIds);- }- if (hasAssets) {+ } else if (hasTenants) {builder.append(" AND n.target = ?").append(parameters.size() + 1).append(" AND n.targetId IN ?").append(parameters.size() + 2);- parameters.add(Notification.TargetType.ASSET);- parameters.add(assetIds);- }-- if (timestamp != null) {- builder.append(" AND n.sentOn <= ?")- .append(parameters.size() + 1);-- parameters.add(new Date(timestamp));+ parameters.add(Notification.TargetType.TENANT);+ parameters.add(tenantIds);}}diff --git a/manager/src/main/java/org/openremote/manager/notification/PushNotificationHandler.java b/manager/src/main/java/org/openremote/manager/notification/PushNotificationHandler.javaindex 80ccc7165..e9c1b9bb4 100644--- a/manager/src/main/java/org/openremote/manager/notification/PushNotificationHandler.java+++ b/manager/src/main/java/org/openremote/manager/notification/PushNotificationHandler.java@@ -393,7 +393,9 @@ public class PushNotificationHandler extends RouteBuilder implements Notificatio// with actions that use the actions from the dataif (pushMessage.getData() != null || pushMessage.getAction() != null || pushMessage.getButtons() != null) {androidConfigBuilder.putData("or-title", pushMessage.getTitle());- androidConfigBuilder.putData("or-body", pushMessage.getBody());+ if (pushMessage.getBody() != null) {+ androidConfigBuilder.putData("or-body", pushMessage.getBody());+ }}// Use alert dictionary for apnsdiff --git a/model/src/main/java/org/openremote/model/notification/NotificationResource.java b/model/src/main/java/org/openremote/model/notification/NotificationResource.javaindex 85959ef95..d003d21ce 100644--- a/model/src/main/java/org/openremote/model/notification/NotificationResource.java+++ b/model/src/main/java/org/openremote/model/notification/NotificationResource.java@@ -48,12 +48,23 @@ public interface NotificationResource {@RolesAllowed({"read:admin"})@SuppressWarnings("unusable-by-js")SentNotification[] getNotifications(@BeanParam RequestParams requestParams,- @QueryParam("ids") List<Long> ids,- @QueryParam("types") List<String> types,- @QueryParam("before") Long timestamp,- @QueryParam("tenantId") List<String> tenantIds,- @QueryParam("userId") List<String> userIds,- @QueryParam("assetId") List<String> assetIds);+ @QueryParam("id") Long id,+ @QueryParam("type") String type,+ @QueryParam("from") Long fromTimestamp,+ @QueryParam("to") Long toTimestamp,+ @QueryParam("tenantId") String tenantId,+ @QueryParam("userId") String userId,+ @QueryParam("assetId") String assetId);+ // RT: Was using lists here but they don't work with JSAPI because GWT doesn't use JSArrays for lists - another+ // reason to get away from GWT+// SentNotification[] getNotifications(@BeanParam RequestParams requestParams,+// @QueryParam("id") List<Long> ids,+// @QueryParam("type") List<String> types,+// @QueryParam("from") Long fromTimestamp,+// @QueryParam("to") Long toTimestamp,+// @QueryParam("tenantId") List<String> tenantIds,+// @QueryParam("userId") List<String> userIds,+// @QueryParam("assetId") List<String> assetIds);/*** Removes all sent notifications that have been sent to the specified targets; optionally limiting the scope of the@@ -68,12 +79,23 @@ public interface NotificationResource {@RolesAllowed({"write:admin"})@SuppressWarnings("unusable-by-js")void removeNotifications(@BeanParam RequestParams requestParams,- @QueryParam("ids") List<Long> ids,- @QueryParam("types") List<String> types,- @QueryParam("before") Long timestamp,- @QueryParam("tenantIds") List<String> tenantIds,- @QueryParam("userIds") List<String> userIds,- @QueryParam("assetIds") List<String> assetIds);+ @QueryParam("id") Long id,+ @QueryParam("type") String type,+ @QueryParam("from") Long fromTimestamp,+ @QueryParam("to") Long toTimestamp,+ @QueryParam("tenantId") String tenantId,+ @QueryParam("userId") String userId,+ @QueryParam("assetId") String assetId);+ // RT: Was using lists here but they don't work with JSAPI because GWT doesn't use JSArrays for lists - another+ // reason to get away from GWT+// void removeNotifications(@BeanParam RequestParams requestParams,+// @QueryParam("id") List<Long> ids,+// @QueryParam("type") List<String> types,+// @QueryParam("from") Long fromTimestamp,+// @QueryParam("to") Long toTimestamp,+// @QueryParam("tenantId") List<String> tenantIds,+// @QueryParam("userId") List<String> userIds,+// @QueryParam("assetId") List<String> assetIds);/*** Remove a specific sent notification by ID.diff --git a/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy b/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovyindex ff8fe0440..10d91e4cd 100644--- a/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy+++ b/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy@@ -274,7 +274,11 @@ class NotificationTest extends Specification implements ManagerContainerTrait {// -----------------------------------------------when: "the admin user requests the notifications for customer A consoles"- def notifications = adminNotificationResource.getNotifications(null, null, null, null, null, null, [testuser2Console.id, testuser3Console1.id, testuser3Console2.id, anonymousConsole.id])+ def notifications = []+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console1.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, anonymousConsole.id))then: "all notifications sent to these consoles should be returned"assert notifications.size() == 15@@ -288,7 +292,11 @@ class NotificationTest extends Specification implements ManagerContainerTrait {when: "the admin user marks a customer A console notification as delivered and requests the notifications for customer A consoles"adminNotificationResource.notificationDelivered(null, testuser2Console.id, notifications.find {n -> n.targetId == testuser2Console.id}.id)- notifications = adminNotificationResource.getNotifications(null, null, null, null, null, null, [testuser2Console.id, testuser3Console1.id, testuser3Console2.id, anonymousConsole.id])+ notifications = []+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console1.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, anonymousConsole.id))then: "the notification should have been updated"assert notifications.size() == 15@@ -296,7 +304,11 @@ class NotificationTest extends Specification implements ManagerContainerTrait {when: "the admin user marks a customer A console notification as delivered and requests the notifications for customer A consoles"adminNotificationResource.notificationAcknowledged(null, testuser2Console.id, notifications.find {n -> n.targetId == testuser2Console.id && n.deliveredOn != null}.id, Values.create("dismissed"))- notifications = adminNotificationResource.getNotifications(null, null, null, null, null, null, [testuser2Console.id, testuser3Console1.id, testuser3Console2.id, anonymousConsole.id])+ notifications = []+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console1.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, anonymousConsole.id))then: "the notification should have been updated"assert notifications.size() == 15@@ -311,7 +323,11 @@ class NotificationTest extends Specification implements ManagerContainerTrait {when: "a regular user marks a console notification for their own console as delivered"testuser3NotificationResource.notificationDelivered(null, testuser3Console1.id, notifications.find {n -> n.targetId == testuser3Console1.id}.id)- notifications = adminNotificationResource.getNotifications(null, null, null, null, null, null, [testuser2Console.id, testuser3Console1.id, testuser3Console2.id, anonymousConsole.id])+ notifications = []+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console1.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, anonymousConsole.id))then: "the notification should have been updated"assert notifications.size() == 15@@ -326,21 +342,25 @@ class NotificationTest extends Specification implements ManagerContainerTrait {when: "an anonymous user marks a console notification for their own console as delivered"anonymousNotificationResource.notificationDelivered(null, anonymousConsole.id, notifications.find {n -> n.targetId == anonymousConsole.id}.id)- notifications = adminNotificationResource.getNotifications(null, null, null, null, null, null, [testuser2Console.id, testuser3Console1.id, testuser3Console2.id, anonymousConsole.id])+ notifications = []+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console1.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, anonymousConsole.id))then: "the notification should have been updated"assert notifications.size() == 15assert notifications.count {n -> n.targetId == anonymousConsole.id && n.deliveredOn != null} == 1when: "a regular user tries to remove notifications"- testuser1NotificationResource.removeNotifications(null, null, [PushNotificationMessage.TYPE], null, [MASTER_REALM], null, null)+ testuser1NotificationResource.removeNotifications(null, null, PushNotificationMessage.TYPE, null, null, MASTER_REALM, null, null)then: "access should be forbidden"ex = thrown()ex.response.status == 403when: "a restricted user tries to remove notifications"- testuser3NotificationResource.removeNotifications(null, null, [PushNotificationMessage.TYPE], null, [realm], null, null)+ testuser3NotificationResource.removeNotifications(null, null, PushNotificationMessage.TYPE, null, null, realm, null, null)then: "access should be forbidden"ex = thrown()@@ -348,29 +368,42 @@ class NotificationTest extends Specification implements ManagerContainerTrait {when: "the admin user removes notifications by timestamp and the notifications are retrieved again"notifications = notifications.sort {n -> n.sentOn}- adminNotificationResource.removeNotifications(null, null, [PushNotificationMessage.TYPE], notifications[0].sentOn.getTime(), null, null, null)- notifications = adminNotificationResource.getNotifications(null, null, null, null, null, null, [testuser2Console.id, testuser3Console1.id, testuser3Console2.id, anonymousConsole.id])+ adminNotificationResource.removeNotifications(null, null, PushNotificationMessage.TYPE, notifications[0].sentOn.getTime(), null, null, null, null)+ notifications = []+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console1.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, anonymousConsole.id))then: "notifications sent before or at that time should have been removed"assert notifications.size() == 11when: "the admin user removes notifications sent to specific console assets without other constraints and the notifications are retrieved again"- adminNotificationResource.removeNotifications(null, null, null, null, null, null, [testuser3Console1.id, testuser3Console2.id])- notifications = adminNotificationResource.getNotifications(null, null, null, null, null, null, [testuser2Console.id, testuser3Console1.id, testuser3Console2.id, anonymousConsole.id])+ adminNotificationResource.removeNotifications(null, null, null, null, null, null, null, testuser3Console1.id)+ adminNotificationResource.removeNotifications(null, null, null, null, null, null, null, testuser3Console2.id)+ notifications = []+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console1.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, anonymousConsole.id))then: "all notifications sent to those consoles should have been removed"assert notifications.size() == 5assert notifications.count {n -> n.targetId == testuser3Console1.id || n.targetId == testuser3Console2.id} == 0when: "the admin user removes notifications by type and the notifications are retrieved again"- adminNotificationResource.removeNotifications(null, null, [PushNotificationMessage.TYPE], null, null, null, null)- notifications = adminNotificationResource.getNotifications(null, null, null, null, null, null, [testuser2Console.id, testuser3Console1.id, testuser3Console2.id, anonymousConsole.id])+ adminNotificationResource.removeNotifications(null, null, PushNotificationMessage.TYPE, null, null, null, null, null)+ notifications = []+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console1.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, anonymousConsole.id))then: "one notification should have been removed"assert notifications.size() == 0when: "the admin user removes notifications without sufficient constraints"- adminNotificationResource.removeNotifications(null, null, null, null, null, null, null)+ adminNotificationResource.removeNotifications(null, null, null, null, null, null, null, null)then: "request should not be allowed"ex = thrown()@@ -389,21 +422,33 @@ class NotificationTest extends Specification implements ManagerContainerTrait {advancePseudoClock(ChronoUnit.MILLIS.between(Instant.ofEpochMilli(getClockTimeOf(container)).atZone(ZoneId.systemDefault()), advancement), TimeUnit.MILLISECONDS, container)notification.setRepeatFrequency(RepeatFrequency.HOURLY)testuser3NotificationResource.sendNotification(null, notification)- notifications = adminNotificationResource.getNotifications(null, null, null, null, null, null, [testuser2Console.id, testuser3Console1.id, testuser3Console2.id, anonymousConsole.id])+ notifications = []+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console1.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, anonymousConsole.id))then: "the notifications should have been sent"assert notifications.size() == 2when: "a repeat frequency is set and a notification with the same name and scope as a previous notification is sent within the repeat window"testuser3NotificationResource.sendNotification(null, notification)- notifications = adminNotificationResource.getNotifications(null, null, null, null, null, null, [testuser2Console.id, testuser3Console1.id, testuser3Console2.id, anonymousConsole.id])+ notifications = []+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console1.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, anonymousConsole.id))then: "no new notifications should have been sent"assert notifications.size() == 2when: "a repeat frequency is set and a notification with the same name but different scope is sent within the repeat window"adminNotificationResource.sendNotification(null, notification)- notifications = adminNotificationResource.getNotifications(null, null, null, null, null, null, [testuser2Console.id, testuser3Console1.id, testuser3Console2.id, anonymousConsole.id])+ notifications = []+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console1.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, anonymousConsole.id))then: "new notifications should have been sent"assert notifications.size() == 4@@ -411,7 +456,11 @@ class NotificationTest extends Specification implements ManagerContainerTrait {when: "time advances less than the repeat frequency and the notification is sent again"advancePseudoClock(30, TimeUnit.SECONDS, container)adminNotificationResource.sendNotification(null, notification)- notifications = adminNotificationResource.getNotifications(null, null, null, null, null, null, [testuser2Console.id, testuser3Console1.id, testuser3Console2.id, anonymousConsole.id])+ notifications = []+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console1.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, anonymousConsole.id))then: "no new notifications should have been sent"assert notifications.size() == 4@@ -419,7 +468,11 @@ class NotificationTest extends Specification implements ManagerContainerTrait {when: "time advances more than the repeat frequency and the notification is sent again"advancePseudoClock(2, TimeUnit.MINUTES, container)adminNotificationResource.sendNotification(null, notification)- notifications = adminNotificationResource.getNotifications(null, null, null, null, null, null, [testuser2Console.id, testuser3Console1.id, testuser3Console2.id, anonymousConsole.id])+ notifications = []+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console1.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, anonymousConsole.id))then: "new notifications should have been sent"assert notifications.size() == 6@@ -428,7 +481,11 @@ class NotificationTest extends Specification implements ManagerContainerTrait {notification.setRepeatInterval("1mn")advancePseudoClock(10, TimeUnit.DAYS, container)adminNotificationResource.sendNotification(null, notification)- notifications = adminNotificationResource.getNotifications(null, null, null, null, null, null, [testuser2Console.id, testuser3Console1.id, testuser3Console2.id, anonymousConsole.id])+ notifications = []+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console1.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, anonymousConsole.id))then: "no new notifications should have been sent"assert notifications.size() == 6@@ -436,7 +493,11 @@ class NotificationTest extends Specification implements ManagerContainerTrait {when: "time advances more than the repeat interval and the notification is sent again"advancePseudoClock(30, TimeUnit.DAYS, container)adminNotificationResource.sendNotification(null, notification)- notifications = adminNotificationResource.getNotifications(null, null, null, null, null, null, [testuser2Console.id, testuser3Console1.id, testuser3Console2.id, anonymousConsole.id])+ notifications = []+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser2Console.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console1.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, testuser3Console2.id))+ notifications.addAll(adminNotificationResource.getNotifications(null, null, null, null, null, null, null, anonymousConsole.id))then: "new notifications should have been sent"assert notifications.size() == 8