public class NotificationServiceImpl extends Object implements NotificationService
Modifier and Type | Field and Description |
---|---|
protected ConfigurationService |
configurationService |
protected ContentService |
contentService |
protected EmailMessageQueueTo |
emailMessages |
protected Map<String,Map<String,NotificationConfigTO>> |
notificationConfiguration |
protected SecurityService |
securityService |
protected ServicesConfig |
servicesConfig |
protected SiteService |
siteService |
protected StudioConfiguration |
studioConfiguration |
COMPLETE_DELETE, COMPLETE_GO_LIVE, COMPLETE_REJECT, COMPLETE_SCHEDULE_GO_LIVE, COMPLETE_SUBMIT_TO_GO_LIVE
Constructor and Description |
---|
NotificationServiceImpl() |
Modifier and Type | Method and Description |
---|---|
protected Set<ContentItemTO> |
convertPathsToContent(String site,
List<String> listOfPaths) |
String |
getConfigPath() |
ConfigurationService |
getConfigurationService() |
protected NotificationConfigTO |
getNotificationConfig(String site,
Locale locale) |
String |
getNotificationMessage(String site,
NotificationMessageType type,
String key,
Locale locale,
org.apache.commons.lang3.tuple.Pair<String,Object>... params)
Gets and process notification message
|
StudioConfiguration |
getStudioConfiguration() |
String |
getTemplateTimezone() |
void |
init() |
protected void |
loadCannedMessages(org.dom4j.Element completedMessages,
Map<String,List<MessageTO>> messageContainer) |
protected void |
loadConfig(String site) |
protected void |
loadEmailTemplates(org.dom4j.Element emailTemplates,
Map<String,EmailMessageTemplateTO> messageContainer) |
protected void |
loadGenericMessage(org.dom4j.Element emailTemplates,
Map<String,String> messageContainer) |
protected void |
notify(String site,
List<String> toUsers,
String key,
Locale locale,
Map<String,Object> params) |
void |
notify(String site,
List<String> toUsers,
String key,
Locale locale,
org.apache.commons.lang3.tuple.Pair<String,Object>... params)
Process and Sends a generic email.
|
void |
notifyApprovesContentSubmission(String site,
List<String> usersToNotify,
List<String> itemsSubmitted,
String submitter,
ZonedDateTime scheduleDate,
boolean isADelete,
String submissionComments,
Locale locale)
Send to all given users a notification of content that need to be review.
|
void |
notifyContentApproval(String site,
String submitter,
List<String> itemsSubmitted,
String approver,
ZonedDateTime scheduleDate,
Locale locale)
Sends Notification when content was approve.
|
void |
notifyContentRejection(String site,
String submittedBy,
List<String> rejectedItems,
String rejectionReason,
String userThatRejects,
Locale locale)
Notifies to the submitter that the content has been rejected.
|
void |
notifyDeploymentError(String name,
Throwable throwable)
Sends a email to configure emails when a deployment had fail
|
void |
notifyDeploymentError(String site,
Throwable throwable,
List<String> filesUnableToPublish,
Locale locale)
Sends a email to configure emails when a deployment had fail
|
void |
notifyRepositoryMergeConflict(String site,
List<String> filesUnableToMerge,
Locale locale)
Send email to admin that repository has merge conflict
|
protected String |
processMessage(String templateName,
String message,
Map<String,Object> templateModel) |
void |
reloadConfiguration(String site)
Reloads the current configuration of the notification Service.
|
protected void |
sendEmail(String message,
String subject,
List<String> sendTo) |
void |
setConfigurationService(ConfigurationService configurationService) |
void |
setContentService(ContentService contentService) |
void |
setEmailMessages(EmailMessageQueueTo emailMessages) |
void |
setSecurityService(SecurityService securityService) |
void |
setServicesConfig(ServicesConfig servicesConfig) |
void |
setSiteService(SiteService siteService) |
void |
setStudioConfiguration(StudioConfiguration studioConfiguration) |
protected Map<String,Map<String,NotificationConfigTO>> notificationConfiguration
protected ContentService contentService
protected EmailMessageQueueTo emailMessages
protected ServicesConfig servicesConfig
protected SiteService siteService
protected SecurityService securityService
protected StudioConfiguration studioConfiguration
protected ConfigurationService configurationService
public void init()
public void notifyDeploymentError(String site, Throwable throwable, List<String> filesUnableToPublish, Locale locale)
NotificationService
Sends a email to configure emails when a deployment had fail
notifyDeploymentError
in interface NotificationService
site
- Name of the site which the deployment fail.throwable
- Throwable error which break the deployment. (Can be null)filesUnableToPublish
- List of files that where unable to publish (can be null)locale
- Language of the notification ,if null defaults to English.public void notifyDeploymentError(String name, Throwable throwable)
NotificationService
Sends a email to configure emails when a deployment had fail
notifyDeploymentError
in interface NotificationService
name
- Name of the site which the deployment fail.throwable
- Throwable error which break the deployment. (Can be null)public void notifyContentApproval(String site, String submitter, List<String> itemsSubmitted, String approver, ZonedDateTime scheduleDate, Locale locale)
NotificationService
notifyContentApproval
in interface NotificationService
site
- Site of the Content.submitter
- User that submit the content to approval.itemsSubmitted
- List of Item paths that where approve (can be null)approver
- User that approve the content.locale
- Language of the notification ,if null defaults to English.public String getNotificationMessage(String site, NotificationMessageType type, String key, Locale locale, org.apache.commons.lang3.tuple.Pair<String,Object>... params)
NotificationService
getNotificationMessage
in interface NotificationService
site
- Site of the Content.type
- Type of the message wanted.key
- key of the message wantedlocale
- Language of the message ,if null defaults to English.params
- parameters of the message this params will be use to process the message string.the message in the given locale and processed with the given variables.
If message not found either by key/locale it will return a default string)
public void notifyApprovesContentSubmission(String site, List<String> usersToNotify, List<String> itemsSubmitted, String submitter, ZonedDateTime scheduleDate, boolean isADelete, String submissionComments, Locale locale)
NotificationService
notifyApprovesContentSubmission
in interface NotificationService
site
- Site of the Content.usersToNotify
- List of users (username) to be notify.itemsSubmitted
- List of Item paths that where approve (can be null)submitter
- User (username) that is submitting the content.scheduleDate
- When the content should go live (null if now (or as soon is approve)).isADelete
- Is this submission a delete one.locale
- Language of the message ,if null defaults to English.public void notify(String site, List<String> toUsers, String key, Locale locale, org.apache.commons.lang3.tuple.Pair<String,Object>... params)
NotificationService
notify
in interface NotificationService
site
- Site of the Content.toUsers
- List of recipients.key
- key of the message wantedlocale
- Language of the message ,if null defaults to English.params
- parameters of the message this params will be use to process the message string.protected void notify(String site, List<String> toUsers, String key, Locale locale, Map<String,Object> params)
public void notifyContentRejection(String site, String submittedBy, List<String> rejectedItems, String rejectionReason, String userThatRejects, Locale locale)
NotificationService
notifyContentRejection
in interface NotificationService
site
- Site of the Content.submittedBy
- User that submitted the rejected content.rejectedItems
- Items that where rejectedrejectionReason
- why the content was rejected.userThatRejects
- User that is rejecting the content.locale
- Language of the message ,if null defaults to English.protected void loadConfig(String site)
protected void loadGenericMessage(org.dom4j.Element emailTemplates, Map<String,String> messageContainer)
protected void loadEmailTemplates(org.dom4j.Element emailTemplates, Map<String,EmailMessageTemplateTO> messageContainer)
protected void loadCannedMessages(org.dom4j.Element completedMessages, Map<String,List<MessageTO>> messageContainer)
public void reloadConfiguration(String site)
NotificationService
reloadConfiguration
in interface NotificationService
site
- Site to reload the notification service configuration.protected NotificationConfigTO getNotificationConfig(String site, Locale locale)
protected String processMessage(String templateName, String message, Map<String,Object> templateModel)
protected Set<ContentItemTO> convertPathsToContent(String site, List<String> listOfPaths)
public void notifyRepositoryMergeConflict(String site, List<String> filesUnableToMerge, Locale locale)
NotificationService
notifyRepositoryMergeConflict
in interface NotificationService
site
- site with merge conflictfilesUnableToMerge
- files unable to mergelocale
- language of the message ,if null defaults to English.public String getConfigPath()
public String getTemplateTimezone()
public void setContentService(ContentService contentService)
public void setEmailMessages(EmailMessageQueueTo emailMessages)
public void setServicesConfig(ServicesConfig servicesConfig)
public void setSiteService(SiteService siteService)
public void setSecurityService(SecurityService securityService)
public StudioConfiguration getStudioConfiguration()
public void setStudioConfiguration(StudioConfiguration studioConfiguration)
public ConfigurationService getConfigurationService()
public void setConfigurationService(ConfigurationService configurationService)
Copyright © 2020 CrafterCMS. All rights reserved.