Class NotificationServiceImpl

java.lang.Object
org.craftercms.studio.impl.v2.service.notification.NotificationServiceImpl
All Implemented Interfaces:
NotificationService

public class NotificationServiceImpl extends Object implements NotificationService
  • Field Details

  • Constructor Details

    • NotificationServiceImpl

      public NotificationServiceImpl()
  • Method Details

    • init

      public void init()
    • notifyDeploymentError

      @Valid public void notifyDeploymentError(String site, Throwable throwable, List<PublishRequest> filesUnableToPublish)
      Description copied from interface: NotificationService

      Sends a email to configure emails when a deployment had fail

      Specified by:
      notifyDeploymentError in interface NotificationService
      Parameters:
      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)
    • notifyDeploymentError

      @Valid public void notifyDeploymentError(String name, Throwable throwable)
      Description copied from interface: NotificationService

      Sends a email to configure emails when a deployment had fail

      Specified by:
      notifyDeploymentError in interface NotificationService
      Parameters:
      name - Name of the site which the deployment fail.
      throwable - Throwable error which break the deployment. (Can be null)
    • notifyContentApproval

      @Valid public void notifyContentApproval(String site, String submitter, List<String> itemsSubmitted, String approver, ZonedDateTime scheduleDate)
      Description copied from interface: NotificationService
      Sends Notification when content was approve.
      Specified by:
      notifyContentApproval in interface NotificationService
      Parameters:
      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.
      scheduleDate - scheduled date
    • getNotificationMessage

      @Valid public @Valid String getNotificationMessage(String site, NotificationMessageType type, String key, org.apache.commons.lang3.tuple.Pair<String,Object>... params)
      Description copied from interface: NotificationService
      Gets and process notification message
      Specified by:
      getNotificationMessage in interface NotificationService
      Parameters:
      site - Site of the Content.
      type - Type of the message wanted.
      key - key of the message wanted
      params - parameters of the message this params will be used to process the message string.
      Returns:

      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)

    • notifyApprovesContentSubmission

      @Valid public void notifyApprovesContentSubmission(String site, List<String> usersToNotify, List<String> itemsSubmitted, String submitter, ZonedDateTime scheduleDate, boolean isADelete, String submissionComments)
      Description copied from interface: NotificationService
      Send to all given users a notification of content that need to be review.
      Specified by:
      notifyApprovesContentSubmission in interface NotificationService
      Parameters:
      site - Site of the Content.
      usersToNotify - List of users (username) to be notified.
      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 approved)).
      isADelete - Is this submission a delete one.
      submissionComments - submission comments
    • notify

      @Valid public void notify(String site, List<String> toUsers, String key, org.apache.commons.lang3.tuple.Pair<String,Object>... params)
      Description copied from interface: NotificationService
      Process and Sends a generic email.
      Specified by:
      notify in interface NotificationService
      Parameters:
      site - Site of the Content.
      toUsers - List of recipients.
      key - key of the message wanted
      params - parameters of the message this params will be used to process the message string.
    • notify

      protected void notify(String site, List<String> toUsers, String key, Map<String,Object> params)
    • notifyContentRejection

      @Valid public void notifyContentRejection(String site, List<String> submittedByList, List<String> rejectedItems, String rejectionReason, String userThatRejects)
      Description copied from interface: NotificationService
      Notifies to the submitter that the content has been rejected.
      Specified by:
      notifyContentRejection in interface NotificationService
      Parameters:
      site - Site of the Content.
      submittedByList - List of users that submitted the rejected content.
      rejectedItems - Items that where rejected
      rejectionReason - why the content was rejected.
      userThatRejects - User that is rejecting the content.
    • loadConfig

      protected NotificationConfigTO loadConfig(String site)
    • loadGenericMessage

      protected void loadGenericMessage(org.dom4j.Element emailTemplates, Map<String,String> messageContainer)
    • loadEmailTemplates

      protected void loadEmailTemplates(org.dom4j.Element emailTemplates, Map<String,EmailMessageTemplateTO> messageContainer)
    • loadCannedMessages

      protected void loadCannedMessages(org.dom4j.Element completedMessages, Map<String,List<MessageTO>> messageContainer)
    • getNotificationConfig

      protected NotificationConfigTO getNotificationConfig(String site)
    • sendEmail

      protected void sendEmail(String message, String subject, List<String> sendTo)
    • processMessage

      protected String processMessage(String templateName, String message, Map<String,Object> templateModel)
    • convertPathsToContent

      protected Set<ContentItemTO> convertPathsToContent(String site, List<String> listOfPaths)
    • notifyRepositoryMergeConflict

      @Valid public void notifyRepositoryMergeConflict(String site, List<String> filesUnableToMerge)
      Description copied from interface: NotificationService
      Send email to admin that repository has merged conflict
      Specified by:
      notifyRepositoryMergeConflict in interface NotificationService
      Parameters:
      site - site with merge conflict
      filesUnableToMerge - files unable to merge
    • getConfigPath

      public String getConfigPath()
    • getTemplateTimezone

      public String getTemplateTimezone()
    • setContentService

      public void setContentService(ContentService contentService)
    • setEmailMessages

      public void setEmailMessages(EmailMessageQueueTo emailMessages)
    • setServicesConfig

      public void setServicesConfig(ServicesConfig servicesConfig)
    • setSecurityService

      public void setSecurityService(SecurityService securityService)
    • setStudioConfiguration

      public void setStudioConfiguration(StudioConfiguration studioConfiguration)
    • setConfigurationService

      public void setConfigurationService(ConfigurationService configurationService)
    • setCache

      public void setCache(com.google.common.cache.Cache<String,NotificationConfigTO> cache)