Class NotificationContext


  • public class NotificationContext
    extends java.lang.Object
    Notification 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
      void addTo​(java.lang.String to)  
      java.lang.String getBody()  
      java.lang.String getBodyTemplate()  
      org.alfresco.service.cmr.repository.NodeRef getDocument()  
      java.lang.String getFrom()  
      java.lang.String getSubject()  
      java.util.Map<java.lang.String,​java.io.Serializable> getTemplateArgs()  
      java.util.List<java.lang.String> getTo()  
      boolean isAsyncNotification()  
      boolean isIgnoreNotificationFailure()  
      void setAsyncNotification​(boolean asyncNotification)
      Indicates whether the notification will be sent asynchronously or not.
      void setBody​(java.lang.String body)
      Note: this takes presendence over the body template if both are set
      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.
      void setDocument​(org.alfresco.service.cmr.repository.NodeRef document)
      Document that the notification relates to.
      void setFrom​(java.lang.String from)  
      void setIgnoreNotificationFailure​(boolean ignoreNotificationFailure)
      Indicates whether to ignore a notification failure or not.
      void setSubject​(java.lang.String subject)  
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NotificationContext

        public NotificationContext()
        Default constructor
    • Method Detail

      • setFrom

        public void setFrom​(java.lang.String from)
        Parameters:
        from - from authority
      • getFrom

        public java.lang.String getFrom()
        Returns:
        String from 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:
        String body 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:
        NodeRef body 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:
        NodeRef related 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