Search in sources :

Example 6 with DefaultNotificationFilterPreference

use of org.xwiki.notifications.filters.internal.DefaultNotificationFilterPreference in project xwiki-platform by xwiki.

the class WatchedUserReference method createExclusiveFilterPreference.

@Override
public NotificationFilterPreference createExclusiveFilterPreference() {
    DefaultNotificationFilterPreference filterPreference = new DefaultNotificationFilterPreference(Long.toString(new Date().getTime()));
    filterPreference.setEnabled(true);
    filterPreference.setFilterType(NotificationFilterType.EXCLUSIVE);
    filterPreference.setFilterName(EventUserFilter.FILTER_NAME);
    filterPreference.setNotificationFormats(Sets.newHashSet(NotificationFormat.values()));
    filterPreference.setProviderHint(UserProfileNotificationPreferenceProvider.NAME);
    filterPreference.setActive(false);
    // Properties
    Map<NotificationFilterProperty, List<String>> preferenceProperties = new HashMap<>();
    filterPreference.setPreferenceProperties(preferenceProperties);
    preferenceProperties.put(NotificationFilterProperty.EVENT_TYPE, Collections.emptyList());
    preferenceProperties.put(NotificationFilterProperty.USER, Collections.singletonList(userId));
    return filterPreference;
}
Also used : DefaultNotificationFilterPreference(org.xwiki.notifications.filters.internal.DefaultNotificationFilterPreference) NotificationFilterProperty(org.xwiki.notifications.filters.NotificationFilterProperty) HashMap(java.util.HashMap) List(java.util.List) Date(java.util.Date)

Aggregations

DefaultNotificationFilterPreference (org.xwiki.notifications.filters.internal.DefaultNotificationFilterPreference)6 HashMap (java.util.HashMap)4 List (java.util.List)4 NotificationFilterProperty (org.xwiki.notifications.filters.NotificationFilterProperty)4 Date (java.util.Date)3 ScopeNotificationFilterPreference (org.xwiki.notifications.filters.internal.scope.ScopeNotificationFilterPreference)1