Class DefaultNotificationService<N extends Notification>

java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<N>
com.broadleafcommerce.notification.service.DefaultNotificationService<N>
Type Parameters:
N -
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<N>, NotificationService<N>

public class DefaultNotificationService<N extends Notification> extends com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<N> implements NotificationService<N>
Service to store and retrieve Notification data.
Author:
Broadleaf Commerce
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultNotificationService(NotificationRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper helper, com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager mapper, List<NotificationHandler> handlers)
    Creates a new instance of DefaultNotificationService.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    findNotificationHandler(Notification notification, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
     
    protected com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager
    Data Mapper to assist in data conversion.
    protected NotificationRepository<com.broadleafcommerce.data.tracking.core.Trackable>
    Notification Repository
    protected void
    sendMessage(N notification, NotificationHandler handler, NotificationResponse response, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Call the handler to deliver the message using the handler's NotificationSender
    sendNotification(N notification, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected void
    updateAndSaveNotification(N notification, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String notificationStatus)
     
    protected void
    updateRetryCountAndStatus(N notification, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    By default, this method moves the message status to RETRY.

    Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService

    convertFromPersistentDomain, convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, updateAll, updateAllAllowingPartialSuccess, updateSort

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService

    create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort
  • Constructor Details

    • DefaultNotificationService

      public DefaultNotificationService(NotificationRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper helper, com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager mapper, List<NotificationHandler> handlers)
      Creates a new instance of DefaultNotificationService.
      Parameters:
      repository -
      helper -
      mapper -
  • Method Details

    • sendNotification

      public NotificationResponse sendNotification(N notification, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Specified by:
      sendNotification in interface NotificationService<N extends Notification>
    • createNotificationResponse

      protected NotificationResponse createNotificationResponse()
    • sendMessage

      protected void sendMessage(N notification, NotificationHandler handler, NotificationResponse response, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Call the handler to deliver the message using the handler's NotificationSender
      Parameters:
      notification -
      handler -
      response -
      context -
    • updateRetryCountAndStatus

      protected void updateRetryCountAndStatus(N notification, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      By default, this method moves the message status to RETRY. Implementations could send an event to queue a second send or provide a process to retry in batch.
      Parameters:
      notification -
      context -
    • updateAndSaveNotification

      protected void updateAndSaveNotification(N notification, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String notificationStatus)
    • findNotificationHandler

      @Nullable protected NotificationHandler findNotificationHandler(Notification notification, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    • getRepository

      @NonNull protected NotificationRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
      Notification Repository
      Overrides:
      getRepository in class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<N extends Notification>
    • getMapper

      @NonNull protected com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager getMapper()
      Data Mapper to assist in data conversion.