Package com.jalios.jcms
Class NotificationManager
- java.lang.Object
- 
- com.jalios.jcms.NotificationManager
 
- 
- All Implemented Interfaces:
- JcmsConstants,- JaliosConstants
 
 public class NotificationManager extends java.lang.Object implements JcmsConstants This class is instantiated by aChannelin method initAfterLoad() only if property 'notification.enabled' is set to true. TheNotificationManagerhandles 4 alarms, one per hour, one per day, one per week, one per month. A single AlarmManager listens to these alarms and launches notifications threads (@see NotificationThread) each time an alarm is fired. CAUTION: NotificationThread checks the server is not 127.0.0.1 nor localhost, to avoid emails being sent by mistake while staging.
- 
- 
Field SummaryFields Modifier and Type Field Description protected AlarmManageralarmMgrstatic java.lang.StringCHANGESprotected Channelchannelstatic intDAILYprotected AlarmEntrydayAlarmEntrystatic java.lang.StringDELETIONSprotected AlarmEntryhourAlarmEntrystatic intHOURLYprotected AlarmEntryminuteAlarmEntrystatic intMINUTEDprotected AlarmEntrymonthAlarmEntrystatic intMONTHLYstatic intMUTATION_ALLstatic intMUTATION_CREATEDeprecated.static intMUTATION_MAJORstatic intMUTATION_PUBLISHstatic int[]MUTATION_TYPESprotected static java.lang.StringNOTIFICATION_FOLLOWED_TYPESprotected static java.lang.StringNOTIFICATION_FOLLOWED_TYPES_OFFstatic java.lang.String[]PERIOD_LABELSstatic int[]PERIODS_1static int[]PERIODS_2static java.lang.StringPUBCOUNTprotected intreinitVariable used to reinitialize the NotificationManager in case a PastDateException is thrown in initialization stage.static intUSE_CRITERIA_GROUP_AND_MEMBERstatic intUSE_CRITERIA_GROUP_ONLYstatic intUSE_CRITERIA_MEMBER_ONLYprotected AlarmEntryweekAlarmEntrystatic intWEEKLY- 
Fields inherited from interface com.jalios.util.JaliosConstantsCRLF, 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
 - 
Fields inherited from interface com.jalios.jcms.JcmsConstantsADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, AJAX_MODE_ATTR, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, CLASS_PROPERTY, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, COUNTRY_SPRITE, CS_TYPOLOGY_ROOT_CAT_VID, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DATA_DIRECTORY, DEFAULT_PHOTO_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, GLYPH_ICON_PREFIX, ICON_ARCHIVE, ICON_ICON_PREFIX, ICON_LOCK, ICON_LOCK_STRONG, ICON_PREFIX_PROP, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, IS_IN_FRONT_OFFICE, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JCMS_TOASTR_COLLECTION, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LANG_SPRITE, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_CREATE_STR, OP_DEEP_COPY, OP_DEEP_COPY_STR, OP_DEEP_DELETE, OP_DEEP_DELETE_STR, OP_DELETE, OP_DELETE_STR, OP_MERGE, OP_MERGE_STR, OP_UPDATE, OP_UPDATE_STR, ORGANIZATION_ROOT_GROUP_PROP, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_PROP_PREFIX, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_PROP_PREFIX, PHOTO_LARGE_WIDTH, PHOTO_MINI, PHOTO_MINI_HEIGHT, PHOTO_MINI_PROP_PREFIX, PHOTO_MINI_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_PROP_PREFIX, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_PROP_PREFIX, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_PROP_PREFIX, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, RAW_CONTENT_ICON_PREFIX, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SECURITY_LOG_FILE, SESSION_AUTHORIZED_FILENAMES_SET, SPRITE_ICON_PREFIX, STATS_REPORT_DIR, STATUS_PROP, STORE_DIR, STORE_XML, SUCCESS_MSG, SVG_ICON_PREFIX, SVGINLINE_ICON_PREFIX, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, TTCARD_MEDIA_HEIGHT, TTCARD_MEDIA_WIDTH, TYPES_ICON_ALT_PROP, TYPES_ICON_SUFFIX_PROP, TYPES_ICON_TITLE_PROP, TYPES_PREFIX_PROP, TYPES_THUMB_SUFFIX_PROP, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, UPLOAD_PERMISSION_COUNT_PROP_PREFIX, UPLOAD_PERMISSION_SIZE_PROP_PREFIX, URL_REGEXP, VID_LOGGED_MEMBER, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
 
- 
 - 
Constructor SummaryConstructors Constructor Description NotificationManager()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static booleancanBeFollowed(java.lang.Class<?> clazz)Return true if given class can be followed.
 It can be followed: if it is a Content, or a UserContent.static int[]getAvailableMutationTypes()static int[]getAvailablePeriods()static java.util.ListgetFollowedTypeList(java.lang.String userLang)Returns the list of types that can be selected forNotificationCriteriaprotected static java.util.Collection<java.lang.Class<?>>getFollowedTypesOff()Returns the list of types that cannot be selected forNotificationCriteriaprotected static java.util.Collection<java.lang.Class<?>>getFollowedTypesOn()Returns the whitelist of exact types that can be selected forNotificationCriteriastatic java.util.Set<NotificationCriteria>getGroupsCriteriaSet(Member member)protected static java.util.Collection<java.lang.Class<? extends Publication>>getInternalQueryHandlerDefaultFollowedTypes()Returns the list of default root types to use for QueryHandler when user did not select any type to follow.
 By default:ContentandUserContentclasses.
 Does NOT check white and blacklist.static java.lang.StringgetMutationTypeLabel(int mutationType)static NotificationCriteria[]getNotificationCriteria(Member member)static java.lang.StringgetNotificationMailSubject(Member mbr)static java.util.Map<java.lang.String,java.lang.String>getNotificationOriginMap(Member member)Compute origin of eachNotificationCriteriaof given Member.static java.lang.StringgetPeriodLabel(int period)Retrieve the property used to retrieve label of the specified period.static java.lang.String[]getPeriodLabels()voidinit()static booleanisDefault(Notification notification)Tell if the given notification is equivalent to no notification at all.static booleanisDefault(NotificationCriteria[] criterias, int selectionCriteriaMode)static booleanisSameCriteria(NotificationCriteria[] criterias1, NotificationCriteria[] criterias2)Compares two arrays of NotificationCriteriastatic booleanisSameCriteria(NotificationCriteria criteria1, NotificationCriteria criteria2)Compares two NotificationCriteriavoidprocessNotification(int period)Launches a thread that notifies all members who have requested to be alerted of specific changes at each period.
 
- 
- 
- 
Field Detail- 
NOTIFICATION_FOLLOWED_TYPESprotected static final java.lang.String NOTIFICATION_FOLLOWED_TYPES - See Also:
- Constant Field Values
 
 - 
NOTIFICATION_FOLLOWED_TYPES_OFFprotected static final java.lang.String NOTIFICATION_FOLLOWED_TYPES_OFF - See Also:
- Constant Field Values
 
 - 
alarmMgrprotected AlarmManager alarmMgr 
 - 
channelprotected Channel channel 
 - 
USE_CRITERIA_GROUP_AND_MEMBERpublic static final int USE_CRITERIA_GROUP_AND_MEMBER - See Also:
- Constant Field Values
 
 - 
USE_CRITERIA_MEMBER_ONLYpublic static final int USE_CRITERIA_MEMBER_ONLY - See Also:
- Constant Field Values
 
 - 
USE_CRITERIA_GROUP_ONLYpublic static final int USE_CRITERIA_GROUP_ONLY - See Also:
- Constant Field Values
 
 - 
HOURLYpublic static final int HOURLY - See Also:
- Constant Field Values
 
 - 
DAILYpublic static final int DAILY - See Also:
- Constant Field Values
 
 - 
WEEKLYpublic static final int WEEKLY - See Also:
- Constant Field Values
 
 - 
MONTHLYpublic static final int MONTHLY - See Also:
- Constant Field Values
 
 - 
MINUTEDpublic static final int MINUTED - See Also:
- Constant Field Values
 
 - 
PERIODS_1public static final int[] PERIODS_1 
 - 
PERIODS_2public static final int[] PERIODS_2 
 - 
MUTATION_CREATE@Deprecated public static final int MUTATION_CREATE Deprecated.DeprecatedUse insteadMUTATION_PUBLISH- See Also:
- Constant Field Values
 
 - 
MUTATION_PUBLISHpublic static final int MUTATION_PUBLISH - See Also:
- Constant Field Values
 
 - 
MUTATION_MAJORpublic static final int MUTATION_MAJOR - See Also:
- Constant Field Values
 
 - 
MUTATION_ALLpublic static final int MUTATION_ALL - See Also:
- Constant Field Values
 
 - 
MUTATION_TYPESpublic static final int[] MUTATION_TYPES 
 - 
PERIOD_LABELSpublic static final java.lang.String[] PERIOD_LABELS 
 - 
CHANGESpublic static final java.lang.String CHANGES - See Also:
- Constant Field Values
 
 - 
DELETIONSpublic static final java.lang.String DELETIONS - See Also:
- Constant Field Values
 
 - 
PUBCOUNTpublic static final java.lang.String PUBCOUNT - See Also:
- Constant Field Values
 
 - 
reinitprotected int reinit Variable used to reinitialize the NotificationManager in case a PastDateException is thrown in initialization stage.
 - 
minuteAlarmEntryprotected AlarmEntry minuteAlarmEntry 
 - 
hourAlarmEntryprotected AlarmEntry hourAlarmEntry 
 - 
dayAlarmEntryprotected AlarmEntry dayAlarmEntry 
 - 
weekAlarmEntryprotected AlarmEntry weekAlarmEntry 
 - 
monthAlarmEntryprotected AlarmEntry monthAlarmEntry 
 
- 
 - 
Method Detail- 
initpublic void init() 
 - 
processNotificationpublic void processNotification(int period) Launches a thread that notifies all members who have requested to be alerted of specific changes at each period.- Parameters:
- period- The period type
 
 - 
getAvailablePeriodspublic static int[] getAvailablePeriods() 
 - 
getAvailableMutationTypespublic static int[] getAvailableMutationTypes() 
 - 
getPeriodLabelspublic static java.lang.String[] getPeriodLabels() 
 - 
getPeriodLabelpublic static java.lang.String getPeriodLabel(int period) Retrieve the property used to retrieve label of the specified period.
 - 
getMutationTypeLabelpublic static java.lang.String getMutationTypeLabel(int mutationType) 
 - 
getNotificationCriteriapublic static NotificationCriteria[] getNotificationCriteria(Member member) 
 - 
getGroupsCriteriaSetpublic static java.util.Set<NotificationCriteria> getGroupsCriteriaSet(Member member) 
 - 
isDefaultpublic static boolean isDefault(Notification notification) Tell if the given notification is equivalent to no notification at all.- Parameters:
- notification- the notification
- Returns:
- true is notification is equivalent to no notification at all.
- Since:
- JCMS-5.7.5
 
 - 
isDefaultpublic static boolean isDefault(NotificationCriteria[] criterias, int selectionCriteriaMode) 
 - 
isSameCriteriapublic static boolean isSameCriteria(NotificationCriteria[] criterias1, NotificationCriteria[] criterias2) Compares two arrays of NotificationCriteria- Parameters:
- criterias1- the first array of NotificationCriteria
- criterias2- the second array of NotificationCriteria
- Returns:
- true if they can be considered as equivalent
- Since:
- JCMS-5.7.5
 
 - 
isSameCriteriapublic static boolean isSameCriteria(NotificationCriteria criteria1, NotificationCriteria criteria2) Compares two NotificationCriteria- Parameters:
- criteria1- the first NotificationCriteria
- criteria2- the second NotificationCriteria
- Returns:
- true if they can be considered as equivalent
- Since:
- JCMS-5.7.5
 
 - 
getNotificationMailSubjectpublic static java.lang.String getNotificationMailSubject(Member mbr) - Parameters:
- mbr- the recipient Member
- Returns:
- the subject for given Member
- Since:
- jcms-8.0.0
 
 - 
getFollowedTypeListpublic static java.util.List getFollowedTypeList(java.lang.String userLang) Returns the list of types that can be selected forNotificationCriteria- Parameters:
- userLang- the userLang (to sort types)
- Returns:
- the list of types that can be selected for NotificationCriteria
- Since:
- jcms-8.0.0
 
 - 
getFollowedTypesOnprotected static java.util.Collection<java.lang.Class<?>> getFollowedTypesOn() Returns the whitelist of exact types that can be selected forNotificationCriteria- Returns:
- the whitelist of exact types that can be selected for NotificationCriteria
- Since:
- jcms-10.0.1
 
 - 
getFollowedTypesOffprotected static java.util.Collection<java.lang.Class<?>> getFollowedTypesOff() Returns the list of types that cannot be selected forNotificationCriteria- Returns:
- the list of types that cannot be selected for NotificationCriteria
- Since:
- jcms-10.0.1
 
 - 
getInternalQueryHandlerDefaultFollowedTypesprotected static java.util.Collection<java.lang.Class<? extends Publication>> getInternalQueryHandlerDefaultFollowedTypes() Returns the list of default root types to use for QueryHandler when user did not select any type to follow.
 By default:ContentandUserContentclasses.
 Does NOT check white and blacklist.Internal method to prevent a stackOverflow. - Returns:
- the list of default types to use for QueryHandler when user did not select any type to follow.
- Since:
- jcms-10.0.1
 
 - 
canBeFollowedprotected static boolean canBeFollowed(java.lang.Class<?> clazz) Return true if given class can be followed.
 It can be followed:- if it is a Content, or a UserContent.
- 
 And:
 - if either followed whitelist is empty
- else, if given clazz is in white list, or if a super clazz of given clazz is in white list
 
- and given exact clazz is not blacklisted.
 - Parameters:
- clazz- the clazz to test
- Returns:
- true if given clazz matches followable types rules.
- Since:
- jcms-10.0.1
 
 - 
getNotificationOriginMappublic static java.util.Map<java.lang.String,java.lang.String> getNotificationOriginMap(Member member) Compute origin of eachNotificationCriteriaof given Member.NotificationCriteria's origin can be either the member itself, or a group the member belongs to.- Parameters:
- member- the member to compute origin of its notification
- Returns:
- a map with notificationCriteria's id as key, and member's id or group's id as value.
- Since:
- jcms-9.0.3
 
 
- 
 
-