Class NotificationContext
- java.lang.Object
-
- org.alfresco.service.cmr.notification.NotificationContext
-
public class NotificationContext extends java.lang.ObjectNotification context. Provides the contextual information about a notification.- Since:
- 4.0
- Author:
- Roy Wetherall
-
-
Constructor Summary
Constructors Constructor Description NotificationContext()Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTo(java.lang.String to)java.lang.StringgetBody()java.lang.StringgetBodyTemplate()org.alfresco.service.cmr.repository.NodeRefgetDocument()java.lang.StringgetFrom()java.lang.StringgetSubject()java.util.Map<java.lang.String,java.io.Serializable>getTemplateArgs()java.util.List<java.lang.String>getTo()booleanisAsyncNotification()booleanisIgnoreNotificationFailure()voidsetAsyncNotification(boolean asyncNotification)Indicates whether the notification will be sent asynchronously or not.voidsetBody(java.lang.String body)Note: this takes presendence over the body template if both are setvoidsetBodyTemplate(java.lang.String bodyTemplate)The body template is a node re or classpath ref to a template that can be executed with the given template arguments to produce the body of the notification.voidsetDocument(org.alfresco.service.cmr.repository.NodeRef document)Document that the notification relates to.voidsetFrom(java.lang.String from)voidsetIgnoreNotificationFailure(boolean ignoreNotificationFailure)Indicates whether to ignore a notification failure or not.voidsetSubject(java.lang.String subject)voidsetTemplateArgs(java.util.Map<java.lang.String,java.io.Serializable> templateArgs)The template arguments are used as context for the body template when it is executed.
-
-
-
Method Detail
-
setFrom
public void setFrom(java.lang.String from)
- Parameters:
from- from authority
-
getFrom
public java.lang.String getFrom()
- Returns:
Stringfrom authority
-
addTo
public void addTo(java.lang.String to)
- Parameters:
to- to authorities
-
getTo
public java.util.List<java.lang.String> getTo()
- Returns:
List<String> to authorities
-
setSubject
public void setSubject(java.lang.String subject)
- Parameters:
subject- subject of notification
-
getSubject
public java.lang.String getSubject()
- Returns:
- subject of notification
-
setBody
public void setBody(java.lang.String body)
Note: this takes presendence over the body template if both are set- Parameters:
body- body of notification.
-
getBody
public java.lang.String getBody()
- Returns:
Stringbody of notification
-
setBodyTemplate
public void setBodyTemplate(java.lang.String bodyTemplate)
The body template is a node re or classpath ref to a template that can be executed with the given template arguments to produce the body of the notification.- Parameters:
bodyTemplate- body template
-
getBodyTemplate
public java.lang.String getBodyTemplate()
- Returns:
NodeRefbody template
-
setTemplateArgs
public void setTemplateArgs(java.util.Map<java.lang.String,java.io.Serializable> templateArgs)
The template arguments are used as context for the body template when it is executed. Any values placed in this map will be available in the template from the root object 'args'. For example '${args.workflowDescription}'.- Parameters:
templateArgs- template arguments
-
getTemplateArgs
public java.util.Map<java.lang.String,java.io.Serializable> getTemplateArgs()
- Returns:
Map<String,Serializable> template arguments
-
setDocument
public void setDocument(org.alfresco.service.cmr.repository.NodeRef document)
Document that the notification relates to. This does not have to be set. Will be used to populate the 'document' root object accessable within the body template if set.- Parameters:
document- related document
-
getDocument
public org.alfresco.service.cmr.repository.NodeRef getDocument()
- Returns:
NodeRefrelated document
-
setIgnoreNotificationFailure
public void setIgnoreNotificationFailure(boolean ignoreNotificationFailure)
Indicates whether to ignore a notification failure or not.- Parameters:
ignoreNotificationFailure- true if ignore notification failure, false otherwise
-
isIgnoreNotificationFailure
public boolean isIgnoreNotificationFailure()
- Returns:
- boolean true if ignore notification failure, false otherwise
-
setAsyncNotification
public void setAsyncNotification(boolean asyncNotification)
Indicates whether the notification will be sent asynchronously or not.- Parameters:
asyncNotification- true if notification sent asynchronously, false otherwise
-
isAsyncNotification
public boolean isAsyncNotification()
- Returns:
- boolean true if notification send asynchronously, false otherwise
-
-