Package com.jalios.jcms.alert
Class AlertManager
- java.lang.Object
-
- com.jalios.jcms.alert.AlertManager
-
- All Implemented Interfaces:
AlertConstants
,DBConstants
,JaliosConstants
,JPropertiesListener
public class AlertManager extends java.lang.Object implements AlertConstants, JPropertiesListener, DBConstants, JaliosConstants
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ALERT_SEND_TO_CONTACT
Name of Boolean context attribute passed tosendAlert(Alert, Map)
to force sending alert to contact (default is to NOT send alert to contact)static java.lang.String
ALERT_SEND_TO_DISABLED_ACCOUNT
Name of Boolean context attribute passed tosendAlert(Alert, Map)
to force sending alert to disabled account (default is to NOT send alert to disabled account)static java.lang.String
MARK_ALL_DATA_READ_DOMAIN_EXCEPTION_PROP_PREFIX
static java.lang.String
RETRIEVE_PARENT_PROP_PREFIX
static java.lang.String
UNFOLLOWABLE_DOMAIN_AND_NAME_PROP
-
Fields inherited from interface com.jalios.jcms.alert.AlertConstants
ALERT_META_INFO_ATTRIBUTE, CTXT_DELETE_ALERT, HTML_MARKUP, MSG_PREFIX_PROP, NAME_PREFIX_PROP, NO_ALERT_FLAG, TEXT_MARKUP, WIKI_MARKUP
-
Fields inherited from interface com.jalios.jcms.db.DBConstants
ALL_CATEGORIES_SET_FIELD, ATTACH_WS_SET_FIELD, AUTH_GRP_SET_FIELD, AUTH_MBR_SET_FIELD, AUTHOR_ID_FIELD, CATEGORIES_SET_FIELD, CDATE_FIELD, CHANNEL_JCMSDB_PROP, CLASSIFICATION_LEVEL_FIELD, DBDATA_URID, EXTENDED_READ_RIGHTS, HAS_ATTACH_WS_FIELD, HAS_NO_READ_RIGHTS, HIBERNATE_MAPPING_ADATE, HIBERNATE_MAPPING_AUTHOR, HIBERNATE_MAPPING_CDATE, HIBERNATE_MAPPING_EDATE, HIBERNATE_MAPPING_HAS_ATTACH_WS, HIBERNATE_MAPPING_HASNOREADRIGHTS, HIBERNATE_MAPPING_MAININSTANCE_ID, HIBERNATE_MAPPING_MAJORVERSION, HIBERNATE_MAPPING_MDATE, HIBERNATE_MAPPING_MERGE_DATE, HIBERNATE_MAPPING_MERGE_ID, HIBERNATE_MAPPING_MINORVERSION, HIBERNATE_MAPPING_OPAUTHOR, HIBERNATE_MAPPING_PDATE, HIBERNATE_MAPPING_PSTATUS, HIBERNATE_MAPPING_READ_ACK, HIBERNATE_MAPPING_READERCOUNT, HIBERNATE_MAPPING_RESTRICTIVE_UPDATE_RIGHTS, HIBERNATE_MAPPING_TITLE, HIBERNATE_MAPPING_TRACKED, HIBERNATE_MAPPING_UDATE, HIBERNATE_MAPPING_VOTECOUNT, HIBERNATE_MAPPING_VOTESCORE, HIBERNATE_MAPPING_WORKFLOW_ID, HIBERNATE_MAPPING_WORKSPACE_ID, MAX_HIBERNATE_MAPPING_PUBLICATION, MDATE_FIELD, OPAUTHOR_ID_FIELD, PSTATUS_FIELD, ROW_ID_FIELD, SCROLL_FETCH_SIZE, WORKFLOW_ID_FIELD, WORKSPACE_ID_FIELD
-
Fields inherited from interface com.jalios.util.JaliosConstants
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAlertChannel(AlertChannel alertChannel)
Adds the given AlertChannelvoid
deleteAlerts(Data data)
Deletes all alerts on given dataAlertChannel
getAlertChannel(java.lang.String name)
Returns the AlertChannel with the given name.java.util.List<AlertChannel>
getAlertChannelList()
Returns the list of all available AlertChannel.java.util.List<AlertChannel>
getAlertChannelList(Member mbr)
Returns the list of available AlertChannel for the given member.java.util.Set<AlertChannel>
getAlertChannelSet(Alert alert)
Returns the set of AlertChannel matching the given alert.int
getAlertCount(Data data)
Returns the count of Alert on the given dataint
getAlertCount(Member mbr)
Returns the count of Alert the given member is a recipient.java.util.List<Alert.Level>
getAlertLevelList()
Returns the list of Alert.Level.java.util.List<Alert>
getAlertList(Data data)
Returns the list of Alert on the given datajava.util.List<Alert>
getAlertList(Data data, Member mbr)
Returns the list of Alert on the given data for given Memberjava.util.List<Alert>
getAlertList(Member mbr)
Returns the list of Alert the given member is a recipient.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.int
getAlertRefreshInterval()
Returns the alert refresh interval in msjava.util.Set<AlertRule>
getDefaultAlertRuleSet()
java.util.List<Alert>
getExpirationAlertList()
Returns all the alerts with an expiration date.static AlertManager
getInstance()
AlertChannel
getMailAlertChannel()
Returns the MailAlertChannelint
getMaxAlertPerTransaction()
Returns the max alerts to send with the same transaction.Alert.Level
getMaxUnreadAlertLevel(Member mbr)
Returns the highest alert level the given member is a recipient.MemberAlertSettings
getMemberAlertSettings(Member member)
Returns the member's Alert preferences.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 publicationint
getUnreadAlertCount(Member mbr)
Returns the count of unread Alert the given member is a recipient.AlertChannel
getWebAlertChannel()
Returns the WebAlertChannelvoid
initExpirations()
void
invalidateCacheEntries(java.lang.String mid)
Invalidate the cache entries for the given member.void
markAllRelatedAlertAsRead(Alert alert, Member mbr)
Mark all related alerts for given Alert as read (Where alert data is the same)void
markAllUnreadAsRead(Member loggedMember)
Marks all member's unread alerts as read.void
markAsRead(Alert alert, Member loggedMember)
Marks the given alert as read and updates it.void
markAsUnread(Alert alert, Member loggedMember)
Marks the given alert as unread and updates it.void
propertiesChange(JProperties properties)
Invoked after properties have been modified in JCMS and save on disk.void
purgeAlerts()
Purge old alerts.void
registerExpiration(Alert alert)
Register this alert for expiration (if it has an expiration date).void
removeAlertChannel(AlertChannel alertChannel)
Removes the given AlertChannelvoid
saveMemberAlertSettings(Member member, MemberAlertSettings settings)
Saves the member's Alert preferences.void
sendAlert(Alert alert)
Send the given alert.void
sendAlert(Alert alert, java.util.Map<java.lang.String,?> context)
Send the given alert (if possible).void
unregisterExpiration(Alert alert)
Unregister this alert from the expiration alarm manager (if it has been registered).
-
-
-
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 tosendAlert(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 tosendAlert(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
-
getInstance
public static AlertManager getInstance()
-
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
orchannel.getProperty
.- Specified by:
propertiesChange
in interfaceJPropertiesListener
- 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 Alertcontext
- an optional context map used to retrieve other informations to use before/during sending, and propagated toalert.checkIntegrity(...)
andalert.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 datambr
- 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 memberlevel
- 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 alertloggedMember
- 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
- theAlert
- Returns:
- the
Publication
or its parentPublication
- 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)
-
markAsUnread
public void markAsUnread(Alert alert, Member loggedMember)
Marks the given alert as unread and updates it.- Parameters:
alert
- the alertloggedMember
- 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
-
-