Skip to content

Custom subscriber list for scheduled notifications

This ticket adds support for user-defined subscriptions to scheduled notifications. Instead of using a building the list of recipients in code as described in #468 (closed), we allow the Administrator to define a list of subscribers for each NotificationSchedule record separately:

class NotificationSchedule ... {
 @OneToMany(fetch = FetchType.LAZY, mappedBy = "notificationSchedule")
 private List<NotificationScheduleSubscriber> subscribers = new ArrayList<NotificationScheduleSubscriber>();
}

@Table(name = "notification_schedule_subscriber")
public static class NotificationScheduleSubscriber {
 @ManyToOne
 NotificationSchedule notificationSchedule;

 @ManyToOne(fetch = FetchType.EAGER)
 AclSid sid;
}

Executing scheduled tasks

Instead of calling the notificationSchedule.generator method directly in the Spring scheduler, we want to call a wrapper method NotificationScheduleServiceImpl.executeScheduledTask(long notificationScheduleId) instead. This method then:

  1. Loads the NotificationSchedule
  2. Generates the list of SysUser subscribers from notificationSchedule.subscribers by merging subscribed user groups and subscribed users, and keeping only active users.
  3. If the subscribe list is empty, skips execution.
  4. Calls the notificationSchedule.generator method with argument List<SysUser> recipients.

UI

In GGCE Web Admin tools in Scheduler the Adminstrator is able to manage the subscribers for each NotificationSchedule record.

Edited by Matija Obreza
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information