Class RecurringNotificationService
java.lang.Object
com.bluebell.greenhouse.radicle.services.AbstractGenericEntityService<RecurringNotification, RecurringNotificationRepository>
com.bluebell.greenhouse.radicle.services.notification.RecurringNotificationService
@Service
@Transactional(readOnly=true)
public class RecurringNotificationService
extends AbstractGenericEntityService<RecurringNotification, RecurringNotificationRepository>
Service-layer for
RecurringNotification entities.- Version:
- 3.0.6
- Author:
- Stephen Prizio
-
Constructor Summary
ConstructorsConstructorDescriptionRecurringNotificationService(MarketEventService marketEventService, RecurringNotificationRepository recurringNotificationRepository, SimpleEmailService simpleEmailService) Creates the service. -
Method Summary
Modifier and TypeMethodDescriptionCreates a newRecurringNotification.booleandeleteRecurringNotification(RecurringNotification recurringNotification) Deletes the givenRecurringNotification.Returns all dueRecurringNotifications.findRecurringNotificationByUserAndNotificationType(User user, RecurringNotificationType notificationType) Resolves the recurring notification a reference identifies.intSends all due recurring notifications.sendRecurringNotification(RecurringNotification recurringNotification) Sends the given recurring notification and marks it as sent.updateRecurringNotification(RecurringNotification recurringNotification, CreateUpdateRecurringNotificationDTO data, User user) Updates an existingRecurringNotification.Methods inherited from class AbstractGenericEntityService
refreshEntity, resolveEntity, resolveEntity, resolveEntity
-
Constructor Details
-
RecurringNotificationService
public RecurringNotificationService(MarketEventService marketEventService, RecurringNotificationRepository recurringNotificationRepository, SimpleEmailService simpleEmailService) Creates the service.- Parameters:
marketEventService-MarketEventServicerecurringNotificationRepository-RecurringNotificationRepositorysimpleEmailService-SimpleEmailService
-
-
Method Details
-
resolveOwned
Resolves the recurring notification a reference identifies.- Parameters:
ref-OwnedRecurringNotificationRef- Returns:
RecurringNotification
-
findRecurringNotificationsForUser
- Parameters:
user-User- Returns:
ListofRecurringNotification
-
findRecurringNotificationByUserAndNotificationType
public Optional<RecurringNotification> findRecurringNotificationByUserAndNotificationType(User user, RecurringNotificationType notificationType) - Parameters:
user-UsernotificationType-RecurringNotificationType- Returns:
OptionalRecurringNotification
-
findDueRecurringNotifications
Returns all dueRecurringNotifications.- Returns:
ListofRecurringNotification
-
createRecurringNotification
@Transactional public RecurringNotification createRecurringNotification(CreateUpdateRecurringNotificationDTO data, User user) Creates a newRecurringNotification.- Parameters:
data-CreateUpdateRecurringNotificationDTOuser-User- Returns:
RecurringNotification
-
updateRecurringNotification
@Transactional public RecurringNotification updateRecurringNotification(RecurringNotification recurringNotification, CreateUpdateRecurringNotificationDTO data, User user) Updates an existingRecurringNotification.- Parameters:
recurringNotification-RecurringNotificationdata-CreateUpdateRecurringNotificationDTOuser-User- Returns:
- updated
RecurringNotification
-
deleteRecurringNotification
@Transactional public boolean deleteRecurringNotification(RecurringNotification recurringNotification) Deletes the givenRecurringNotification.- Parameters:
recurringNotification-RecurringNotification- Returns:
- true if deleted, false otherwise
-
sendDueRecurringNotifications
@Transactional public int sendDueRecurringNotifications()Sends all due recurring notifications.- Returns:
- count of sent notifications
-
sendRecurringNotification
@Transactional public RecurringNotification sendRecurringNotification(RecurringNotification recurringNotification) Sends the given recurring notification and marks it as sent.- Parameters:
recurringNotification-RecurringNotification- Returns:
- updated
RecurringNotification
-