public class NotificationContext extends Object
Modifier and Type | Field and Description |
---|---|
static String |
WEB_FRAGMENT_INNER_CONTEXT |
Constructor and Description |
---|
NotificationContext() |
NotificationContext(NotificationContext context) |
NotificationContext(NotificationContext context,
Set<DataSource> dataSources) |
Modifier and Type | Method and Description |
---|---|
void |
addTemplateImage(DataSource dataSource)
Adds a datasource to the current set of datasources for 1 instance of notification.
|
void |
addToWebFragmentContext(String key,
String value)
Adds a key/value pair to the Web-Fragment context.
|
void |
addWebFragmentContext()
Copies the current state of this context and stores it in a sub-map.
|
Object |
get(String key) |
String |
getAction() |
com.atlassian.user.User |
getActor() |
ConfluenceEntityObject |
getContent()
Return the context's Content.
|
ContentId |
getContentId()
Return the context's Content id.
|
com.atlassian.event.Event |
getEvent() |
Map<String,Object> |
getMap()
Returns a map for the renderer.
|
com.atlassian.user.User |
getRecipient() |
Collection<DataSource> |
getTemplateImageDataSources() |
Notification.WatchType |
getWatchType() |
boolean |
isManageNotificationOverridden() |
void |
put(String key,
Object value) |
void |
putAll(Map<? extends String,?> map) |
void |
setAction(String action)
The type of action (e.g.
|
void |
setActor(com.atlassian.user.User actor)
Sets the user that performed the action that caused the notification to be sent.
|
void |
setContent(ConfluenceEntityObject entity)
Sets the entity that the notification is being sent regarding.
|
void |
setContentId(ContentId contentId)
Sets id of the entity that the notification is being sent regarding.
|
void |
setContentId(String contentId)
Deprecated.
since 5.6. Use
setContentId(ContentId) |
void |
setEvent(com.atlassian.event.Event event) |
void |
setI18n(I18NBean i18NBean) |
void |
setManageNotificationOverridden(boolean isOverridden) |
void |
setRecipient(com.atlassian.user.User recipient)
Sets the recipient for a notification.
|
void |
setSpace(Space space) |
void |
setWatchType(Notification.WatchType watchType) |
public static final String WEB_FRAGMENT_INNER_CONTEXT
public NotificationContext()
public NotificationContext(NotificationContext context)
public NotificationContext(NotificationContext context, Set<DataSource> dataSources)
public Map<String,Object> getMap()
public ConfluenceEntityObject getContent()
public void setContent(ConfluenceEntityObject entity)
Should be set on the common NotificationContext in the NotificationData
object.
public ContentId getContentId()
getContent()
because the Content
reference might leak the ConfluenceEntityObject
Hibernate object.public void setContentId(ContentId contentId)
Should be set on the common NotificationContext in the NotificationData
object. This method is preferred
over setContent(ConfluenceEntityObject)
because that method might leak the ConfluenceEntityObject
Hibernate object.
@Deprecated public void setContentId(String contentId)
setContentId(ContentId)
public com.atlassian.event.Event getEvent()
public void setEvent(com.atlassian.event.Event event)
public boolean isManageNotificationOverridden()
public void setManageNotificationOverridden(boolean isOverridden)
public Notification.WatchType getWatchType()
public void setWatchType(Notification.WatchType watchType)
public void setSpace(Space space)
public void setRecipient(com.atlassian.user.User recipient)
This should be only ever be called on the per-email NotificationContext instance, never on the common one
inside the NotificationData
object.
public com.atlassian.user.User getRecipient()
public void setActor(com.atlassian.user.User actor)
Should be set on the common NotificationContext in the NotificationData
object.
public com.atlassian.user.User getActor()
public void setAction(String action)
Should be set on the common NotificationContext in the NotificationData
object.
action
- public String getAction()
public void setI18n(I18NBean i18NBean)
public void addTemplateImage(DataSource dataSource)
dataSource
- the datasource for the image.if you intend to
add the image to all notification.
public Collection<DataSource> getTemplateImageDataSources()
public void addWebFragmentContext()
This is required for rendering web-panels in the Notification template that:
a) cannot be passed the entire render context for technical reasons b) shouldn't be passed the entire render context because it leaks services
This method should be called on the object returned by NotificationData.cloneContext()
as soon as
the Recipient user is added.
public void addToWebFragmentContext(String key, String value)
The webFragmentContext is purposely limited so that only named items like recipient and explicitly-added pairs are present in it. This is so that the context can be serialized to things like email tracking URLs. However, there's no stopping code like WebPanelFunction from adding further data to the context passed into the Soy render.
To avoid this context pollution we hide additional explicit context inside a map *inside* the map. Yo dawg indeed.
Copyright © 2003–2016 Atlassian. All rights reserved.