Class AlertManager

    • Field Detail

      • RETRIEVE_PARENT_PROP_PREFIX

        public static final java.lang.String RETRIEVE_PARENT_PROP_PREFIX
        See Also:
        Constant Field Values
      • MARK_ALL_DATA_READ_DOMAIN_EXCEPTION_PROP_PREFIX

        public static final java.lang.String MARK_ALL_DATA_READ_DOMAIN_EXCEPTION_PROP_PREFIX
        See Also:
        Constant Field Values
      • UNFOLLOWABLE_DOMAIN_AND_NAME_PROP

        public static final java.lang.String UNFOLLOWABLE_DOMAIN_AND_NAME_PROP
        See Also:
        Constant Field Values
      • ALERT_SEND_TO_DISABLED_ACCOUNT

        public static final java.lang.String ALERT_SEND_TO_DISABLED_ACCOUNT
        Name of Boolean context attribute passed to sendAlert(Alert, Map) to force sending alert to disabled account (default is to NOT send alert to disabled account)
        Since:
        10.0.7 / JCMS-9426
        See Also:
        Constant Field Values
      • ALERT_SEND_TO_CONTACT

        public static final java.lang.String ALERT_SEND_TO_CONTACT
        Name of Boolean context attribute passed to sendAlert(Alert, Map) to force sending alert to contact (default is to NOT send alert to contact)
        Since:
        10.0.7 / JCMS-9426
        See Also:
        Constant Field Values
    • Method Detail

      • getDefaultAlertRuleSet

        public java.util.Set<AlertRule> getDefaultAlertRuleSet()
      • initExpirations

        public void initExpirations()
      • registerExpiration

        public void registerExpiration​(Alert alert)
        Register this alert for expiration (if it has an expiration date).
        Parameters:
        alert - the alert.
        Since:
        jcms-9.0.0
      • unregisterExpiration

        public void unregisterExpiration​(Alert alert)
        Unregister this alert from the expiration alarm manager (if it has been registered).
        Parameters:
        alert - the alert.
        Since:
        jcms-9.0.0
      • propertiesChange

        public void propertiesChange​(JProperties properties)
        Description copied from interface: JPropertiesListener
        Invoked after properties have been modified in JCMS and save on disk.

        You cannot alter the value received in parameters.

        Note that properties parameter may be null, a limited set of site properties, or all site properties.

        To check that a property has been modified, reload the "current" property instead using channel.getProperties or channel.getProperty.

        Specified by:
        propertiesChange in interface JPropertiesListener
        Parameters:
        properties - the properties which have been submitted to change
      • addAlertChannel

        public void addAlertChannel​(AlertChannel alertChannel)
        Adds the given AlertChannel
        Parameters:
        alertChannel - the AlertChannel to add
        Since:
        jcms-8.0.0
      • removeAlertChannel

        public void removeAlertChannel​(AlertChannel alertChannel)
        Removes the given AlertChannel
        Parameters:
        alertChannel - the AlertChannel to remove
        Since:
        jcms-8.0.0
      • sendAlert

        public void sendAlert​(Alert alert)
        Send the given alert.
        Parameters:
        alert - the Alert
        Since:
        jcms-8.0.0
        See Also:
        sendAlert(Alert, Map)
      • sendAlert

        public void sendAlert​(Alert alert,
                              java.util.Map<java.lang.String,​?> context)
        Send the given alert (if possible).
        Parameters:
        alert - the Alert
        context - an optional context map used to retrieve other informations to use before/during sending, and propagated to alert.checkIntegrity(...) and alert.performCreate(...) methods
        Since:
        10.0.7 / JCMS-9426
      • getAlertLevelList

        public java.util.List<Alert.Level> getAlertLevelList()
        Returns the list of Alert.Level.
        Returns:
        the list of Alert.Level.
        Since:
        jcms-8.0.0
      • getAlertChannel

        public AlertChannel getAlertChannel​(java.lang.String name)
        Returns the AlertChannel with the given name.
        Parameters:
        name - the name of the AlertChannel
        Returns:
        the AlertChannel with the given name.
        Since:
        jcms-8.0.0
      • getMailAlertChannel

        public AlertChannel getMailAlertChannel()
        Returns the MailAlertChannel
        Returns:
        the MailAlertChannel
        Since:
        jcms-8.0.0
      • getWebAlertChannel

        public AlertChannel getWebAlertChannel()
        Returns the WebAlertChannel
        Returns:
        the WebAlertChannel
        Since:
        jcms-8.0.0
      • getAlertChannelList

        public java.util.List<AlertChannel> getAlertChannelList()
        Returns the list of all available AlertChannel.
        Returns:
        the list of all available AlertChannel.
        Since:
        jcms-8.0.0
      • getAlertChannelList

        public java.util.List<AlertChannel> getAlertChannelList​(Member mbr)
        Returns the list of available AlertChannel for the given member.
        Parameters:
        mbr - the member
        Returns:
        the list of available AlertChannel for the given member.
        Since:
        jcms-8.0.0
      • getAlertChannelSet

        public java.util.Set<AlertChannel> getAlertChannelSet​(Alert alert)
        Returns the set of AlertChannel matching the given alert.
        Parameters:
        alert - the alert
        Returns:
        the set of AlertChannel matching the given alert.
        Since:
        jcms-8.0.0
      • getAlertList

        public java.util.List<Alert> getAlertList​(Member mbr)
        Returns the list of Alert the given member is a recipient.
        Parameters:
        mbr - the member
        Returns:
        the list of Alert the given member is a recipient.
        Since:
        jcms-8.0.0
      • getAlertList

        public java.util.List<Alert> getAlertList​(Data data)
        Returns the list of Alert on the given data
        Parameters:
        data - the data
        Returns:
        the list of Alert on the given data
        Since:
        jcms-8.0.1
      • getAlertList

        public java.util.List<Alert> getAlertList​(Data data,
                                                  Member mbr)
        Returns the list of Alert on the given data for given Member
        Parameters:
        data - the data
        mbr - the member
        Returns:
        the list of Alert on the given data for given Member
        Since:
        jcms-10.0.2
      • getAlertList

        public java.util.List<Alert> getAlertList​(Member mbr,
                                                  Alert.Level level,
                                                  java.lang.Boolean read)
        Returns the list of Alert the given member is a recipient.
        Parameters:
        mbr - the member
        level - the alert level. Null means any level.
        read - true for read alerts, false for not read alerts, null for read or not read alerts.
        Returns:
        the list of Alert the given member is a recipient.
        Since:
        jcms-8.0.0
      • getAlertCount

        public int getAlertCount​(Member mbr)
        Returns the count of Alert the given member is a recipient.
        Parameters:
        mbr - the member
        Returns:
        the count of Alert the given member is a recipient.
        Since:
        jcms-8.0.0
      • getAlertCount

        public int getAlertCount​(Data data)
        Returns the count of Alert on the given data
        Parameters:
        data - the data
        Returns:
        the count of Alert on the given data
        Since:
        jcms-8.0.1
      • getUnreadAlertCount

        public int getUnreadAlertCount​(Member mbr)
        Returns the count of unread Alert the given member is a recipient.
        Parameters:
        mbr - the member
        Returns:
        the count of unread Alert the given member is a recipient.
        Since:
        jcms-8.0.0
      • getMaxUnreadAlertLevel

        public Alert.Level getMaxUnreadAlertLevel​(Member mbr)
        Returns the highest alert level the given member is a recipient.
        Parameters:
        mbr - the member
        Returns:
        the highest alert level the given member is a recipient.
        Since:
        jcms-8.0.0
      • markAsRead

        public void markAsRead​(Alert alert,
                               Member loggedMember)
        Marks the given alert as read and updates it.
        Parameters:
        alert - the alert
        loggedMember - the logged member
        Since:
        jcms-8.0.0
      • getPubOrParentPub

        public Publication getPubOrParentPub​(Alert alert)
        For an alert, we search if the publication type has been declared directly, or if we need to use the parent publication
        Parameters:
        alert - the Alert
        Returns:
        the Publication or its parent Publication
        Since:
        jcms-10.0.2
      • markAllRelatedAlertAsRead

        public void markAllRelatedAlertAsRead​(Alert alert,
                                              Member mbr)
        Mark all related alerts for given Alert as read (Where alert data is the same)
        Parameters:
        alert - the Alert
        mbr - the Member
        Since:
        jcms-10.0.2
      • markAsUnread

        public void markAsUnread​(Alert alert,
                                 Member loggedMember)
        Marks the given alert as unread and updates it.
        Parameters:
        alert - the alert
        loggedMember - the logged member
        Since:
        jcms-8.0.0
      • markAllUnreadAsRead

        public void markAllUnreadAsRead​(Member loggedMember)
        Marks all member's unread alerts as read.
        Parameters:
        loggedMember - the logged member
        Since:
        jcms-10.0.0
      • deleteAlerts

        public void deleteAlerts​(Data data)
        Deletes all alerts on given data
        Parameters:
        data - the data
        Since:
        jcms-8.0.1
      • purgeAlerts

        public void purgeAlerts()
        Purge old alerts.
        Since:
        jcms-8.0.0
      • getExpirationAlertList

        public java.util.List<Alert> getExpirationAlertList()
        Returns all the alerts with an expiration date.
        Returns:
        all the alerts with an expiration date.
        Since:
        jcms-9.0.0
      • invalidateCacheEntries

        public void invalidateCacheEntries​(java.lang.String mid)
        Invalidate the cache entries for the given member.
        Parameters:
        mid - the member's id
        Since:
        jcms-8.0.0
      • getMaxAlertPerTransaction

        public int getMaxAlertPerTransaction()
        Returns the max alerts to send with the same transaction.
        Returns:
        the max alerts to send with the same transaction.
        Since:
        jcms-8.0.3
      • getAlertRefreshInterval

        public int getAlertRefreshInterval()
        Returns the alert refresh interval in ms
        Returns:
        the alert refresh interval in ms
        Since:
        jcms-10.0.0
      • saveMemberAlertSettings

        public void saveMemberAlertSettings​(Member member,
                                            MemberAlertSettings settings)
        Saves the member's Alert preferences.
        Parameters:
        member - the member to save its alert's preferences.
        settings - the settings to save
        Since:
        jcms-10.0.1
      • getMemberAlertSettings

        public MemberAlertSettings getMemberAlertSettings​(Member member)
        Returns the member's Alert preferences.
        Parameters:
        member - the member to get its alert's preferences.
        Returns:
        MemberAlertSettings
        Since:
        jcms-10.0.1