Class AbstractNotificationFulfillmentStatusChangeMessageListener

java.lang.Object
com.broadleafcommerce.notification.service.messaging.AbstractEmailNotificationMessageListener
com.broadleafcommerce.notification.service.messaging.AbstractNotificationFulfillmentStatusChangeMessageListener
Direct Known Subclasses:
NotificationFulfillmentCancelledMessageListener, NotificationFulfillmentFulfilledMessageListener

public abstract class AbstractNotificationFulfillmentStatusChangeMessageListener extends AbstractEmailNotificationMessageListener
Abstract message listener to handle the status change for a fulfillment. Creates the order fulfilled or cancelled notification.
  • Field Details

  • Constructor Details

    • AbstractNotificationFulfillmentStatusChangeMessageListener

      public AbstractNotificationFulfillmentStatusChangeMessageListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, NotificationService<Notification> notificationService, org.springframework.context.MessageSource messages, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • Method Details

    • getPayload

      protected String getPayload(org.springframework.messaging.Message<String> message)
      Get the message payload. Adds a field indicating whether the whole order has changed status at COMPLETE_ORDER_STATUS_CHANGED. If only part has changed, also adds a field at FULFILLMENT_ORDER_ITEM_QUANTITIES indicating the quantity of each order item in the fulfillment.
      Overrides:
      getPayload in class AbstractEmailNotificationMessageListener
      Parameters:
      message - the message payload
      Returns:
      string version of the message payload
    • isCompleteOrderStatusChanged

      protected boolean isCompleteOrderStatusChanged(com.jayway.jsonpath.DocumentContext jsonContext)
      Determine if this fulfillment change includes all of the items in the order, or only a part. Uses the COMPLETE_ORDER_STATUS_CHANGED_PATH assigned in the jsonContext.
      Parameters:
      jsonContext - the message payload
      Returns:
      whether the fulfillment changes all items in the order
    • validateShouldSendNotification

      protected boolean validateShouldSendNotification(com.jayway.jsonpath.DocumentContext jsonContext)
      Description copied from class: AbstractEmailNotificationMessageListener
      Validate that the message state is valid to send the email.
      Specified by:
      validateShouldSendNotification in class AbstractEmailNotificationMessageListener
      Parameters:
      jsonContext - the message payload
      Returns:
      whether the email should be sent
    • getRecipients

      protected List<Recipient> getRecipients(com.jayway.jsonpath.DocumentContext jsonContext)
      Description copied from class: AbstractEmailNotificationMessageListener
      Determine the recipients to use for the email notification.
      Specified by:
      getRecipients in class AbstractEmailNotificationMessageListener
      Parameters:
      jsonContext - the message payload
      Returns:
      the recipients to use for the email notification
    • getCustomerId

      @Nullable protected String getCustomerId(com.jayway.jsonpath.DocumentContext jsonContext)
    • getRecipientCommunicationPreferences

      protected String getRecipientCommunicationPreferences(String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • buildNotificationContext

      protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildNotificationContext(com.jayway.jsonpath.DocumentContext jsonContext)
      Description copied from class: AbstractEmailNotificationMessageListener
      Build the ContextInfo for the current message
      Specified by:
      buildNotificationContext in class AbstractEmailNotificationMessageListener
      Parameters:
      jsonContext - the payload of the message
      Returns:
      the NotificationContext for the current message
    • getLocale

      protected Locale getLocale(com.jayway.jsonpath.DocumentContext jsonContext)