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:
- Loads the
NotificationSchedule
- Generates the list of
SysUser
subscribers fromnotificationSchedule.subscribers
by merging subscribed user groups and subscribed users, and keeping only active users. - If the subscribe list is empty, skips execution.
- Calls the
notificationSchedule.generator
method with argumentList<SysUser> recipients
.
UI
In GGCE Web Admin tools in Scheduler the Adminstrator is able to manage the subscribers
for each NotificationSchedule
record.