@Component @Named(value="notification.preferences") @Singleton public class NotificationPreferenceScriptService extends Object implements org.xwiki.script.service.ScriptService
Constructor and Description |
---|
NotificationPreferenceScriptService() |
Modifier and Type | Method and Description |
---|---|
NotificationEmailDiffType |
getDiffType() |
NotificationEmailDiffType |
getDiffType(String userId) |
boolean |
hasAnyEnabledNotificationPreferences() |
boolean |
isEventTypeEnabled(String eventType,
NotificationFormat format) |
boolean |
isEventTypeEnabled(String eventType,
NotificationFormat format,
String wiki) |
void |
saveNotificationPreferences(String json)
Update notification preferences of the given user.
|
void |
saveNotificationPreferences(String json,
org.xwiki.model.reference.DocumentReference userReference)
Save preferences given as JSON.
|
void |
saveNotificationPreferencesForCurrentWiki(String json)
Update notification preferences of the current wiki.
|
void |
setStartDate(Date startDate)
Set the start date for the current user.
|
void |
setStartDate(String userId,
Date startDate)
Set the start date for every notification preference of the given user.
|
public void saveNotificationPreferences(String json, org.xwiki.model.reference.DocumentReference userReference) throws NotificationException, org.xwiki.security.authorization.AccessDeniedException
json
- a list of preferences as JSONuserReference
- reference of the user concerned by the preferencesNotificationException
- if error happensorg.xwiki.security.authorization.AccessDeniedException
- if the current user has not the right to edit the given documentpublic void saveNotificationPreferences(String json) throws NotificationException
json
- a list of notification preferences represented as JSONNotificationException
- if an error occurspublic void saveNotificationPreferencesForCurrentWiki(String json) throws NotificationException, org.xwiki.security.authorization.AccessDeniedException
json
- a list of notification preferences represented as JSONNotificationException
- if an error occursorg.xwiki.security.authorization.AccessDeniedException
- if the current user has not the right to administrate the current wikipublic void setStartDate(Date startDate) throws NotificationException
startDate
- the date before which we ignore notificationsNotificationException
- if an error occurspublic void setStartDate(String userId, Date startDate) throws NotificationException
userId
- id of the userstartDate
- the date before which we ignore notificationsNotificationException
- if an error occurspublic boolean hasAnyEnabledNotificationPreferences() throws NotificationException
NotificationException
- if an error occurspublic NotificationEmailDiffType getDiffType()
public NotificationEmailDiffType getDiffType(String userId)
userId
- id of a userpublic boolean isEventTypeEnabled(String eventType, NotificationFormat format, String wiki) throws NotificationException, org.xwiki.security.authorization.AccessDeniedException
eventType
- an event typeformat
- a notification formatwiki
- id of the wikiNotificationException
- if an error happensorg.xwiki.security.authorization.AccessDeniedException
- if the current user has not the admin right on the wikipublic boolean isEventTypeEnabled(String eventType, NotificationFormat format) throws NotificationException
eventType
- an event typeformat
- a notification formatNotificationException
- if an error happensCopyright © 2004–2019 XWiki. All rights reserved.