Class AlertBuilder

    • Field Detail

      • domain

        protected java.lang.String domain
      • name

        protected java.lang.String name
      • author

        protected Member author
      • data

        protected Data data
      • isAuthorRecipient

        protected boolean isAuthorRecipient
      • expiration

        protected java.util.Date expiration
      • propPrefix

        protected java.lang.String propPrefix
      • lastThread

        protected static java.lang.Thread lastThread
    • Constructor Detail

      • AlertBuilder

        public AlertBuilder​(Alert.Level level,
                            java.lang.String domain,
                            java.lang.String name)
      • AlertBuilder

        public AlertBuilder​(Alert.Level level,
                            java.lang.String domain,
                            java.lang.String name,
                            Data data)
      • AlertBuilder

        public AlertBuilder​(Alert.Level level,
                            java.lang.String domain,
                            java.lang.String name,
                            Data data,
                            Member author)
      • AlertBuilder

        public AlertBuilder​(Alert.Level level,
                            java.lang.String domain,
                            java.lang.String name,
                            Data data,
                            Member author,
                            boolean isAuthorRecipient)
        Parameters:
        level - the alert's level
        domain - the alert's domain
        name - the alert's name
        data - the alert's data
        author - the alert's author
        isAuthorRecipient - if false the alert won't be sent to the alert's author
        Since:
        jcms-8.0.0
      • AlertBuilder

        public AlertBuilder​(Alert.Level level,
                            java.lang.String domain,
                            java.lang.String name,
                            Data data,
                            Member author,
                            boolean isAuthorRecipient,
                            java.util.Date expiration)
        Parameters:
        level - the alert's level
        domain - the alert's domain
        name - the alert's name
        data - the alert's data
        author - the alert's author
        isAuthorRecipient - if false the alert won't be sent to the alert's author
        expiration - the alert's expiration date
        Since:
        jcms-9.0.0
    • Method Detail

      • isRecipient

        public boolean isRecipient​(Member mbr)
      • getTitle

        public java.lang.String getTitle​(Member recipient)
      • getShortDescription

        public java.lang.String getShortDescription​(Member recipient)
      • getDescription

        public java.lang.String getDescription​(Member recipient)
      • getSummary

        public java.lang.String getSummary​(Member recipient)
      • getMessage

        public java.lang.String getMessage​(Member mbr)
      • getMessageMarkup

        public java.lang.String getMessageMarkup()
      • canBeSaved

        public boolean canBeSaved()
      • getContext

        public java.util.Map<java.lang.String,​java.lang.Object> getContext()
      • getTitlePropName

        protected java.lang.String getTitlePropName()
      • getShortDescriptionPropName

        protected java.lang.String getShortDescriptionPropName()
      • getDescriptionPropName

        protected java.lang.String getDescriptionPropName()
      • getSummaryPropName

        protected java.lang.String getSummaryPropName()
      • glp

        protected java.lang.String glp​(Member recipient,
                                       java.lang.String prop,
                                       java.util.Map<java.lang.String,​java.lang.String> paramMap)
      • addParams

        protected void addParams​(Member recipient,
                                 java.util.Map<java.lang.String,​java.lang.String> paramMap,
                                 java.lang.String markup)
        This method is called to add parameters to the map used to format the properties.
        Parameters:
        recipient - the recipient
        paramMap - the paramMap
        markup - the markup used (i.e. TEXT_MARKUP or HTML_MARKUP)
        Since:
        jcms-8.0.0
      • getDataRepresentation

        protected java.lang.String getDataRepresentation​(Data data,
                                                         java.lang.String markup,
                                                         Member recipient)
        Returns a representation of the given data suitable for the given markup.
        Parameters:
        data - the data
        markup - the markup
        recipient - the recipient (for localisation)
        Returns:
        a representation of the given data suitable for the given markup.
        Since:
        jcms-8.0.0
      • getDataLink

        protected java.lang.String getDataLink​(Data data,
                                               Member recipient)
        Returns the HTML link for the given data (with an absolute URL).
        Parameters:
        data - the data
        recipient - the recipient (for localisation)
        Returns:
        the HTML link for the given data (with an absolute URL).
        Since:
        jcms-8.0.0
      • getDataText

        protected java.lang.String getDataText​(Data data,
                                               Member recipient)
        Returns the textual representation for the given data.
        Parameters:
        data - the data
        recipient - the recipient (for localisation)
        Returns:
        the textual representation for the given data.
        Since:
        jcms-8.0.0
      • getHtmlAbstract

        protected java.lang.String getHtmlAbstract​(Member recipient)
        Returns an HTML representation of the abstract of the data (only if data instanceof Publication).
        Parameters:
        recipient - the recipient (for localisation)
        Returns:
        an HTML representation of the abstract of the data (only if data instanceof Publication).
        Since:
        jcms-8.0.0
      • getTextPropParamMap

        protected java.util.Map<java.lang.String,​java.lang.String> getTextPropParamMap​(Member recipient)
      • getHtmlPropParamMap

        protected java.util.Map<java.lang.String,​java.lang.String> getHtmlPropParamMap​(Member recipient)
      • sendAlert

        public void sendAlert​(java.util.Collection<Member> recipientCollection)
      • sendAlertInCurrentThread

        public void sendAlertInCurrentThread​(java.util.Collection<Member> recipientCollection)
      • waitForSending

        public static void waitForSending()
        A convenient method for unit test to wait for the ending of the sending thread. This method is not thread safe (it only wait for the last sending thread).
        Since:
        jcms-8.0.0
      • sendAlert

        public void sendAlert​(Member recipient)
        Sends the alert to the given recipient.
        Parameters:
        recipient - the recipient
        Since:
        jcms-8.0.0
      • doCreateAlert

        protected Alert doCreateAlert​(Member recipient)
      • sendToDisabledAccount

        public AlertBuilder sendToDisabledAccount()
        Force the Alert to be sent to recipient even if recipient Member is disabled. Default behavior is to NOT send Alert to disabled account.
        Returns:
        this AlertBuilder, for method chaining
        Since:
        10.0.7 / JCMS-9426
      • sendToContact

        public AlertBuilder sendToContact()
        Force the Alert to be sent to recipient even if recipient Member is a contact.

        Default behavior is to NOT send Alert to contact.

        Returns:
        this AlertBuilder, for method chaining
        Since:
        10.0.7 / JCMS-9426