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
ConstructorsConstructorDescriptionDefaultNotificationService(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 ofDefaultNotificationService. -
Method Summary
Modifier and TypeMethodDescriptionprotected NotificationResponseprotected NotificationHandlerfindNotificationHandler(Notification notification, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManagerData Mapper to assist in data conversion.protected NotificationRepository<com.broadleafcommerce.data.tracking.core.Trackable>Notification Repositoryprotected voidsendMessage(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 NotificationSendersendNotification(N notification, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidupdateAndSaveNotification(N notification, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String notificationStatus) protected voidupdateRetryCountAndStatus(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, updateSortMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 ofDefaultNotificationService.- Parameters:
repository-helper-mapper-
-
-
Method Details
-
sendNotification
public NotificationResponse sendNotification(N notification, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) - Specified by:
sendNotificationin interfaceNotificationService<N extends Notification>
-
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
-
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:
getRepositoryin classcom.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.
-