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 Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final StringFields 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.ContextInfobuildNotificationContext(com.jayway.jsonpath.DocumentContext jsonContext) Build theContextInfofor the current messageprotected StringgetCustomerId(com.jayway.jsonpath.DocumentContext jsonContext) protected LocalegetLocale(com.jayway.jsonpath.DocumentContext jsonContext) protected StringgetPayload(org.springframework.messaging.Message<String> message) Get the message payload.protected StringgetRecipientCommunicationPreferences(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 booleanisCompleteOrderStatusChanged(com.jayway.jsonpath.DocumentContext jsonContext) Determine if this fulfillment change includes all of the items in the order, or only a part.protected booleanvalidateShouldSendNotification(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_QUANTITIESindicating the quantity of each order item in the fulfillment.- Overrides:
getPayloadin 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_PATHassigned 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:AbstractEmailNotificationMessageListenerValidate that the message state is valid to send the email.- Specified by:
validateShouldSendNotificationin classAbstractEmailNotificationMessageListener- Parameters:
jsonContext- the message payload- Returns:
- whether the email should be sent
-
getRecipients
Description copied from class:AbstractEmailNotificationMessageListenerDetermine the recipients to use for the email notification.- Specified by:
getRecipientsin 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:AbstractEmailNotificationMessageListenerBuild theContextInfofor the current message- Specified by:
buildNotificationContextin classAbstractEmailNotificationMessageListener- Parameters:
jsonContext- the payload of the message- Returns:
- the NotificationContext for the current message
-
getLocale
-