diff options
author | Anton Tananaev <anton@traccar.org> | 2024-05-20 07:01:49 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2024-05-20 07:01:49 -0700 |
commit | 445a2c5d0763bb42880ff1f9db93d755f6fdfa62 (patch) | |
tree | 607ebeac6952b466438ee32bbb538221dbf76e12 /src | |
parent | bb1cded19d54cd7733b6ab29240c79b9c0e1e7b7 (diff) | |
download | trackermap-server-445a2c5d0763bb42880ff1f9db93d755f6fdfa62.tar.gz trackermap-server-445a2c5d0763bb42880ff1f9db93d755f6fdfa62.tar.bz2 trackermap-server-445a2c5d0763bb42880ff1f9db93d755f6fdfa62.zip |
Filter announcement channels
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/api/resource/NotificationResource.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/api/resource/NotificationResource.java b/src/main/java/org/traccar/api/resource/NotificationResource.java index 5eb9f6c62..a41d00cf3 100644 --- a/src/main/java/org/traccar/api/resource/NotificationResource.java +++ b/src/main/java/org/traccar/api/resource/NotificationResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 - 2023 Anton Tananaev (anton@traccar.org) + * Copyright 2016 - 2024 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,6 +46,8 @@ import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList; import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; @Path("notifications") @Produces(MediaType.APPLICATION_JSON) @@ -80,8 +82,11 @@ public class NotificationResource extends ExtendedObjectResource<Notification> { @GET @Path("notificators") - public Collection<Typed> getNotificators() { - return notificatorManager.getAllNotificatorTypes(); + public Collection<Typed> getNotificators(@QueryParam("announcement") boolean announcement) { + Set<String> announcementsUnsupported = Set.of("command", "web"); + return notificatorManager.getAllNotificatorTypes().stream() + .filter(typed -> !announcement || !announcementsUnsupported.contains(typed.getType())) + .collect(Collectors.toUnmodifiableSet()); } @POST |