Class NotificationSettingService

java.lang.Object
es.kukenan.smartfi.microservice.communication.service.messaging.AbstractDomainEventService
es.kukenan.smartfi.microservice.communication.service.messaging.NotificationSettingService

@Service public class NotificationSettingService extends AbstractDomainEventService
Service class that holds and manage all the push notification settings.
  • Field Details

    • EVENT_PUSH_ACTIVATED

      public static final String EVENT_PUSH_ACTIVATED
      Event asociated to send messsage for push activated.
      See Also:
    • pushNotificationRepository

      @Autowired private PushNotificationRepository pushNotificationRepository
      push notification repository.
    • usersRepository

      @Autowired private UsersRepository usersRepository
      user repository.
    • mobileOperationSystemRepository

      @Autowired private MobileOperationSystemRepository mobileOperationSystemRepository
      mobile operation system repository.
    • requestContextManager

      @Autowired private es.kukenan.smartfi.common.context.RequestContextManager requestContextManager
      RequestContextManager context manager.
    • messagingController

      @Autowired private MessagingController messagingController
      MessagingController controller.
    • kafkaController

      @Autowired private KafkaController kafkaController
      Kafka Controller.
  • Constructor Details

    • NotificationSettingService

      public NotificationSettingService()
  • Method Details

    • pushNotification

      @Transactional public void pushNotification(String userId, String deviceId, es.kukenan.smartfi.microservice.communications.api.pushnotification.PushNotificationRequestDto settings)
      Activated or deactivated push notification for user and device.
      Parameters:
      userId - user identification.
      deviceId - devide identification.
      settings - request with paramas.
    • checkUserId

      private User checkUserId(String userId)
      Method in charge to check the existence of user en bbdd.
      Parameters:
      userId - user identification.
      Returns:
      the user
    • savePushNotification

      private void savePushNotification(String userId, String deviceId, String token, String mobileOs, User user)
      Method in charge to save data in database.
      Parameters:
      userId - user identification.
      deviceId - device identification.
      token - device token.
      mobileOs - device OS.
      user - user data to refresh.
    • deletePushNotification

      private void deletePushNotification(String userId)
      Method in charge to delete data in database.
      Parameters:
      userId - user identification.
    • validateRequest

      private void validateRequest(String deviceId, es.kukenan.smartfi.microservice.communications.api.pushnotification.PushNotificationRequestDto settings)
    • sendMessagesForPushActivated

      private void sendMessagesForPushActivated(String userId, int companyId)
    • getPushActivated

      public es.kukenan.smartfi.microservice.communications.api.pushnotification.PushNotificationActivatedResponseDto getPushActivated(String userId)
      Get if the user has push activated or deactivated.
      Parameters:
      userId - user identification.
      Returns:
      response