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 Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
Fields inherited from class com.broadleafcommerce.notification.service.messaging.AbstractEmailNotificationMessageListener
EMAIL_DELIVERY, messages, notificationService, tenantProvider, typeFactory, userResolver
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractNotificationFulfillmentStatusChangeMessageListener
(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 Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.data.tracking.core.context.ContextInfo
buildNotificationContext
(com.jayway.jsonpath.DocumentContext jsonContext) Build theContextInfo
for the current messageprotected String
getCustomerId
(com.jayway.jsonpath.DocumentContext jsonContext) protected Locale
getLocale
(com.jayway.jsonpath.DocumentContext jsonContext) protected String
getPayload
(org.springframework.messaging.Message<String> message) Get the message payload.protected String
getRecipientCommunicationPreferences
(String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) getRecipients
(com.jayway.jsonpath.DocumentContext jsonContext) Determine the recipients to use for the email notification.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.protected boolean
validateShouldSendNotification
(com.jayway.jsonpath.DocumentContext jsonContext) Validate that the message state is valid to send the email.Methods inherited from class com.broadleafcommerce.notification.service.messaging.AbstractEmailNotificationMessageListener
buildNotification, buildNotification, getClassName, getDocumentContext, getIdempotentConsumptionService, getMessages, getMessageType, getNotificationService, getNotificationSubject, getObjectMapper, getTenantProvider, getTypeFactory, getUserResolver, handleMessageInternal, modifyNotification, modifyNotification, processMessage, resolveApplicationById, setTenantProvider, setUserResolver
-
Field Details
-
APPLICATION_ID_PATH
- See Also:
-
TENANT_ID_PATH
- See Also:
-
CUSTOMER_CONTEXT_ID_PATH
- See Also:
-
ORDER_NUMBER_PATH
- See Also:
-
ORDER_ITEM_IDS_PATH
- See Also:
-
ORDER_ITEM_QUANTITIES_PATH
- See Also:
-
FULFILLMENT_ITEM_ORDER_ITEM_IDS_PATH
- See Also:
-
FULFILLMENT_ITEM_QUANTITIES_PATH
- See Also:
-
CUSTOMER_ID_PATH
- See Also:
-
CUSTOMER_NAME_PATH
- See Also:
-
CUSTOMER_EMAIL_PATH
- See Also:
-
LOCALE
- See Also:
-
FULFILLMENT_ORDER_ITEM_QUANTITIES
- See Also:
-
COMPLETE_ORDER_STATUS_CHANGED
- See Also:
-
COMPLETE_ORDER_STATUS_CHANGED_PATH
- See Also:
-
-
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
Get the message payload. Adds a field indicating whether the whole order has changed status atCOMPLETE_ORDER_STATUS_CHANGED
. If only part has changed, also adds a field atFULFILLMENT_ORDER_ITEM_QUANTITIES
indicating the quantity of each order item in the fulfillment.- Overrides:
getPayload
in classAbstractEmailNotificationMessageListener
- 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 theCOMPLETE_ORDER_STATUS_CHANGED_PATH
assigned in thejsonContext
.- 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 classAbstractEmailNotificationMessageListener
- Parameters:
jsonContext
- the message payload- Returns:
- whether the email should be sent
-
getRecipients
Description copied from class:AbstractEmailNotificationMessageListener
Determine the recipients to use for the email notification.- Specified by:
getRecipients
in classAbstractEmailNotificationMessageListener
- Parameters:
jsonContext
- the message payload- Returns:
- the recipients to use for the email notification
-
getCustomerId
-
getRecipientCommunicationPreferences
-
buildNotificationContext
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildNotificationContext(com.jayway.jsonpath.DocumentContext jsonContext) Description copied from class:AbstractEmailNotificationMessageListener
Build theContextInfo
for the current message- Specified by:
buildNotificationContext
in classAbstractEmailNotificationMessageListener
- Parameters:
jsonContext
- the payload of the message- Returns:
- the NotificationContext for the current message
-
getLocale
-