├── .gitattributes ├── .gitignore ├── .travis.yml ├── .travis └── build.sh ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── api ├── api-client-library │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── sflpro │ │ │ └── notifier │ │ │ └── api │ │ │ └── client │ │ │ ├── common │ │ │ └── AbstractResourceClient.java │ │ │ └── notification │ │ │ ├── NotificationResourceClient.java │ │ │ ├── NotificationResourceClientImpl.java │ │ │ ├── email │ │ │ ├── EmailNotificationResourceClient.java │ │ │ └── impl │ │ │ │ └── EmailNotificationResourceClientImpl.java │ │ │ ├── push │ │ │ ├── PushNotificationResourceClient.java │ │ │ └── impl │ │ │ │ └── PushNotificationResourceClientImpl.java │ │ │ └── sms │ │ │ ├── SmsNotificationResourceClient.java │ │ │ └── impl │ │ │ └── SmsNotificationResourceClientImpl.java │ │ └── test │ │ └── java │ │ └── com │ │ └── sflpro │ │ └── notifier │ │ ├── api │ │ └── client │ │ │ └── notification │ │ │ ├── email │ │ │ └── impl │ │ │ │ └── EmailNotificationResourceClientImplTest.java │ │ │ ├── push │ │ │ └── impl │ │ │ │ └── PushNotificationResourceClientImplTest.java │ │ │ └── sms │ │ │ └── impl │ │ │ └── SmsNotificationResourceClientImplTest.java │ │ └── client │ │ └── test │ │ └── AbstractRestApiClientUnitTest.java ├── api-facade │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── sflpro │ │ │ └── notifier │ │ │ └── api │ │ │ └── facade │ │ │ ├── NotifierApiFacadeConfiguration.java │ │ │ ├── config │ │ │ ├── ApplicationExceptionHandlingFilter.java │ │ │ ├── CorsFilter.java │ │ │ ├── JerseyConfig.java │ │ │ └── SwaggerConfig.java │ │ │ ├── endpoints │ │ │ ├── maintanance │ │ │ │ └── HeartBeatResource.java │ │ │ └── notification │ │ │ │ ├── NotificationResource.java │ │ │ │ ├── email │ │ │ │ └── EmailNotificationResource.java │ │ │ │ ├── push │ │ │ │ └── PushNotificationResource.java │ │ │ │ └── sms │ │ │ │ └── SmsNotificationResource.java │ │ │ ├── exception │ │ │ └── AnonymisedApplicationException.java │ │ │ ├── security │ │ │ ├── AutoAuthenticationFilter.java │ │ │ ├── DefaultNotificationCreationPermissionChecker.java │ │ │ ├── DefaultPermissionChecker.java │ │ │ ├── DefaultPermissionNameResolver.java │ │ │ ├── NotificationCreationPermissionChecker.java │ │ │ ├── NotificationCreationPermissionCheckerAspect.java │ │ │ ├── PermissionChecker.java │ │ │ ├── PermissionDeniedException.java │ │ │ ├── PermissionNameResolver.java │ │ │ └── SecurityConfig.java │ │ │ └── services │ │ │ ├── AbstractNotificationServiceFacadeImpl.java │ │ │ ├── NotificationConverterHelper.java │ │ │ ├── NotificationFacade.java │ │ │ ├── NotificationFacadeImpl.java │ │ │ ├── email │ │ │ ├── EmailNotificationServiceFacade.java │ │ │ └── impl │ │ │ │ └── EmailNotificationServiceFacadeImpl.java │ │ │ ├── push │ │ │ ├── PushNotificationServiceFacade.java │ │ │ └── impl │ │ │ │ └── PushNotificationServiceFacadeImpl.java │ │ │ └── sms │ │ │ ├── SmsNotificationServiceFacade.java │ │ │ └── impl │ │ │ └── SmsNotificationServiceFacadeImpl.java │ │ └── test │ │ └── java │ │ └── com │ │ └── sflpro │ │ └── notifier │ │ └── api │ │ ├── config │ │ └── SwaggerConfigTest.java │ │ ├── facade │ │ ├── endpoints │ │ │ └── notification │ │ │ │ └── NotificationResourceTest.java │ │ ├── security │ │ │ ├── DefaultNotificationCreationPermissionCheckerTest.java │ │ │ ├── DefaultPermissionCheckerTest.java │ │ │ ├── DefaultPermissionNameResolverTest.java │ │ │ └── NotificationCreationPermissionCheckerAspectTest.java │ │ └── services │ │ │ ├── NotificationConverterHelperImplTest.java │ │ │ ├── NotificationFacadeImplTest.java │ │ │ ├── email │ │ │ └── impl │ │ │ │ └── EmailNotificationServiceFacadeImpleTest.java │ │ │ ├── push │ │ │ └── impl │ │ │ │ └── PushNotificationServiceFacadeImplTest.java │ │ │ └── sms │ │ │ └── impl │ │ │ └── SmsNotificationServiceFacadeImplTest.java │ │ └── internal │ │ └── facade │ │ ├── helper │ │ └── ServiceFacadeImplTestHelper.java │ │ └── test │ │ ├── AbstractFacadeActionRequestUnitTest.java │ │ └── AbstractFacadeUnitTest.java ├── api-model │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── sflpro │ │ └── notifier │ │ └── api │ │ └── model │ │ ├── common │ │ ├── AbstractApiModel.java │ │ ├── AbstractRequestModel.java │ │ ├── AbstractResponseModel.java │ │ ├── request │ │ │ └── ValidatableRequest.java │ │ └── result │ │ │ ├── ErrorResponseModel.java │ │ │ ├── ErrorType.java │ │ │ └── ResultResponseModel.java │ │ ├── device │ │ └── DeviceOperatingSystemClientType.java │ │ ├── email │ │ ├── EmailNotificationFileAttachmentModel.java │ │ ├── EmailNotificationModel.java │ │ ├── request │ │ │ ├── CreateEmailNotificationRequest.java │ │ │ └── EmailNotificationFileAttachmentRequest.java │ │ └── response │ │ │ └── CreateEmailNotificationResponse.java │ │ ├── notification │ │ ├── NotificationClientType.java │ │ ├── NotificationModel.java │ │ ├── NotificationSendingPriorityClientType.java │ │ ├── NotificationStateClientType.java │ │ ├── request │ │ │ ├── AbstractCreateNotificationRequest.java │ │ │ └── AbstractTemplatedCreateNotificationRequest.java │ │ └── response │ │ │ ├── AbstractCreateNotificationResponse.java │ │ │ └── NotificationResponseModel.java │ │ ├── push │ │ ├── PushNotificationModel.java │ │ ├── PushNotificationRecipientModel.java │ │ ├── request │ │ │ ├── CreatePushNotificationRequest.java │ │ │ └── UpdatePushNotificationSubscriptionRequest.java │ │ └── response │ │ │ ├── CreatePushNotificationResponse.java │ │ │ └── UpdatePushNotificationSubscriptionResponse.java │ │ └── sms │ │ ├── SmsNotificationModel.java │ │ ├── request │ │ └── CreateSmsNotificationRequest.java │ │ └── response │ │ └── CreateSmsNotificationResponse.java ├── api-web │ ├── Dockerfile │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── sflpro │ │ │ └── notifier │ │ │ └── api │ │ │ └── web │ │ │ └── NotifierApiApplication.java │ │ └── resources │ │ ├── application.properties │ │ └── logback.xml └── pom.xml ├── core ├── core-db-entities │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── sflpro │ │ └── notifier │ │ └── db │ │ └── entities │ │ ├── AbstractDomainEntityModel.java │ │ ├── AbstractDomainUuIdAwareEntityModel.java │ │ ├── device │ │ ├── UserDevice.java │ │ └── mobile │ │ │ └── DeviceOperatingSystemType.java │ │ ├── notification │ │ ├── Notification.java │ │ ├── NotificationProviderType.java │ │ ├── NotificationSendingPriority.java │ │ ├── NotificationState.java │ │ ├── NotificationType.java │ │ ├── UserNotification.java │ │ ├── email │ │ │ ├── EmailNotification.java │ │ │ ├── EmailNotificationFileAttachment.java │ │ │ ├── EmailNotificationReplyTo.java │ │ │ └── NotificationProperty.java │ │ ├── push │ │ │ ├── PushNotification.java │ │ │ ├── PushNotificationProviderType.java │ │ │ ├── PushNotificationRecipient.java │ │ │ ├── PushNotificationRecipientDevice.java │ │ │ ├── PushNotificationRecipientStatus.java │ │ │ ├── PushNotificationSubscription.java │ │ │ ├── PushNotificationSubscriptionRequest.java │ │ │ └── PushNotificationSubscriptionRequestState.java │ │ └── sms │ │ │ └── SmsNotification.java │ │ └── user │ │ └── User.java ├── core-db-repositories │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── sflpro │ │ │ │ └── notifier │ │ │ │ └── db │ │ │ │ ├── NotifierPersistenceConfiguration.java │ │ │ │ └── repositories │ │ │ │ ├── repositories │ │ │ │ ├── device │ │ │ │ │ └── UserDeviceRepository.java │ │ │ │ ├── notification │ │ │ │ │ ├── AbstractNotificationRepository.java │ │ │ │ │ ├── NotificationRepository.java │ │ │ │ │ ├── UserNotificationRepository.java │ │ │ │ │ ├── email │ │ │ │ │ │ ├── EmailNotificationFileAttachmentRepository.java │ │ │ │ │ │ └── EmailNotificationRepository.java │ │ │ │ │ ├── push │ │ │ │ │ │ ├── AbstractPushNotificationRecipientRepository.java │ │ │ │ │ │ ├── PushNotificationRecipientDeviceRepository.java │ │ │ │ │ │ ├── PushNotificationRecipientRepository.java │ │ │ │ │ │ ├── PushNotificationRecipientRepositoryCustom.java │ │ │ │ │ │ ├── PushNotificationRecipientSearchFilter.java │ │ │ │ │ │ ├── PushNotificationRepository.java │ │ │ │ │ │ ├── PushNotificationSubscriptionRepository.java │ │ │ │ │ │ ├── PushNotificationSubscriptionRequestRepository.java │ │ │ │ │ │ └── impl │ │ │ │ │ │ │ └── PushNotificationRecipientRepositoryImpl.java │ │ │ │ │ └── sms │ │ │ │ │ │ └── SmsNotificationRepository.java │ │ │ │ └── user │ │ │ │ │ └── UserRepository.java │ │ │ │ └── utility │ │ │ │ ├── EntityInitializer.java │ │ │ │ ├── PersistenceUtilityService.java │ │ │ │ └── impl │ │ │ │ ├── DummyTransactionAwarePersistenceUtilityService.java │ │ │ │ └── PersistenceUtilityServiceImpl.java │ │ └── resources │ │ │ ├── com │ │ │ └── sflpro │ │ │ │ └── notifier │ │ │ │ └── repositories.properties │ │ │ └── db │ │ │ └── migration │ │ │ ├── mysql │ │ │ ├── V1_0_0__Base_schema.sql │ │ │ ├── V1_10__notification_email_file_attachment.sql │ │ │ ├── V1_11__Notification_email_reply_to.sql │ │ │ ├── V1_12__Increase_notification_property_value_size.sql │ │ │ ├── V1_13__Notification_sending_priority.sql │ │ │ ├── V1_2__Email_templating.sql │ │ │ ├── V1_3__Secure_properties.sql │ │ │ ├── V1_4__Sms_templating.sql │ │ │ ├── V1_5__Notification_Properties.sql │ │ │ ├── V1_6__Push_Notification_FCM_Support.sql │ │ │ ├── V1_7__Email_Per_Notification_Localization_Support.sql │ │ │ ├── V1_8__Sms_Per_Notification_Localization_Support.sql │ │ │ └── V1_9__Push_notification_template_support.sql │ │ │ └── postgresql │ │ │ ├── V1_0_0__Base_schema.sql │ │ │ ├── V1_10__notification_email_file_attachment.sql │ │ │ ├── V1_11__Notification_email_reply_to.sql │ │ │ ├── V1_12__Increase_notification_property_value_size.sql │ │ │ ├── V1_13__DB_performance_optimizations.sql │ │ │ ├── V1_14__Notification_sending_priority.sql │ │ │ ├── V1_2__Email_templating.sql │ │ │ ├── V1_3__Secure_properties.sql │ │ │ ├── V1_4__Sms_templating.sql │ │ │ ├── V1_5__Notification_Properties.sql │ │ │ ├── V1_6__Push_Notification_FCM_Support.sql │ │ │ ├── V1_7__Email_Per_Notification_Localization_Support.sql │ │ │ ├── V1_8__Sms_Per_Notification_Localization_Support.sql │ │ │ └── V1_9__Push_notification_template_support.sql │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── sflpro │ │ │ └── notifier │ │ │ ├── db │ │ │ └── repositories │ │ │ │ └── repositories │ │ │ │ └── notification │ │ │ │ └── push │ │ │ │ ├── NotificationRepositoryIntegrationTest.java │ │ │ │ └── PushNotificationRecipientRepositoryIntegrationTest.java │ │ │ ├── springboot │ │ │ └── NotifierRepositoryTestApplication.java │ │ │ └── test │ │ │ └── AbstractRepositoryTest.java │ │ └── resources │ │ ├── applicationContext-persistence-integrationtest.xml │ │ └── logback.xml ├── core-services-impl │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── sflpro │ │ │ │ └── notifier │ │ │ │ └── services │ │ │ │ ├── NotifierServicesConfiguration.java │ │ │ │ ├── device │ │ │ │ └── impl │ │ │ │ │ └── UserDeviceServiceImpl.java │ │ │ │ ├── notification │ │ │ │ └── impl │ │ │ │ │ ├── AbstractNotificationServiceImpl.java │ │ │ │ │ ├── NotificationProcessingServiceImpl.java │ │ │ │ │ ├── NotificationServiceImpl.java │ │ │ │ │ ├── UserNotificationServiceImpl.java │ │ │ │ │ ├── email │ │ │ │ │ ├── DefaultEmailSenderProvider.java │ │ │ │ │ ├── EmailConfiguration.java │ │ │ │ │ ├── EmailNotificationProcessorImpl.java │ │ │ │ │ ├── EmailNotificationServiceImpl.java │ │ │ │ │ └── EmailSenderProvider.java │ │ │ │ │ ├── push │ │ │ │ │ ├── AbstractPushNotificationRecipientServiceImpl.java │ │ │ │ │ ├── ArnConfigurationService.java │ │ │ │ │ ├── ArnConfigurationServiceImpl.java │ │ │ │ │ ├── DefaultPushMessageServiceProvider.java │ │ │ │ │ ├── PushMessageServiceProvider.java │ │ │ │ │ ├── PushNotificationConfiguration.java │ │ │ │ │ ├── PushNotificationProcessorImpl.java │ │ │ │ │ ├── PushNotificationProviderProcessor.java │ │ │ │ │ ├── PushNotificationRecipientServiceImpl.java │ │ │ │ │ ├── PushNotificationServiceImpl.java │ │ │ │ │ ├── PushNotificationSubscriptionProcessingServiceImpl.java │ │ │ │ │ ├── PushNotificationSubscriptionRequestProcessingServiceImpl.java │ │ │ │ │ ├── PushNotificationSubscriptionRequestServiceImpl.java │ │ │ │ │ ├── PushNotificationSubscriptionServiceImpl.java │ │ │ │ │ ├── PushNotificationUserDeviceTokenProcessor.java │ │ │ │ │ └── PushNotificationUserDeviceTokenProcessorImpl.java │ │ │ │ │ ├── sms │ │ │ │ │ ├── DefaultSmsSenderProvider.java │ │ │ │ │ ├── LocalSmsTemplateContentResolver.java │ │ │ │ │ ├── SmsConfiguration.java │ │ │ │ │ ├── SmsNotificationProcessorImpl.java │ │ │ │ │ ├── SmsNotificationServiceImpl.java │ │ │ │ │ └── SmsSenderProvider.java │ │ │ │ │ └── template │ │ │ │ │ └── LocalTemplateContentResolver.java │ │ │ │ ├── system │ │ │ │ ├── concurrency │ │ │ │ │ └── impl │ │ │ │ │ │ ├── ExecutorBuilderImpl.java │ │ │ │ │ │ ├── ScheduledTaskExecutorServiceImpl.java │ │ │ │ │ │ ├── SynchronExecutorService.java │ │ │ │ │ │ └── SynchronFuture.java │ │ │ │ └── event │ │ │ │ │ └── impl │ │ │ │ │ └── ApplicationEventDistributionServiceImpl.java │ │ │ │ ├── template │ │ │ │ ├── TemplatingConfiguration.java │ │ │ │ ├── TemplatingServiceImpl.java │ │ │ │ └── impl │ │ │ │ │ └── TemplatingConfigurationImpl.java │ │ │ │ └── user │ │ │ │ └── impl │ │ │ │ └── UserServiceImpl.java │ │ └── resources │ │ │ └── com │ │ │ └── sflpro │ │ │ └── notifier │ │ │ └── services.properties │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── sflpro │ │ │ └── notifier │ │ │ └── services │ │ │ ├── device │ │ │ ├── UserDeviceServiceIntegrationTest.java │ │ │ └── impl │ │ │ │ └── UserDeviceServiceImplTest.java │ │ │ ├── notification │ │ │ ├── AbstractNotificationServiceIntegrationTest.java │ │ │ ├── NotificationProcessingServiceIntegrationTest.java │ │ │ ├── NotificationServiceIntegrationTest.java │ │ │ ├── UserNotificationServiceIntegrationTest.java │ │ │ ├── email │ │ │ │ └── EmailNotificationProcessorIntegrationTest.java │ │ │ ├── impl │ │ │ │ ├── AbstractNotificationServiceImplTest.java │ │ │ │ ├── EmailNotificationServiceIntegrationTest.java │ │ │ │ ├── NotificationProcessingServiceImplTest.java │ │ │ │ ├── NotificationServiceImplTest.java │ │ │ │ ├── UserNotificationServiceImplTest.java │ │ │ │ ├── email │ │ │ │ │ ├── DefaultEmailSenderProviderTest.java │ │ │ │ │ ├── EmailNotificationProcessorImplTest.java │ │ │ │ │ ├── EmailNotificationServiceImplTest.java │ │ │ │ │ └── LocalTemplateContentResolverTest.java │ │ │ │ ├── push │ │ │ │ │ ├── AbstractPushNotificationRecipientServiceImplTest.java │ │ │ │ │ ├── PushNotificationProcessorImplTest.java │ │ │ │ │ ├── PushNotificationRecipientServiceImplTest.java │ │ │ │ │ ├── PushNotificationServiceImplTest.java │ │ │ │ │ ├── PushNotificationSubscriptionProcessingServiceImplTest.java │ │ │ │ │ ├── PushNotificationSubscriptionRequestProcessingServiceImplTest.java │ │ │ │ │ ├── PushNotificationSubscriptionRequestServiceImplTest.java │ │ │ │ │ └── PushNotificationSubscriptionServiceImplTest.java │ │ │ │ └── sms │ │ │ │ │ ├── DefaultSmsSenderProviderTest.java │ │ │ │ │ ├── SmsNotificationProcessorImplTest.java │ │ │ │ │ └── SmsNotificationServiceImplTest.java │ │ │ ├── push │ │ │ │ ├── AbstractPushNotificationRecipientServiceIntegrationTest.java │ │ │ │ ├── PushNotificationProcessorIntegrationTest.java │ │ │ │ ├── PushNotificationRecipientServiceIntegrationTest.java │ │ │ │ ├── PushNotificationServiceIntegrationTest.java │ │ │ │ ├── PushNotificationSubscriptionProcessingServiceIntegrationTest.java │ │ │ │ ├── PushNotificationSubscriptionRequestProcessingServiceIntegrationTest.java │ │ │ │ ├── PushNotificationSubscriptionRequestServiceIntegrationTest.java │ │ │ │ ├── PushNotificationSubscriptionServiceIntegrationTest.java │ │ │ │ └── sns │ │ │ │ │ └── PushNotificationSnsRecipientServiceIntegrationTest.java │ │ │ └── sms │ │ │ │ ├── SmsNotificationProcessorIntegrationTest.java │ │ │ │ └── SmsNotificationServiceIntegrationTest.java │ │ │ ├── system │ │ │ ├── concurrency │ │ │ │ └── impl │ │ │ │ │ └── ScheduledTaskExecutorServiceImplTest.java │ │ │ └── event │ │ │ │ └── impl │ │ │ │ └── ApplicationEventDistributionServiceImplTest.java │ │ │ ├── template │ │ │ └── impl │ │ │ │ ├── TemplatingConfigurationImplTest.java │ │ │ │ └── TemplatingServiceImplTest.java │ │ │ ├── test │ │ │ └── AbstractServicesUnitTest.java │ │ │ └── user │ │ │ ├── UserServiceIntegrationTest.java │ │ │ └── impl │ │ │ └── UserServiceImplTest.java │ │ └── resources │ │ └── resources │ │ └── testfile.txt ├── core-services │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── sflpro │ │ └── notifier │ │ └── services │ │ ├── common │ │ ├── dto │ │ │ └── AbstractDomainEntityModelDto.java │ │ └── exception │ │ │ ├── EntityNotFoundForIdException.java │ │ │ ├── EntityNotFoundForUuIdException.java │ │ │ └── ServicesRuntimeException.java │ │ ├── device │ │ ├── UserDeviceService.java │ │ ├── dto │ │ │ └── UserDeviceDto.java │ │ └── exception │ │ │ ├── UserDeviceAlreadyExistsException.java │ │ │ ├── UserDeviceNotFoundForIdException.java │ │ │ └── UserDeviceNotFoundForUuIdException.java │ │ ├── notification │ │ ├── AbstractNotificationService.java │ │ ├── NotificationProcessingService.java │ │ ├── NotificationProcessor.java │ │ ├── NotificationService.java │ │ ├── UserNotificationService.java │ │ ├── dto │ │ │ ├── NotificationDto.java │ │ │ ├── NotificationPropertyDto.java │ │ │ ├── UserNotificationDto.java │ │ │ ├── email │ │ │ │ └── EmailNotificationDto.java │ │ │ ├── push │ │ │ │ ├── PushNotificationDto.java │ │ │ │ ├── PushNotificationRecipientDto.java │ │ │ │ ├── PushNotificationRecipientsParameters.java │ │ │ │ ├── PushNotificationSubscriptionDto.java │ │ │ │ ├── PushNotificationSubscriptionProcessingParameters.java │ │ │ │ └── PushNotificationSubscriptionRequestDto.java │ │ │ └── sms │ │ │ │ └── SmsNotificationDto.java │ │ ├── email │ │ │ ├── EmailNotificationProcessor.java │ │ │ ├── EmailNotificationService.java │ │ │ └── model │ │ │ │ └── EmailData.java │ │ ├── event │ │ │ ├── push │ │ │ │ ├── StartPushNotificationSubscriptionRequestProcessingEvent.java │ │ │ │ └── StartPushNotificationSubscriptionRequestProcessingEventListenerAdapter.java │ │ │ └── sms │ │ │ │ ├── StartSendingNotificationEvent.java │ │ │ │ └── StartSendingNotificationEventListenerAdapter.java │ │ ├── exception │ │ │ ├── NotificationInvalidStateException.java │ │ │ ├── NotificationNotFoundForIdException.java │ │ │ ├── NotificationNotFoundForUuIdException.java │ │ │ ├── UnsupportedNotificationTypeException.java │ │ │ ├── UserNotificationAlreadyExistsException.java │ │ │ ├── UserNotificationNotFoundForIdException.java │ │ │ └── push │ │ │ │ ├── PushNotificationRecipientAlreadyExistsException.java │ │ │ │ ├── PushNotificationRecipientInvalidDeviceUserException.java │ │ │ │ ├── PushNotificationRecipientNotFoundForIdException.java │ │ │ │ ├── PushNotificationRecipientNotFoundForLookupParametersException.java │ │ │ │ ├── PushNotificationSubscriptionAlreadyExistsForUserException.java │ │ │ │ ├── PushNotificationSubscriptionInvalidDeviceUserException.java │ │ │ │ ├── PushNotificationSubscriptionNotFoundForIdException.java │ │ │ │ ├── PushNotificationSubscriptionNotFoundForUserException.java │ │ │ │ ├── PushNotificationSubscriptionRequestInvalidRecipientUserException.java │ │ │ │ ├── PushNotificationSubscriptionRequestInvalidStateException.java │ │ │ │ ├── PushNotificationSubscriptionRequestNotFoundForIdException.java │ │ │ │ └── PushNotificationSubscriptionRequestNotFoundForUuIdException.java │ │ ├── push │ │ │ ├── AbstractPushNotificationRecipientService.java │ │ │ ├── PushNotificationProcessor.java │ │ │ ├── PushNotificationRecipientSearchParameters.java │ │ │ ├── PushNotificationRecipientService.java │ │ │ ├── PushNotificationService.java │ │ │ ├── PushNotificationSubscriptionProcessingService.java │ │ │ ├── PushNotificationSubscriptionRequestProcessingService.java │ │ │ ├── PushNotificationSubscriptionRequestService.java │ │ │ └── PushNotificationSubscriptionService.java │ │ └── sms │ │ │ ├── SmsNotificationProcessor.java │ │ │ └── SmsNotificationService.java │ │ ├── system │ │ ├── concurrency │ │ │ ├── ExecutorBuilder.java │ │ │ └── ScheduledTaskExecutorService.java │ │ ├── environment │ │ │ └── model │ │ │ │ └── EnvironmentType.java │ │ └── event │ │ │ ├── ApplicationEventDistributionService.java │ │ │ └── model │ │ │ ├── ApplicationEvent.java │ │ │ └── ApplicationEventListener.java │ │ ├── template │ │ └── TemplatingService.java │ │ ├── user │ │ ├── UserService.java │ │ ├── dto │ │ │ └── UserDto.java │ │ └── exception │ │ │ ├── UserAlreadyExistsForUuIdException.java │ │ │ ├── UserNotFoundForIdException.java │ │ │ └── UserNotFoundForUuidException.java │ │ └── util │ │ └── mutable │ │ └── MutableHolder.java ├── core-test-toolkit │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── sflpro │ │ │ └── notifier │ │ │ └── services │ │ │ ├── helper │ │ │ ├── ServicesImplTestHelper.java │ │ │ └── ServicesTestHelper.java │ │ │ ├── notification │ │ │ ├── impl │ │ │ │ ├── DummyPushMessageSender.java │ │ │ │ ├── DummyPushMessageSubscriber.java │ │ │ │ ├── DummySimpleEmailSender.java │ │ │ │ ├── DummySimpleSmsSender.java │ │ │ │ ├── DummyTemplatedEmailSender.java │ │ │ │ └── DummyTemplatedSmsSender.java │ │ │ └── template │ │ │ │ └── DummyTemplatingServiceImpl.java │ │ │ ├── springboot │ │ │ └── NotifierTestApplication.java │ │ │ └── test │ │ │ └── AbstractServiceIntegrationTest.java │ │ └── resources │ │ ├── com │ │ └── sflpro │ │ │ └── notifier │ │ │ └── test │ │ │ ├── applicationContext-mocks-integrationtest.xml │ │ │ └── services-integration-test.properties │ │ └── logback-test.xml └── pom.xml ├── direct-sender ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── sflpro │ │ └── notifier │ │ ├── DirectNotificationProcessor.java │ │ └── DirectNotificationProcessorConfiguration.java │ └── test │ └── java │ └── com │ └── sflpro │ └── notifier │ └── DirectNotificationProcessorTest.java ├── infra ├── infra-integrations │ ├── infra-integrations-common │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── sflpro │ │ │ │ └── notifier │ │ │ │ └── externalclients │ │ │ │ └── common │ │ │ │ ├── communicator │ │ │ │ └── AbstractApiCommunicatorImpl.java │ │ │ │ └── http │ │ │ │ ├── exception │ │ │ │ └── ExternalClientRuntimeException.java │ │ │ │ └── rest │ │ │ │ ├── RestClient.java │ │ │ │ └── RestClientImpl.java │ │ │ └── resources │ │ │ └── applicationContext-externalclients-common.xml │ ├── infra-integrations-email │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── sflpro │ │ │ │ │ └── notifier │ │ │ │ │ └── externalclients │ │ │ │ │ └── email │ │ │ │ │ ├── common │ │ │ │ │ ├── exception │ │ │ │ │ │ └── ExternalEmailNotificationClientRuntimeException.java │ │ │ │ │ └── model │ │ │ │ │ │ └── AbstractEmailNotificationApiCommunicatorModel.java │ │ │ │ │ ├── mandrill │ │ │ │ │ ├── MandrillConfiguration.java │ │ │ │ │ ├── MandrillSimpleEmailSender.java │ │ │ │ │ ├── MandrillTemplatedEmailSender.java │ │ │ │ │ ├── communicator │ │ │ │ │ │ ├── MandrillApiCommunicator.java │ │ │ │ │ │ └── MandrillApiCommunicatorImpl.java │ │ │ │ │ ├── exception │ │ │ │ │ │ ├── MandrillApiDisabledException.java │ │ │ │ │ │ ├── MandrillEmailClientRuntimeException.java │ │ │ │ │ │ ├── MandrillMessageInvalidException.java │ │ │ │ │ │ └── MandrillMessageRejectedException.java │ │ │ │ │ └── model │ │ │ │ │ │ ├── AbstractMandrillEmailApiCommunicatorModel.java │ │ │ │ │ │ └── request │ │ │ │ │ │ └── SendEmailRequest.java │ │ │ │ │ ├── registry │ │ │ │ │ └── EmailSenderRegistryConfiguration.java │ │ │ │ │ └── smtp │ │ │ │ │ ├── SmtpEmailSenderConfiguration.java │ │ │ │ │ ├── SmtpSimpleEmailSender.java │ │ │ │ │ ├── SmtpTemplatedEmailSender.java │ │ │ │ │ ├── SmtpTransportException.java │ │ │ │ │ ├── SmtpTransportService.java │ │ │ │ │ └── SmtpTransportServiceImpl.java │ │ │ └── resources │ │ │ │ └── integrations-email.properties │ │ │ └── test │ │ │ ├── java │ │ │ └── com │ │ │ │ └── sflpro │ │ │ │ └── notifier │ │ │ │ └── externalclients │ │ │ │ └── email │ │ │ │ ├── mandrill │ │ │ │ ├── MandrillSimpleEmailSenderTest.java │ │ │ │ ├── MandrillTemplatedEmailSenderTest.java │ │ │ │ └── communicator │ │ │ │ │ ├── MandrillApiCommunicatorImplTest.java │ │ │ │ │ └── MandrillApiCommunicatorIntegrationTest.java │ │ │ │ ├── mock │ │ │ │ └── DummyTemplateContentResolver.java │ │ │ │ └── test │ │ │ │ ├── AbstractEmailNotificationIntegrationTest.java │ │ │ │ └── AbstractEmailNotificationUnitTest.java │ │ │ └── resources │ │ │ └── applicationContext-externalclients-email-integrationtest.xml │ ├── infra-integrations-push │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── sflpro │ │ │ │ │ └── notifier │ │ │ │ │ └── externalclients │ │ │ │ │ └── push │ │ │ │ │ ├── amazon │ │ │ │ │ ├── AmazonSnsConfiguration.java │ │ │ │ │ ├── AmazonSnsPushMessageSender.java │ │ │ │ │ ├── AmazonSnsPushMessageSubscriber.java │ │ │ │ │ ├── communicator │ │ │ │ │ │ ├── AmazonSnsApiCommunicator.java │ │ │ │ │ │ └── AmazonSnsApiCommunicatorImpl.java │ │ │ │ │ ├── exception │ │ │ │ │ │ └── AmazonSnsClientRuntimeException.java │ │ │ │ │ └── model │ │ │ │ │ │ ├── AbstractAmazonSnsApiCommunicatorModel.java │ │ │ │ │ │ ├── request │ │ │ │ │ │ ├── GetDeviceEndpointAttributesRequest.java │ │ │ │ │ │ ├── RegisterUserDeviceTokenRequest.java │ │ │ │ │ │ ├── SendPushNotificationRequestMessageInformation.java │ │ │ │ │ │ └── UpdateDeviceEndpointAttributesRequest.java │ │ │ │ │ │ └── response │ │ │ │ │ │ ├── GetDeviceEndpointAttributesResponse.java │ │ │ │ │ │ ├── RegisterUserDeviceTokenResponse.java │ │ │ │ │ │ ├── SendPushNotificationResponse.java │ │ │ │ │ │ └── UpdateDeviceEndpointAttributesResponse.java │ │ │ │ │ ├── common │ │ │ │ │ ├── exception │ │ │ │ │ │ └── ExternalPushNotificationClientRuntimeException.java │ │ │ │ │ └── model │ │ │ │ │ │ └── AbstractPushNotificationApiCommunicatorModel.java │ │ │ │ │ └── firebase │ │ │ │ │ ├── FirebaseMessagingConfiguration.java │ │ │ │ │ ├── FirebasePushMessageSender.java │ │ │ │ │ ├── FirebasePushMessageSubscriber.java │ │ │ │ │ └── MessageSendingFaildException.java │ │ │ └── resources │ │ │ │ ├── applicationContext-externalclients-push-communicators.xml │ │ │ │ ├── applicationContext-externalclients-push.xml │ │ │ │ └── com │ │ │ │ └── sflpro │ │ │ │ └── notifier │ │ │ │ └── externalclients │ │ │ │ └── push │ │ │ │ └── firebase │ │ │ │ └── notifier-development-firebase-adminsdk-629bf-582f1cff8f.json │ │ │ └── test │ │ │ ├── java │ │ │ └── com │ │ │ │ └── sflpro │ │ │ │ └── notifier │ │ │ │ └── externalclients │ │ │ │ └── push │ │ │ │ ├── amazon │ │ │ │ ├── AmazonSnsPushMessageSenderTest.java │ │ │ │ ├── AmazonSnsPushMessageSubscriberTest.java │ │ │ │ └── communicator │ │ │ │ │ ├── AmazonSnsApiCommunicatorImplTest.java │ │ │ │ │ └── AmazonSnsApiCommunicatorIntegrationTest.java │ │ │ │ ├── firebase │ │ │ │ ├── FirebasePushMessageSenderIntegrationTest.java │ │ │ │ └── FirebasePushMessageSenderTest.java │ │ │ │ ├── registry │ │ │ │ └── PushMessageRegistryConfiguration.java │ │ │ │ └── test │ │ │ │ ├── AbstractPushNotificationIntegrationTest.java │ │ │ │ └── AbstractPushNotificationUnitTest.java │ │ │ └── resources │ │ │ ├── applicationContext-externalclients-push-integrationtest.xml │ │ │ └── externalclients_push_integrationtest.properties │ ├── infra-integrations-sms │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── sflpro │ │ │ │ │ └── notifier │ │ │ │ │ └── externalclients │ │ │ │ │ └── sms │ │ │ │ │ ├── common │ │ │ │ │ ├── exception │ │ │ │ │ │ └── ExternalSmsClientRuntimeException.java │ │ │ │ │ └── model │ │ │ │ │ │ └── AbstractSmsApiCommunicatorModel.java │ │ │ │ │ ├── msgam │ │ │ │ │ ├── AbstractMsgAmSmsSender.java │ │ │ │ │ ├── MsgAmConfiguration.java │ │ │ │ │ ├── MsgAmSimpleSmsSender.java │ │ │ │ │ ├── MsgAmTemplatedSmsSender.java │ │ │ │ │ ├── client │ │ │ │ │ │ ├── MsgAmRestClient.java │ │ │ │ │ │ └── MsgAmRestClientImpl.java │ │ │ │ │ ├── communicator │ │ │ │ │ │ ├── DefaultMsgAmApiCommunicator.java │ │ │ │ │ │ └── MsgAmApiCommunicator.java │ │ │ │ │ ├── exception │ │ │ │ │ │ └── MsgAmClientRuntimeException.java │ │ │ │ │ └── model │ │ │ │ │ │ ├── request │ │ │ │ │ │ ├── ClientSmsSendMessagesRequest.java │ │ │ │ │ │ ├── Message.java │ │ │ │ │ │ ├── SendMessagesRequest.java │ │ │ │ │ │ └── User.java │ │ │ │ │ │ └── response │ │ │ │ │ │ ├── Information.java │ │ │ │ │ │ ├── Message.java │ │ │ │ │ │ └── SendMessagesResponse.java │ │ │ │ │ ├── nikitamobile │ │ │ │ │ ├── AbstractNikitamobileSmsSender.java │ │ │ │ │ ├── NikitamobileConfiguration.java │ │ │ │ │ ├── NikitamobileDateTimeUtil.java │ │ │ │ │ ├── NikitamobileSimpleSmsSender.java │ │ │ │ │ ├── NikitamobileTemplatedSmsSender.java │ │ │ │ │ ├── communicator │ │ │ │ │ │ ├── DefaultNikitamobileApiCommunicator.java │ │ │ │ │ │ └── NikitamobileApiCommunicator.java │ │ │ │ │ ├── exception │ │ │ │ │ │ └── NikitamobileClientRuntimeException.java │ │ │ │ │ └── model │ │ │ │ │ │ ├── Content.java │ │ │ │ │ │ ├── NikitamobileDateTimeAdapter.java │ │ │ │ │ │ ├── request │ │ │ │ │ │ ├── Message.java │ │ │ │ │ │ └── SendMessageRequest.java │ │ │ │ │ │ └── response │ │ │ │ │ │ ├── Message.java │ │ │ │ │ │ └── SendMessageResponse.java │ │ │ │ │ ├── registry │ │ │ │ │ └── SmsRegistryConfiguration.java │ │ │ │ │ ├── twillio │ │ │ │ │ ├── AbstractTwillioSmsSender.java │ │ │ │ │ ├── TwillioConfiguration.java │ │ │ │ │ ├── TwillioSimpleSmsSender.java │ │ │ │ │ ├── TwillioTemplatedSmsSender.java │ │ │ │ │ ├── communicator │ │ │ │ │ │ ├── DefaultTwillioApiCommunicator.java │ │ │ │ │ │ └── TwillioApiCommunicator.java │ │ │ │ │ ├── exception │ │ │ │ │ │ └── TwillioClientRuntimeException.java │ │ │ │ │ └── model │ │ │ │ │ │ ├── request │ │ │ │ │ │ └── SendMessageRequest.java │ │ │ │ │ │ └── response │ │ │ │ │ │ └── SendMessageResponse.java │ │ │ │ │ └── webhook │ │ │ │ │ ├── AbstractWebhookSmsSender.java │ │ │ │ │ ├── WebhookSimpleSmsSender.java │ │ │ │ │ ├── WebhookSmsSenderConfiguration.java │ │ │ │ │ ├── WebhookTemplatedSmsSender.java │ │ │ │ │ ├── client │ │ │ │ │ ├── WebhookApiRestClient.java │ │ │ │ │ └── WebhookApiRestClientImpl.java │ │ │ │ │ ├── exception │ │ │ │ │ └── WebhookSenderClientRuntimeException.java │ │ │ │ │ └── request │ │ │ │ │ └── WebhookSmsSendMessagesRequest.java │ │ │ └── resources │ │ │ │ └── integrations-sms.properties │ │ │ └── test │ │ │ ├── java │ │ │ └── com │ │ │ │ └── sflpro │ │ │ │ └── notifier │ │ │ │ └── externalclients │ │ │ │ └── sms │ │ │ │ ├── mock │ │ │ │ └── DummySmsTemplateContentResolver.java │ │ │ │ ├── msgam │ │ │ │ ├── MsgAmSimpleSmsSenderIntegrationTest.java │ │ │ │ ├── MsgAmSimpleSmsSenderTest.java │ │ │ │ ├── MsgAmTeemplatedSmsSenderTest.java │ │ │ │ ├── client │ │ │ │ │ └── MsgAmRestClientImplTest.java │ │ │ │ └── comunicator │ │ │ │ │ └── DefaultMsgAmApiCommunicatorTest.java │ │ │ │ ├── nikitamobile │ │ │ │ ├── NikitaMobileSimpleSmsSenderIntegrationTest.java │ │ │ │ ├── NikitamobileSimpleSmsSenderTest.java │ │ │ │ ├── NikitamobileTemplatedSmsSenderTest.java │ │ │ │ └── comunicator │ │ │ │ │ └── DefaultNikitamobileApiCommunicatorTest.java │ │ │ │ ├── test │ │ │ │ ├── AbstractSmsIntegrationTest.java │ │ │ │ └── AbstractSmsUnitTest.java │ │ │ │ ├── twillio │ │ │ │ ├── TwillioApiCommunicatorIntegrationTest.java │ │ │ │ ├── TwillioSimpleSmsSenderTest.java │ │ │ │ ├── TwillioTemplatedSmsSenderTest.java │ │ │ │ └── comunicator │ │ │ │ │ └── DefaultTwillioApiCommunicatorTest.java │ │ │ │ └── webhook │ │ │ │ ├── WebhookSimpleSmsSenderTest.java │ │ │ │ ├── WebhookTemplatedSmsSenderTest.java │ │ │ │ └── client │ │ │ │ └── WebhookApiRestClientImplTest.java │ │ │ └── resources │ │ │ ├── applicationContext-externalclients-sms-integrationtest.xml │ │ │ └── externalclients_sms_integrationtest.properties │ └── pom.xml ├── infra-queue │ ├── infra-queue-common │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── sflpro │ │ │ │ └── notifier │ │ │ │ └── queue │ │ │ │ ├── QueueConfigurationDefaults.java │ │ │ │ └── amqp │ │ │ │ ├── RabbitConfiguration.java │ │ │ │ ├── model │ │ │ │ ├── AbstractRPCTransferModel.java │ │ │ │ └── notification │ │ │ │ │ ├── NotificationRPCTransferModel.java │ │ │ │ │ └── push │ │ │ │ │ └── PushNotificationSubscriptionRequestRPCTransferModel.java │ │ │ │ ├── queues │ │ │ │ └── UniquelyNamedConfigurableQueue.java │ │ │ │ └── rpc │ │ │ │ ├── RPCCallType.java │ │ │ │ ├── RPCQueueMessageHandler.java │ │ │ │ ├── RPCServiceAdapter.java │ │ │ │ ├── ServiceRPCAdaptersRegistry.java │ │ │ │ ├── impl │ │ │ │ ├── AbstractRPCServiceAdapterImpl.java │ │ │ │ ├── RPCQueueMessageHandlerImpl.java │ │ │ │ └── ServiceRPCAdaptersRegistryImpl.java │ │ │ │ └── message │ │ │ │ ├── RPCMessage.java │ │ │ │ └── RPCMethodHandler.java │ │ │ └── resources │ │ │ └── com │ │ │ └── sflpro │ │ │ └── notifier │ │ │ └── queue.properties │ ├── infra-queue-consumer │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── sflpro │ │ │ │ │ └── notifier │ │ │ │ │ └── queue │ │ │ │ │ └── consumer │ │ │ │ │ ├── ConsumerConfiguration.java │ │ │ │ │ ├── KafkaConsumerConfiguration.java │ │ │ │ │ ├── RPCQueueMessageHandlerAdapter.java │ │ │ │ │ ├── RabbitConsumerConfiguration.java │ │ │ │ │ ├── common │ │ │ │ │ ├── NotificationQueueConsumerService.java │ │ │ │ │ ├── impl │ │ │ │ │ │ └── NotificationQueueConsumerServiceImpl.java │ │ │ │ │ └── rpc │ │ │ │ │ │ └── NotificationQueueConsumerServiceRPCAdapterImpl.java │ │ │ │ │ └── push │ │ │ │ │ ├── KafkaConsumerListenerServiceImpl.java │ │ │ │ │ ├── PushNotificationQueueConsumerService.java │ │ │ │ │ ├── PushNotificationSubscriptionRequestQueueConsumerService.java │ │ │ │ │ ├── impl │ │ │ │ │ └── PushNotificationSubscriptionRequestQueueConsumerServiceImpl.java │ │ │ │ │ └── rpc │ │ │ │ │ └── PushNotificationSubscriptionRequestQueueConsumerServiceRPCAdapterImpl.java │ │ │ └── resources │ │ │ │ └── applicationContext-queue-consumer-amqp.xml │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── sflpro │ │ │ └── notifier │ │ │ └── queue │ │ │ └── consumer │ │ │ ├── RPCQueueMessageHandlerAdapterTest.java │ │ │ ├── common │ │ │ └── impl │ │ │ │ └── NotificationQueueConsumerServiceImplTest.java │ │ │ ├── push │ │ │ └── impl │ │ │ │ └── PushNotificationSubscriptionRequestQueueConsumerServiceImplTest.java │ │ │ └── test │ │ │ └── AbstractQueueConsumerUnitTest.java │ ├── infra-queue-producer │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── sflpro │ │ │ │ └── notifier │ │ │ │ └── queue │ │ │ │ └── producer │ │ │ │ ├── KafkaProducerConfiguration.java │ │ │ │ ├── ProducerConfiguration.java │ │ │ │ ├── RabbitProducerConfiguration.java │ │ │ │ ├── connector │ │ │ │ ├── AmqpConnectorService.java │ │ │ │ ├── AmqpResponseHandler.java │ │ │ │ └── impl │ │ │ │ │ ├── KafkaConnectorServiceImpl.java │ │ │ │ │ └── RabbitConnectorServiceImpl.java │ │ │ │ └── notification │ │ │ │ ├── NotificationQueueProducerConfiguration.java │ │ │ │ ├── common │ │ │ │ ├── NotificationQueueProducerService.java │ │ │ │ └── impl │ │ │ │ │ └── NotificationQueueProducerServiceImpl.java │ │ │ │ └── push │ │ │ │ ├── PushNotificationSubscriptionRequestQueueProducerService.java │ │ │ │ └── impl │ │ │ │ └── PushNotificationSubscriptionRequestQueueProducerServiceImpl.java │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── sflpro │ │ │ └── notifier │ │ │ └── queue │ │ │ └── producer │ │ │ ├── AbstractQueueProducerUnitTest.java │ │ │ └── notification │ │ │ ├── common │ │ │ └── impl │ │ │ │ └── NotificationQueueProducerServiceImplTest.java │ │ │ └── push │ │ │ └── impl │ │ │ └── PushNotificationSubscriptionRequestQueueProducerServiceImplTest.java │ └── pom.xml └── pom.xml ├── notification-provider-spi ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── sflpro │ │ └── notifier │ │ └── spi │ │ ├── email │ │ ├── AbstractEmailMessage.java │ │ ├── EmailMessage.java │ │ ├── EmailSender.java │ │ ├── ImmutableSimpleEmailMessage.java │ │ ├── ImmutableSimpleEmailSenderRegistry.java │ │ ├── ImmutableTemplatedEmailMessage.java │ │ ├── ImmutableTemplatedEmailSenderRegistry.java │ │ ├── SimpleEmailMessage.java │ │ ├── SimpleEmailSender.java │ │ ├── SimpleEmailSenderRegistry.java │ │ ├── SpiEmailNotificationFileAttachment.java │ │ ├── TemplatedEmailMessage.java │ │ ├── TemplatedEmailMessageBuilder.java │ │ ├── TemplatedEmailSender.java │ │ └── TemplatedEmailSenderRegistry.java │ │ ├── push │ │ ├── ImmutablePushMessage.java │ │ ├── ImmutablePushMessageSendingResult.java │ │ ├── ImmutablePushMessageServiceRegistry.java │ │ ├── PlatformType.java │ │ ├── PushMessage.java │ │ ├── PushMessageSender.java │ │ ├── PushMessageSendingResult.java │ │ ├── PushMessageServiceRegistry.java │ │ └── PushMessageSubscriber.java │ │ ├── sms │ │ ├── AbstractSmsMessage.java │ │ ├── ImmutableSimpleSmsMessage.java │ │ ├── ImmutableSimpleSmsSenderRegistry.java │ │ ├── ImmutableSmsMessageSendingResult.java │ │ ├── ImmutableTemplatedSmsMessage.java │ │ ├── ImmutableTemplatedSmsSenderRegistry.java │ │ ├── SimpleSmsMessage.java │ │ ├── SimpleSmsSender.java │ │ ├── SimpleSmsSenderRegistry.java │ │ ├── SmsMessage.java │ │ ├── SmsMessageSendingResult.java │ │ ├── SmsSender.java │ │ ├── SmsTemplateContentResolver.java │ │ ├── TemplatedSmsMessage.java │ │ ├── TemplatedSmsSender.java │ │ └── TemplatedSmsSenderRegistry.java │ │ └── template │ │ ├── ImmutableTemplateContent.java │ │ ├── TemplateContent.java │ │ └── TemplateContentResolver.java │ └── test │ └── java │ └── com │ └── sflpro │ └── notifier │ └── spi │ └── email │ └── TemplatedEmailMessageBuilderTest.java ├── pom.xml ├── report └── pom.xml ├── samples ├── db_init │ └── create_database.sql ├── notifier-postgres-noworker │ └── docker-compose.yml ├── notifier-postgres-rabbit │ └── docker-compose.yml ├── send_email.sh ├── send_push_notification.sh └── subscribe_to_push_notifications.sh ├── secret.tar.bz2.enc └── worker ├── Dockerfile ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── sflpro │ │ └── notifier │ │ └── worker │ │ ├── NotifierWorkerApplication.java │ │ └── resources │ │ └── maintanance │ │ └── HeartBeatResource.java └── resources │ ├── application.properties │ └── logback.xml └── test └── java └── com └── sflpro └── notifier └── queue └── consumer ├── notification └── common │ └── NotificationQueueConsumerServiceIntegrationTest.java ├── push └── PushNotificationSubscriptionRequestQueueConsumerServiceIntegrationTest.java └── test ├── AbstractQueueConsumerIntegrationTest.java └── ConsumerTestConfiguration.java /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sql text eol=lf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .idea/ 3 | target/ 4 | data/ 5 | /secret 6 | secret.tar.bz2 7 | .DS_Store 8 | *.xml.versionsBackup 9 | -------------------------------------------------------------------------------- /api/api-client-library/src/main/java/com/sflpro/notifier/api/client/notification/NotificationResourceClient.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.client.notification; 2 | 3 | import com.sflpro.notifier.api.model.notification.NotificationModel; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | /** 8 | * Company: SFL LLC 9 | * Created on 16/11/2020 10 | * 11 | * @author Norik Aslanyan 12 | */ 13 | public interface NotificationResourceClient { 14 | 15 | /** 16 | * Create email notification 17 | * 18 | * @param id 19 | * @param authToken The Bearer token to be used for authentication/authorization 20 | * @return response 21 | */ 22 | @Nonnull 23 | NotificationModel get(@Nonnull final String id, @Nonnull final String authToken); 24 | } 25 | -------------------------------------------------------------------------------- /api/api-client-library/src/main/java/com/sflpro/notifier/api/client/notification/email/EmailNotificationResourceClient.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.client.notification.email; 2 | 3 | import com.sflpro.notifier.api.model.common.result.ResultResponseModel; 4 | import com.sflpro.notifier.api.model.email.request.CreateEmailNotificationRequest; 5 | import com.sflpro.notifier.api.model.email.response.CreateEmailNotificationResponse; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | /** 10 | * User: Ruben Dilanyan 11 | * Company: SFL LLC 12 | * Date: 1/14/16 13 | * Time: 2:17 PM 14 | */ 15 | public interface EmailNotificationResourceClient { 16 | 17 | /** 18 | * Create email notification 19 | * 20 | * @param request 21 | * @return response 22 | */ 23 | @Nonnull 24 | ResultResponseModel createEmailNotification(@Nonnull final CreateEmailNotificationRequest request); 25 | 26 | /** 27 | * Create email notification 28 | * 29 | * @param request 30 | * @param authToken The Bearer token to be used for authentication/authorization 31 | * @return response 32 | */ 33 | @Nonnull 34 | ResultResponseModel createEmailNotification(@Nonnull final CreateEmailNotificationRequest request, @Nonnull final String authToken); 35 | } 36 | -------------------------------------------------------------------------------- /api/api-client-library/src/main/java/com/sflpro/notifier/api/client/notification/sms/SmsNotificationResourceClient.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.client.notification.sms; 2 | 3 | import com.sflpro.notifier.api.model.common.result.ResultResponseModel; 4 | import com.sflpro.notifier.api.model.sms.request.CreateSmsNotificationRequest; 5 | import com.sflpro.notifier.api.model.sms.response.CreateSmsNotificationResponse; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | /** 10 | * User: Ruben Dilanyan 11 | * Company: SFL LLC 12 | * Date: 1/14/16 13 | * Time: 2:17 PM 14 | */ 15 | public interface SmsNotificationResourceClient { 16 | 17 | /** 18 | * Create SMS notification 19 | * 20 | * @param request 21 | * @return response 22 | */ 23 | @Nonnull 24 | ResultResponseModel createSmsNotification(@Nonnull final CreateSmsNotificationRequest request); 25 | 26 | /** 27 | * Create SMS notification 28 | * 29 | * @param request 30 | * @param authToken The Bearer token to be used for authentication/authorization 31 | * @return response 32 | */ 33 | @Nonnull 34 | ResultResponseModel createSmsNotification(@Nonnull final CreateSmsNotificationRequest request, @Nonnull final String authToken); 35 | } 36 | -------------------------------------------------------------------------------- /api/api-client-library/src/test/java/com/sflpro/notifier/client/test/AbstractRestApiClientUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.client.test; 2 | 3 | import org.easymock.EasyMockRunner; 4 | import org.easymock.EasyMockSupport; 5 | import org.junit.Ignore; 6 | import org.junit.runner.RunWith; 7 | 8 | import java.util.UUID; 9 | 10 | /** 11 | * User: Ruben Dilanyan 12 | * Company: SFL LLC 13 | * Date: 5/21/15 14 | * Time: 12:28 PM 15 | */ 16 | @RunWith(EasyMockRunner.class) 17 | @Ignore 18 | public abstract class AbstractRestApiClientUnitTest extends EasyMockSupport { 19 | 20 | 21 | public AbstractRestApiClientUnitTest() { 22 | } 23 | 24 | /* Utility methods */ 25 | 26 | /* Getters and setters */ 27 | public static String uuid(){ 28 | return UUID.randomUUID().toString(); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /api/api-facade/src/main/java/com/sflpro/notifier/api/facade/NotifierApiFacadeConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.facade; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | @Configuration 7 | @ComponentScan(basePackages = "com.sflpro.notifier.api.facade") 8 | public class NotifierApiFacadeConfiguration { 9 | } 10 | -------------------------------------------------------------------------------- /api/api-facade/src/main/java/com/sflpro/notifier/api/facade/endpoints/maintanance/HeartBeatResource.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.facade.endpoints.maintanance; 2 | 3 | import io.swagger.annotations.Api; 4 | import io.swagger.annotations.ApiOperation; 5 | import io.swagger.annotations.SwaggerDefinition; 6 | import io.swagger.annotations.Tag; 7 | 8 | import javax.inject.Singleton; 9 | import javax.ws.rs.GET; 10 | import javax.ws.rs.Path; 11 | import javax.ws.rs.core.Response; 12 | 13 | /** 14 | * User: Ruben Dilanyan 15 | * Company: SFL LLC 16 | * Date: 5/19/15 17 | * Time: 1:32 AM 18 | */ 19 | @SwaggerDefinition(tags = {@Tag(name = "heartbeat", description = "The status of the notification service")}) 20 | @Api(tags = {"heartbeat"}) 21 | @Singleton 22 | @Path("heartbeat") 23 | public class HeartBeatResource { 24 | /* Constructors */ 25 | public HeartBeatResource() { 26 | //default constructor 27 | } 28 | 29 | 30 | @ApiOperation("Returns notification service's status") 31 | @GET 32 | public Response checkHearBeat() { 33 | return Response.ok("OK").build(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /api/api-facade/src/main/java/com/sflpro/notifier/api/facade/exception/AnonymisedApplicationException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.facade.exception; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | 5 | /** 6 | * User: Mher Sargsyan 7 | * Company: SFL LLC 8 | * Date: 4/24/15 9 | * Time: 9:30 PM 10 | */ 11 | public class AnonymisedApplicationException extends RuntimeException { 12 | private static final long serialVersionUID = 2862176974634476020L; 13 | 14 | /* Properties */ 15 | private final String uuId; 16 | 17 | public AnonymisedApplicationException(final String uuId) { 18 | super("Exception with uuID - " + uuId + " caught during processing the request"); 19 | this.uuId = uuId; 20 | } 21 | 22 | /* Getters and setters */ 23 | public String getUuId() { 24 | return uuId; 25 | } 26 | 27 | /* ToString */ 28 | @Override 29 | public String toString() { 30 | final ToStringBuilder builder = new ToStringBuilder(this); 31 | builder.append("errorUuId", this.getUuId()); 32 | return builder.build(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /api/api-facade/src/main/java/com/sflpro/notifier/api/facade/security/NotificationCreationPermissionChecker.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.facade.security; 2 | 3 | import com.sflpro.notifier.services.notification.dto.NotificationDto; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | /** 8 | * Created by Hayk Mkrtchyan. 9 | * Date: 6/26/19 10 | * Time: 3:05 PM 11 | */ 12 | interface NotificationCreationPermissionChecker { 13 | 14 | > boolean isNotificationCreationAllowed(@Nonnull final N notification); 15 | } 16 | -------------------------------------------------------------------------------- /api/api-facade/src/main/java/com/sflpro/notifier/api/facade/security/PermissionChecker.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.facade.security; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 6/26/19 6 | * Time: 2:25 PM 7 | */ 8 | interface PermissionChecker { 9 | 10 | boolean isPermitted(final String permission, final String accessToken); 11 | } 12 | -------------------------------------------------------------------------------- /api/api-facade/src/main/java/com/sflpro/notifier/api/facade/security/PermissionDeniedException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.facade.security; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 6/27/19 6 | * Time: 10:31 AM 7 | */ 8 | public class PermissionDeniedException extends RuntimeException { 9 | 10 | public PermissionDeniedException(final String message) { 11 | super(message); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /api/api-facade/src/main/java/com/sflpro/notifier/api/facade/security/PermissionNameResolver.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.facade.security; 2 | 3 | import com.sflpro.notifier.services.notification.dto.NotificationDto; 4 | 5 | import java.util.Optional; 6 | 7 | /** 8 | * Created by Hayk Mkrtchyan. 9 | * Date: 6/28/19 10 | * Time: 11:14 AM 11 | */ 12 | interface PermissionNameResolver { 13 | 14 | > Optional resolve(final R creationRequest); 15 | } 16 | -------------------------------------------------------------------------------- /api/api-facade/src/main/java/com/sflpro/notifier/api/facade/services/NotificationFacade.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.facade.services; 2 | 3 | import com.sflpro.notifier.api.model.notification.NotificationModel; 4 | 5 | /** 6 | * Company: SFL LLC 7 | * Created on 17/11/2020 8 | * 9 | * @author Norik Aslanyan 10 | */ 11 | public interface NotificationFacade { 12 | 13 | NotificationModel get(Long id); 14 | } 15 | -------------------------------------------------------------------------------- /api/api-facade/src/main/java/com/sflpro/notifier/api/facade/services/email/EmailNotificationServiceFacade.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.facade.services.email; 2 | 3 | import com.sflpro.notifier.api.model.common.result.ResultResponseModel; 4 | import com.sflpro.notifier.api.model.email.request.CreateEmailNotificationRequest; 5 | import com.sflpro.notifier.api.model.email.response.CreateEmailNotificationResponse; 6 | 7 | /** 8 | * Created by Hayk Mkrtchyan. 9 | * Date: 7/1/19 10 | * Time: 2:43 PM 11 | */ 12 | public interface EmailNotificationServiceFacade { 13 | 14 | ResultResponseModel createEmailNotification(final CreateEmailNotificationRequest request); 15 | } 16 | -------------------------------------------------------------------------------- /api/api-facade/src/main/java/com/sflpro/notifier/api/facade/services/sms/SmsNotificationServiceFacade.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.facade.services.sms; 2 | 3 | import com.sflpro.notifier.api.model.common.result.ResultResponseModel; 4 | import com.sflpro.notifier.api.model.sms.request.CreateSmsNotificationRequest; 5 | import com.sflpro.notifier.api.model.sms.response.CreateSmsNotificationResponse; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | /** 10 | * User: Ruben Dilanyan 11 | * Company: SFL LLC 12 | * Date: 1/13/16 13 | * Time: 5:13 PM 14 | */ 15 | public interface SmsNotificationServiceFacade { 16 | 17 | /** 18 | * Creates email notification for provided request 19 | * 20 | * @param request 21 | * @return response 22 | */ 23 | @Nonnull 24 | ResultResponseModel createSmsNotification(@Nonnull final CreateSmsNotificationRequest request); 25 | } 26 | -------------------------------------------------------------------------------- /api/api-facade/src/test/java/com/sflpro/notifier/api/config/SwaggerConfigTest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.config; 2 | 3 | import com.sflpro.notifier.api.facade.config.SwaggerConfig; 4 | import com.sflpro.notifier.api.internal.facade.test.AbstractFacadeUnitTest; 5 | import io.swagger.jaxrs.config.BeanConfig; 6 | import org.junit.Before; 7 | import org.junit.Test; 8 | 9 | import static org.junit.Assert.assertEquals; 10 | import static org.junit.Assert.assertNotNull; 11 | 12 | /** 13 | * Company: SFL LLC 14 | * Created on 18/09/2019 15 | * 16 | * @author Davit Harutyunyan 17 | */ 18 | public class SwaggerConfigTest extends AbstractFacadeUnitTest { 19 | 20 | private SwaggerConfig swaggerConfig; 21 | 22 | @Before 23 | public void prepare() { 24 | swaggerConfig = new SwaggerConfig(); 25 | } 26 | 27 | @Test 28 | public void testGetConfig() { 29 | // Run test scenario 30 | BeanConfig beanConfig = swaggerConfig.getSwaggerConfig(); 31 | // Assertions 32 | assertEquals("com.sflpro.notifier.api.facade.endpoints", beanConfig.getResourcePackage()); 33 | assertNotNull(beanConfig.getInfo()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /api/api-facade/src/test/java/com/sflpro/notifier/api/facade/services/NotificationFacadeImplTest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.facade.services; 2 | 3 | import com.sflpro.notifier.api.model.notification.NotificationModel; 4 | import com.sflpro.notifier.db.entities.notification.email.EmailNotification; 5 | import com.sflpro.notifier.services.notification.NotificationService; 6 | import org.apache.commons.lang3.RandomUtils; 7 | import org.junit.Assert; 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | import org.mockito.InjectMocks; 11 | import org.mockito.Mock; 12 | import org.mockito.Mockito; 13 | import org.mockito.junit.MockitoJUnitRunner; 14 | 15 | @RunWith(MockitoJUnitRunner.class) 16 | public class NotificationFacadeImplTest { 17 | 18 | @Mock 19 | private NotificationService notificationService; 20 | 21 | @InjectMocks 22 | private NotificationFacadeImpl notificationFacade; 23 | 24 | @Test 25 | public void get() { 26 | final Long id = RandomUtils.nextLong(1, 100); 27 | final EmailNotification emailNotification = new EmailNotification(); 28 | emailNotification.setId(id); 29 | Mockito.when(notificationService.getNotificationById(id)).thenReturn(emailNotification); 30 | 31 | final NotificationModel notificationModel = notificationFacade.get(id); 32 | Assert.assertEquals(id, notificationModel.getId()); 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /api/api-facade/src/test/java/com/sflpro/notifier/api/internal/facade/test/AbstractFacadeActionRequestUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.internal.facade.test; 2 | 3 | import org.junit.Ignore; 4 | 5 | /** 6 | * User: Alfred Kaghyan 7 | * Company: SFL LLC 8 | * Date: 5/13/2015 9 | * Time: 3:54 PM 10 | */ 11 | @Ignore 12 | public abstract class AbstractFacadeActionRequestUnitTest extends AbstractFacadeUnitTest { 13 | 14 | /* Constructors */ 15 | public AbstractFacadeActionRequestUnitTest() { 16 | } 17 | 18 | /* Utility methods */ 19 | 20 | } 21 | -------------------------------------------------------------------------------- /api/api-model/src/main/java/com/sflpro/notifier/api/model/common/request/ValidatableRequest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.model.common.request; 2 | 3 | 4 | import com.sflpro.notifier.api.model.common.result.ErrorResponseModel; 5 | 6 | import javax.annotation.Nonnull; 7 | import java.util.List; 8 | 9 | /** 10 | * User: Ruben Dilanyan 11 | * Company: SFL LLC 12 | * Date: 7/17/15 13 | * Time: 3:45 PM 14 | */ 15 | @FunctionalInterface 16 | public interface ValidatableRequest { 17 | 18 | /** 19 | * Validates if required fields are provided 20 | * 21 | * @return list of errors 22 | */ 23 | @Nonnull 24 | List validateRequiredFields(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /api/api-model/src/main/java/com/sflpro/notifier/api/model/common/result/ErrorResponseModel.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.model.common.result; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * User: Ruben Dilanyan 9 | * Company: SFL LLC 10 | * Date: 7/17/15 11 | * Time: 3:27 PM 12 | */ 13 | public class ErrorResponseModel implements Serializable { 14 | 15 | private static final long serialVersionUID = -8457328784601461833L; 16 | 17 | /* Properties */ 18 | @JsonProperty("errorType") 19 | private final ErrorType errorType; 20 | 21 | public ErrorResponseModel(final ErrorType errorType) { 22 | this.errorType = errorType; 23 | } 24 | 25 | public ErrorType getErrorType() { 26 | return errorType; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /api/api-model/src/main/java/com/sflpro/notifier/api/model/common/result/ErrorType.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.model.common.result; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 7/17/15 7 | * Time: 3:27 PM 8 | */ 9 | public enum ErrorType { 10 | /* Notifications */ 11 | NOTIFICATION_BODY_MISSING, 12 | NOTIFICATION_USER_MISSING, 13 | NOTIFICATION_EMAIL_RECIPIENT_ADDRESS_MISSING, 14 | NOTIFICATION_EMAIL_SENDER_ADDRESS_MISSING, 15 | NOTIFICATION_SMS_RECIPIENT_MISSING, 16 | SUBSCRIPTION_PUSH_DEVICE_TOKEN_MISSING, 17 | SUBSCRIPTION_PUSH_SUBSCRIBE_VALUE_MISSING, 18 | SUBSCRIPTION_PUSH_DEVICE_UUID_MISSING, 19 | SUBSCRIPTION_PUSH_DEVICE_OPERATING_SYSTEM_TYPE_MISSING, 20 | SUBSCRIPTION_PUSH_USER_UUID_MISSING, 21 | SUBSCRIPTION_PUSH_APPLICATION_MISSING, 22 | NOTIFICATION_PROPERTY_VALUE_SIZE_VIOLATION, 23 | NOTIFICATION_PROPERTY_KEY_SIZE_VIOLATION; 24 | } 25 | -------------------------------------------------------------------------------- /api/api-model/src/main/java/com/sflpro/notifier/api/model/device/DeviceOperatingSystemClientType.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.model.device; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 1/14/16 7 | * Time: 3:56 PM 8 | */ 9 | public enum DeviceOperatingSystemClientType { 10 | 11 | /* Constants */ 12 | IOS, ANDROID; 13 | } 14 | -------------------------------------------------------------------------------- /api/api-model/src/main/java/com/sflpro/notifier/api/model/notification/NotificationClientType.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.model.notification; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 1/29/16 7 | * Time: 2:16 PM 8 | */ 9 | public enum NotificationClientType { 10 | EMAIL, EMAIL_THIRD_PARTY, SMS, PUSH 11 | } 12 | -------------------------------------------------------------------------------- /api/api-model/src/main/java/com/sflpro/notifier/api/model/notification/NotificationSendingPriorityClientType.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.model.notification; 2 | 3 | /** 4 | * User: Ruben Vardanyan 5 | * Company: SFL LLC 6 | * Date: 07/30/2021 7 | * Time: 12:23 8 | */ 9 | public enum NotificationSendingPriorityClientType { 10 | LOW, 11 | MEDIUM, 12 | HIGH 13 | } 14 | -------------------------------------------------------------------------------- /api/api-model/src/main/java/com/sflpro/notifier/api/model/notification/NotificationStateClientType.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.model.notification; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 1/29/16 7 | * Time: 2:13 PM 8 | */ 9 | public enum NotificationStateClientType { 10 | CREATED, PROCESSING, SENT, FAILED 11 | } 12 | -------------------------------------------------------------------------------- /api/api-web/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:11-jre 2 | ARG JAR_FILE 3 | ADD target/${JAR_FILE} /api-web.jar 4 | ENTRYPOINT ["java", "-jar", "/api-web.jar"] -------------------------------------------------------------------------------- /api/api-web/src/main/java/com/sflpro/notifier/api/web/NotifierApiApplication.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.api.web; 2 | 3 | import com.sflpro.notifier.DirectNotificationProcessorConfiguration; 4 | import com.sflpro.notifier.queue.producer.ProducerConfiguration; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.builder.SpringApplicationBuilder; 7 | import org.springframework.context.annotation.ComponentScan; 8 | import org.springframework.context.annotation.Import; 9 | import org.springframework.context.annotation.PropertySource; 10 | 11 | /** 12 | * Company: SFL LLC 13 | * Created on 03/12/2017 14 | * 15 | * @author Davit Harutyunyan 16 | */ 17 | @SpringBootApplication 18 | @PropertySource(value = "classpath:application.properties") 19 | @Import({ProducerConfiguration.class, DirectNotificationProcessorConfiguration.class}) 20 | @ComponentScan(basePackages = "com.sflpro.notifier") 21 | public class NotifierApiApplication { 22 | 23 | 24 | public static void main(String[] args) { 25 | new SpringApplicationBuilder(NotifierApiApplication.class).run(args); 26 | } 27 | } -------------------------------------------------------------------------------- /api/api-web/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /core/core-db-entities/src/main/java/com/sflpro/notifier/db/entities/device/mobile/DeviceOperatingSystemType.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.entities.device.mobile; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 4/3/15 7 | * Time: 2:55 PM 8 | */ 9 | public enum DeviceOperatingSystemType { 10 | IOS, ANDROID 11 | } 12 | -------------------------------------------------------------------------------- /core/core-db-entities/src/main/java/com/sflpro/notifier/db/entities/notification/NotificationProviderType.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.entities.notification; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collections; 5 | import java.util.List; 6 | 7 | /** 8 | * User: Ruben Dilanyan 9 | * Company: SFL LLC 10 | * Date: 3/21/15 11 | * Time: 1:09 PM 12 | */ 13 | public enum NotificationProviderType { 14 | TWILLIO(NotificationType.SMS), MSG_AM(NotificationType.SMS), NIKITA_MOBILE(NotificationType.SMS), WEBHOOK(NotificationType.SMS), 15 | SMTP_SERVER(NotificationType.EMAIL), AMAZON_SNS(NotificationType.PUSH), 16 | GOOGLE_GCM(NotificationType.PUSH), APPLE_APNS(NotificationType.PUSH), MANDRILL(NotificationType.EMAIL), 17 | FIREBASE_CLOUD_MESSAGING(NotificationType.PUSH); 18 | 19 | /* Properties */ 20 | private final List supportedNotificationTypes; 21 | 22 | NotificationProviderType(final NotificationType... notificationTypes) { 23 | this.supportedNotificationTypes = Collections.unmodifiableList(Arrays.asList(notificationTypes)); 24 | } 25 | 26 | /* Properties getters and setters */ 27 | public List getSupportedNotificationTypes() { 28 | return supportedNotificationTypes; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /core/core-db-entities/src/main/java/com/sflpro/notifier/db/entities/notification/NotificationSendingPriority.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.entities.notification; 2 | 3 | /** 4 | * User: Ruben Vardanyan 5 | * Company: SFL LLC 6 | * Date: 07/30/2021 7 | * Time: 11:22 8 | */ 9 | public enum NotificationSendingPriority { 10 | LOW, 11 | MEDIUM, 12 | HIGH 13 | } 14 | -------------------------------------------------------------------------------- /core/core-db-entities/src/main/java/com/sflpro/notifier/db/entities/notification/NotificationState.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.entities.notification; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 4/9/15 7 | * Time: 3:12 PM 8 | */ 9 | public enum NotificationState { 10 | CREATED, PROCESSING, SENT, FAILED 11 | } 12 | -------------------------------------------------------------------------------- /core/core-db-entities/src/main/java/com/sflpro/notifier/db/entities/notification/NotificationType.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.entities.notification; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 3/21/15 7 | * Time: 12:28 PM 8 | */ 9 | public enum NotificationType { 10 | EMAIL, SMS, PUSH 11 | } 12 | -------------------------------------------------------------------------------- /core/core-db-entities/src/main/java/com/sflpro/notifier/db/entities/notification/push/PushNotificationRecipientStatus.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.entities.notification.push; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 8/18/15 7 | * Time: 12:40 PM 8 | */ 9 | public enum PushNotificationRecipientStatus { 10 | ENABLED, DISABLED 11 | } 12 | -------------------------------------------------------------------------------- /core/core-db-entities/src/main/java/com/sflpro/notifier/db/entities/notification/push/PushNotificationSubscriptionRequestState.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.entities.notification.push; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 8/21/15 7 | * Time: 9:06 AM 8 | */ 9 | public enum PushNotificationSubscriptionRequestState { 10 | CREATED, PROCESSING, PROCESSED, FAILED 11 | } 12 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/NotifierPersistenceConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db; 2 | 3 | import org.springframework.boot.autoconfigure.domain.EntityScan; 4 | import org.springframework.context.annotation.ComponentScan; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.context.annotation.PropertySource; 7 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; 8 | import org.springframework.transaction.annotation.EnableTransactionManagement; 9 | 10 | @Configuration 11 | @ComponentScan(basePackages = "com.sflpro.notifier.db") 12 | @EnableTransactionManagement 13 | @EntityScan(basePackages = "com.sflpro.notifier.db.entities") 14 | @EnableJpaRepositories(basePackages = "com.sflpro.notifier.db.repositories") 15 | @PropertySource(value = "classpath:/com/sflpro/notifier/repositories.properties", ignoreResourceNotFound = true) 16 | public class NotifierPersistenceConfiguration { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/repositories/repositories/device/UserDeviceRepository.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.repositories.device; 2 | 3 | import com.sflpro.notifier.db.entities.device.UserDevice; 4 | import com.sflpro.notifier.db.entities.user.User; 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import javax.annotation.Nonnull; 9 | 10 | /** 11 | * User: Ruben Dilanyan 12 | * Company: SFL LLC 13 | * Date: 1/10/16 14 | * Time: 1:52 PM 15 | */ 16 | @Repository 17 | public interface UserDeviceRepository extends JpaRepository { 18 | 19 | /** 20 | * Find user device by user and uuid 21 | * 22 | * @param user 23 | * @param uuId 24 | * @return userDevice 25 | */ 26 | UserDevice findByUserAndUuId(@Nonnull final User user, final String uuId); 27 | } 28 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/repositories/repositories/notification/AbstractNotificationRepository.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.repositories.notification; 2 | 3 | import com.sflpro.notifier.db.entities.notification.Notification; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 3/21/15 10 | * Time: 7:54 PM 11 | */ 12 | public interface AbstractNotificationRepository extends JpaRepository { 13 | } 14 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/repositories/repositories/notification/NotificationRepository.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.repositories.notification; 2 | 3 | import com.sflpro.notifier.db.entities.notification.Notification; 4 | import org.springframework.stereotype.Repository; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 3/21/15 10 | * Time: 7:55 PM 11 | */ 12 | @Repository 13 | public interface NotificationRepository extends AbstractNotificationRepository { 14 | } 15 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/repositories/repositories/notification/UserNotificationRepository.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.repositories.notification; 2 | 3 | import com.sflpro.notifier.db.entities.notification.Notification; 4 | import com.sflpro.notifier.db.entities.notification.UserNotification; 5 | import com.sflpro.notifier.db.entities.user.User; 6 | import org.springframework.data.jpa.repository.JpaRepository; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import javax.annotation.Nonnull; 10 | import java.util.List; 11 | 12 | /** 13 | * User: Ruben Dilanyan 14 | * Company: SFL LLC 15 | * Date: 4/2/15 16 | * Time: 7:01 PM 17 | */ 18 | @Repository 19 | public interface UserNotificationRepository extends JpaRepository { 20 | 21 | /** 22 | * Gets user notification by notification 23 | * 24 | * @param notification 25 | * @return userNotification 26 | */ 27 | UserNotification findByNotification(@Nonnull final Notification notification); 28 | 29 | /** 30 | * Gets user notifications by user 31 | * 32 | * @param user 33 | * @return userNotifications 34 | */ 35 | List findByUser(@Nonnull final User user); 36 | } 37 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/repositories/repositories/notification/email/EmailNotificationFileAttachmentRepository.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.repositories.notification.email; 2 | 3 | import com.sflpro.notifier.db.entities.notification.email.EmailNotificationFileAttachment; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * User: Arthur Hakobyan 9 | * Company: SFL LLC 10 | * Date: 05/29/2020 11 | */ 12 | 13 | @Repository 14 | public interface EmailNotificationFileAttachmentRepository extends JpaRepository { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/repositories/repositories/notification/email/EmailNotificationRepository.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.repositories.notification.email; 2 | 3 | import com.sflpro.notifier.db.entities.notification.email.EmailNotification; 4 | import com.sflpro.notifier.db.repositories.repositories.notification.AbstractNotificationRepository; 5 | import org.springframework.data.jpa.repository.EntityGraph; 6 | import org.springframework.data.jpa.repository.Query; 7 | import org.springframework.data.repository.query.Param; 8 | import org.springframework.stereotype.Repository; 9 | 10 | /** 11 | * User: Ruben Dilanyan 12 | * Company: SFL LLC 13 | * Date: 3/21/15 14 | * Time: 7:56 PM 15 | */ 16 | @Repository 17 | public interface EmailNotificationRepository extends AbstractNotificationRepository { 18 | 19 | @EntityGraph("Notification.ProcessingFlow") 20 | @Query("select n from EmailNotification n where n.id = :id") 21 | EmailNotification findByIdForProcessingFlow(@Param("id") final Long id); 22 | } 23 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/repositories/repositories/notification/push/PushNotificationRecipientDeviceRepository.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.repositories.notification.push; 2 | 3 | import com.sflpro.notifier.db.entities.device.UserDevice; 4 | import com.sflpro.notifier.db.entities.notification.push.PushNotificationRecipient; 5 | import com.sflpro.notifier.db.entities.notification.push.PushNotificationRecipientDevice; 6 | import org.springframework.data.jpa.repository.JpaRepository; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import javax.annotation.Nonnull; 10 | 11 | /** 12 | * User: Ruben Dilanyan 13 | * Company: SFL LLC 14 | * Date: 8/14/15 15 | * Time: 4:00 PM 16 | */ 17 | @Repository 18 | public interface PushNotificationRecipientDeviceRepository extends JpaRepository { 19 | 20 | 21 | /** 22 | * Finds push notification recipient device by recipient and user device 23 | * 24 | * @param recipient 25 | * @param device 26 | * @return 27 | */ 28 | PushNotificationRecipientDevice findByRecipientAndDevice(@Nonnull final PushNotificationRecipient recipient, @Nonnull final UserDevice device); 29 | } 30 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/repositories/repositories/notification/push/PushNotificationRecipientRepository.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.repositories.notification.push; 2 | 3 | import com.sflpro.notifier.db.entities.notification.push.PushNotificationRecipient; 4 | import org.springframework.stereotype.Repository; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 8/13/15 10 | * Time: 1:09 PM 11 | */ 12 | @Repository 13 | public interface PushNotificationRecipientRepository extends AbstractPushNotificationRecipientRepository, PushNotificationRecipientRepositoryCustom { 14 | } 15 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/repositories/repositories/notification/push/PushNotificationRecipientRepositoryCustom.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.repositories.notification.push; 2 | 3 | import com.sflpro.notifier.db.entities.notification.push.PushNotificationRecipient; 4 | 5 | import javax.annotation.Nonnull; 6 | import java.util.List; 7 | 8 | /** 9 | * User: Ruben Dilanyan 10 | * Company: SFL LLC 11 | * Date: 8/13/15 12 | * Time: 1:09 PM 13 | */ 14 | public interface PushNotificationRecipientRepositoryCustom { 15 | 16 | /** 17 | * Gets count of push notification recipients for search parameters 18 | * 19 | * @param parameters 20 | * @return recipientsCount 21 | */ 22 | @Nonnull 23 | Long getPushNotificationRecipientsCount(@Nonnull final PushNotificationRecipientSearchFilter parameters); 24 | 25 | /** 26 | * Loads push notification recipients for search parameters 27 | * 28 | * @param parameters 29 | * @param maxCount 30 | * @return recipients 31 | */ 32 | @Nonnull 33 | List findPushNotificationRecipients(@Nonnull final PushNotificationRecipientSearchFilter parameters, final long startFrom, final int maxCount); 34 | } 35 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/repositories/repositories/notification/push/PushNotificationRepository.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.repositories.notification.push; 2 | 3 | import com.sflpro.notifier.db.entities.notification.push.PushNotification; 4 | import com.sflpro.notifier.db.repositories.repositories.notification.AbstractNotificationRepository; 5 | import org.springframework.data.jpa.repository.EntityGraph; 6 | import org.springframework.data.jpa.repository.Query; 7 | import org.springframework.data.repository.query.Param; 8 | import org.springframework.stereotype.Repository; 9 | 10 | /** 11 | * User: Ruben Dilanyan 12 | * Company: SFL LLC 13 | * Date: 8/14/15 14 | * Time: 11:48 AM 15 | */ 16 | @Repository 17 | public interface PushNotificationRepository extends AbstractNotificationRepository { 18 | 19 | @EntityGraph("PushNotification.ProcessingFlow") 20 | @Query("select p from PushNotification p where p.id = :id") 21 | PushNotification findByIdForProcessingFlow(@Param("id") final Long id); 22 | } 23 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/repositories/repositories/notification/push/PushNotificationSubscriptionRepository.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.repositories.notification.push; 2 | 3 | import com.sflpro.notifier.db.entities.notification.push.PushNotificationSubscription; 4 | import com.sflpro.notifier.db.entities.user.User; 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import javax.annotation.Nonnull; 9 | 10 | /** 11 | * User: Ruben Dilanyan 12 | * Company: SFL LLC 13 | * Date: 8/13/15 14 | * Time: 10:19 AM 15 | */ 16 | @Repository 17 | public interface PushNotificationSubscriptionRepository extends JpaRepository { 18 | 19 | /** 20 | * Finds push notification subscription by user 21 | * 22 | * @param user 23 | * @return pushNotificationSubscription 24 | */ 25 | PushNotificationSubscription findByUser(@Nonnull final User user); 26 | } 27 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/repositories/repositories/notification/push/PushNotificationSubscriptionRequestRepository.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.repositories.notification.push; 2 | 3 | import com.sflpro.notifier.db.entities.notification.push.PushNotificationSubscriptionRequest; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | /** 10 | * User: Ruben Dilanyan 11 | * Company: SFL LLC 12 | * Date: 8/21/15 13 | * Time: 9:17 AM 14 | */ 15 | @Repository 16 | public interface PushNotificationSubscriptionRequestRepository extends JpaRepository { 17 | 18 | 19 | /** 20 | * Finds push notification subscription by uuid 21 | * 22 | * @param uuId 23 | * @return 24 | */ 25 | PushNotificationSubscriptionRequest findByUuId(@Nonnull final String uuId); 26 | } 27 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/repositories/repositories/notification/sms/SmsNotificationRepository.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.repositories.notification.sms; 2 | 3 | import com.sflpro.notifier.db.entities.notification.sms.SmsNotification; 4 | import com.sflpro.notifier.db.repositories.repositories.notification.AbstractNotificationRepository; 5 | import org.springframework.data.jpa.repository.EntityGraph; 6 | import org.springframework.data.jpa.repository.Query; 7 | import org.springframework.data.repository.query.Param; 8 | import org.springframework.stereotype.Repository; 9 | 10 | /** 11 | * User: Ruben Dilanyan 12 | * Company: SFL LLC 13 | * Date: 3/21/15 14 | * Time: 7:55 PM 15 | */ 16 | @Repository 17 | public interface SmsNotificationRepository extends AbstractNotificationRepository { 18 | 19 | @EntityGraph("Notification.ProcessingFlow") 20 | @Query("select n from SmsNotification n where n.id = :id") 21 | SmsNotification findByIdForProcessingFlow(@Param("id") final Long id); 22 | } 23 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/repositories/repositories/user/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.repositories.user; 2 | 3 | import com.sflpro.notifier.db.entities.user.User; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import javax.annotation.Nonnull; 8 | import java.util.Optional; 9 | 10 | /** 11 | * User: Ruben Dilanyan 12 | * Company: SFL LLC 13 | * Date: 10/01/14 14 | * Time: 10:18 PM 15 | */ 16 | @Repository 17 | public interface UserRepository extends JpaRepository { 18 | 19 | /** 20 | * Find user for uuid 21 | * 22 | * @param uuId 23 | * @return user 24 | */ 25 | Optional findByUuId(@Nonnull final String uuId); 26 | } 27 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/repositories/utility/EntityInitializer.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.utility; 2 | 3 | import org.hibernate.Hibernate; 4 | import org.hibernate.proxy.HibernateProxy; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.util.Assert; 8 | 9 | import javax.annotation.Nonnull; 10 | 11 | /** 12 | * Created by Hayk Mkrtchyan. 13 | * Date: 6/19/19 14 | * Time: 2:34 PM 15 | */ 16 | final class EntityInitializer { 17 | 18 | private static final Logger LOGGER = LoggerFactory.getLogger(EntityInitializer.class); 19 | 20 | private EntityInitializer() { 21 | super(); 22 | } 23 | 24 | static T initializeAndUnProxy(@Nonnull final T entity) { 25 | Assert.notNull(entity, "Entity should not be null"); 26 | LOGGER.debug("UnProxying entity - {}", entity); 27 | // UnProxied entity 28 | T unProxiedEntity = entity; 29 | // Initialize 30 | Hibernate.initialize(unProxiedEntity); 31 | if (unProxiedEntity instanceof HibernateProxy) { 32 | unProxiedEntity = (T) ((HibernateProxy) unProxiedEntity).getHibernateLazyInitializer().getImplementation(); 33 | } 34 | return unProxiedEntity; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/java/com/sflpro/notifier/db/repositories/utility/impl/DummyTransactionAwarePersistenceUtilityService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.utility.impl; 2 | 3 | import com.sflpro.notifier.db.repositories.utility.PersistenceUtilityService; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | /** 8 | * User: Ruben Dilanyan 9 | * Company: SFL LLC 10 | * Date: 1/16/15 11 | * Time: 6:15 PM 12 | */ 13 | class DummyTransactionAwarePersistenceUtilityService implements PersistenceUtilityService { 14 | 15 | 16 | 17 | /* Constructors */ 18 | DummyTransactionAwarePersistenceUtilityService() { 19 | super(); 20 | } 21 | 22 | @Override 23 | public void runInNewTransaction(@Nonnull final Runnable runnable) { 24 | runnable.run(); 25 | } 26 | 27 | @Override 28 | public void runAfterTransactionCommitIsSuccessful(@Nonnull final Runnable runnable, @Nonnull final boolean executeAsynchronously) { 29 | runnable.run(); 30 | } 31 | 32 | @Override 33 | public void runInPersistenceSession(@Nonnull final Runnable runnable) { 34 | runnable.run(); 35 | } 36 | 37 | @Override 38 | public void runInTransaction(@Nonnull final Runnable runnable) { 39 | runnable.run(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/com/sflpro/notifier/repositories.properties: -------------------------------------------------------------------------------- 1 | # TODO this should be changed to validate 2 | spring.jpa.hibernate.ddl-auto=none 3 | spring.jpa.hibernate.use-new-id-generator-mappings=false 4 | spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true 5 | 6 | 7 | spring.flyway.locations=classpath:db/migration/{vendor} 8 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/mysql/V1_10__notification_email_file_attachment.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS notification_email_file_attachment ( 2 | id BIGINT not null AUTO_INCREMENT PRIMARY KEY, 3 | file_name VARCHAR(255) NOT NULL, 4 | url VARCHAR(1000) NOT NULL, 5 | mime_type VARCHAR(255), 6 | notification_email_id BIGINT NOT NULL, 7 | CONSTRAINT fk_notification_email_file_attachment_notification_email FOREIGN KEY (notification_email_id) REFERENCES notification_email (id), 8 | created DATETIME NOT NULL, 9 | removed DATETIME, 10 | updated DATETIME NOT NULL 11 | ); -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/mysql/V1_11__Notification_email_reply_to.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS notification_email_reply_to ( 2 | id BIGINT not null AUTO_INCREMENT PRIMARY KEY, 3 | email VARCHAR(255) NOT NULL, 4 | notification_email_id BIGINT NOT NULL, 5 | CONSTRAINT fk_notification_email_reply_to_notification_email FOREIGN KEY (notification_email_id) REFERENCES notification_email (id), 6 | created DATETIME NOT NULL, 7 | removed DATETIME, 8 | updated DATETIME NOT NULL 9 | ); -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/mysql/V1_12__Increase_notification_property_value_size.sql: -------------------------------------------------------------------------------- 1 | alter table notification_property modify column property_value text(65535); 2 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/mysql/V1_13__Notification_sending_priority.sql: -------------------------------------------------------------------------------- 1 | alter table notification 2 | add column sending_priority varchar(50) null; 3 | 4 | update notification 5 | set sending_priority = 'MEDIUM' 6 | where sending_priority is null; 7 | 8 | alter table notification 9 | modify sending_priority varchar(50) not null; -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/mysql/V1_2__Email_templating.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE notification_email_third_party_property 2 | RENAME notification_email_property; 3 | 4 | ALTER TABLE notification_email_property 5 | DROP FOREIGN KEY fk_notif_third_party_property_notif_third_party; 6 | 7 | ALTER TABLE notification_email_property 8 | ADD CONSTRAINT fk_notif_email_property_notif_email 9 | FOREIGN KEY (notification_id) 10 | REFERENCES notification_email (id) 11 | ON DELETE CASCADE; 12 | 13 | DROP TABLE notification_email_third_party; 14 | 15 | UPDATE notification 16 | SET type = 'EMAIL' 17 | WHERE type = 'EMAIL_THIRD_PARTY'; -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/mysql/V1_3__Secure_properties.sql: -------------------------------------------------------------------------------- 1 | 2 | alter table notification add column has_secure_properties bit(1) not null default false; 3 | 4 | update notification 5 | set has_secure_properties = false 6 | where has_secure_properties is null; -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/mysql/V1_4__Sms_templating.sql: -------------------------------------------------------------------------------- 1 | alter table notification_sms add column template_name varchar(255); -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/mysql/V1_5__Notification_Properties.sql: -------------------------------------------------------------------------------- 1 | create table if not exists notification_property ( 2 | id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 | notification_id bigint not null, 4 | property_key varchar(255) not null, 5 | property_value varchar(255) not null, 6 | created datetime not null, 7 | removed datetime, 8 | updated datetime not null, 9 | CONSTRAINT fk_notification_property_notification FOREIGN KEY (notification_id) REFERENCES notification (id) 10 | ); 11 | 12 | ALTER TABLE notification_email_property 13 | DROP FOREIGN KEY fk_notif_email_property_notif_email; 14 | 15 | DROP TABLE notification_email_property; 16 | 17 | ALTER TABLE notification_push_property 18 | DROP FOREIGN KEY fk_notification_push_property_notification_push; 19 | 20 | DROP TABLE notification_push_property; 21 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/mysql/V1_6__Push_Notification_FCM_Support.sql: -------------------------------------------------------------------------------- 1 | alter table notification_push_recipient add column platform_application_arn varchar(255); 2 | update notification_push_recipient rc 3 | inner join notification_push_recipient_sns rc_sns on rc_sns.id = rc.id 4 | set rc.platform_application_arn = rc_sns.platform_application_arn; 5 | alter table notification change column provider_external_uuid provider_external_uuid varchar(320); 6 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/mysql/V1_7__Email_Per_Notification_Localization_Support.sql: -------------------------------------------------------------------------------- 1 | alter table notification_email add column locale char(5) default null; -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/mysql/V1_8__Sms_Per_Notification_Localization_Support.sql: -------------------------------------------------------------------------------- 1 | alter table notification_sms add column locale char(5) default null; -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/mysql/V1_9__Push_notification_template_support.sql: -------------------------------------------------------------------------------- 1 | alter table notification_push 2 | add column template_name varchar(255) default null; 3 | 4 | alter table notification_push 5 | add column locale varchar(5) default null; 6 | 7 | alter table notification_email MODIFY column locale varchar(5); 8 | 9 | alter table notification_sms MODIFY column locale varchar(5); -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/postgresql/V1_10__notification_email_file_attachment.sql: -------------------------------------------------------------------------------- 1 | create table if not exists notification_email_file_attachment ( 2 | id bigint not null constraint pk_notification_email_file_attachment primary key, 3 | file_name varchar(255) not null, 4 | url varchar (1000) not null, 5 | mime_type varchar(255), 6 | notification_email_id bigint constraint fk_notification_email_file_attachment_notification_email references notification_email, 7 | created timestamp not null, 8 | removed timestamp, 9 | updated timestamp not null 10 | ); -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/postgresql/V1_11__Notification_email_reply_to.sql: -------------------------------------------------------------------------------- 1 | create table if not exists notification_email_reply_to ( 2 | id bigint not null constraint pk_notification_email_reply_to primary key, 3 | email varchar(255) not null, 4 | notification_email_id bigint constraint fk_notification_email_reply_to_notification_email references notification_email, 5 | created timestamp not null, 6 | removed timestamp, 7 | updated timestamp not null 8 | ); 9 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/postgresql/V1_12__Increase_notification_property_value_size.sql: -------------------------------------------------------------------------------- 1 | alter table notification_property alter column property_value type varchar(65535) using property_value::varchar(65535); -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/postgresql/V1_13__DB_performance_optimizations.sql: -------------------------------------------------------------------------------- 1 | CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_notification_property_notification_id 2 | ON notification_property USING btree 3 | (notification_id); 4 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/postgresql/V1_14__Notification_sending_priority.sql: -------------------------------------------------------------------------------- 1 | alter table notification 2 | add column sending_priority varchar(50) null; 3 | 4 | update notification 5 | set sending_priority = 'MEDIUM' 6 | where sending_priority is null; 7 | 8 | alter table notification 9 | alter column sending_priority set not null; -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/postgresql/V1_2__Email_templating.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE notification_email_third_party_property 2 | RENAME TO notification_email_property; 3 | 4 | ALTER TABLE notification_email_property 5 | DROP CONSTRAINT fk_notif_third_party_property_notif_third_party; 6 | 7 | ALTER TABLE notification_email_property 8 | ADD CONSTRAINT fk_notif_email_property_notif_email 9 | FOREIGN KEY (notification_id) 10 | REFERENCES notification_email (id) 11 | ON DELETE CASCADE; 12 | 13 | DROP TABLE notification_email_third_party; 14 | 15 | UPDATE notification 16 | SET type = 'EMAIL' 17 | WHERE type = 'EMAIL_THIRD_PARTY'; -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/postgresql/V1_3__Secure_properties.sql: -------------------------------------------------------------------------------- 1 | 2 | alter table notification add column if not exists has_secure_properties boolean not null default false; 3 | 4 | update notification 5 | set has_secure_properties = false 6 | where has_secure_properties is null; -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/postgresql/V1_4__Sms_templating.sql: -------------------------------------------------------------------------------- 1 | alter table notification_sms add column if not exists template_name varchar(255); -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/postgresql/V1_5__Notification_Properties.sql: -------------------------------------------------------------------------------- 1 | create table if not exists notification_property ( 2 | id bigint not null constraint pk_notification_property primary key, 3 | notification_id bigint not null constraint fk_notification_property_notification references notification, 4 | property_key varchar(255) not null, 5 | property_value varchar(255) not null, 6 | created timestamp not null, 7 | removed timestamp, 8 | updated timestamp not null 9 | ); 10 | 11 | 12 | ALTER TABLE notification_email_property 13 | DROP CONSTRAINT fk_notif_email_property_notif_email; 14 | 15 | DROP TABLE notification_email_property; 16 | 17 | ALTER TABLE notification_push_property 18 | DROP CONSTRAINT fk_notification_push_property_notification_push; 19 | 20 | DROP TABLE notification_push_property; -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/postgresql/V1_6__Push_Notification_FCM_Support.sql: -------------------------------------------------------------------------------- 1 | alter table notification_push_recipient add column platform_application_arn varchar(255); 2 | update notification_push_recipient rc set platform_application_arn = rc_sns.platform_application_arn 3 | from notification_push_recipient_sns rc_sns where rc_sns.id=rc.id; 4 | alter table notification alter column provider_external_uuid type varchar(320); -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/postgresql/V1_7__Email_Per_Notification_Localization_Support.sql: -------------------------------------------------------------------------------- 1 | alter table notification_email add column locale char(5) default null; -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/postgresql/V1_8__Sms_Per_Notification_Localization_Support.sql: -------------------------------------------------------------------------------- 1 | alter table notification_sms add column locale char(5) default null; -------------------------------------------------------------------------------- /core/core-db-repositories/src/main/resources/db/migration/postgresql/V1_9__Push_notification_template_support.sql: -------------------------------------------------------------------------------- 1 | alter table notification_push 2 | add column template_name varchar(255) default null; 3 | 4 | alter table notification_push 5 | add column locale varchar(5) default null; 6 | 7 | alter table notification_email 8 | alter column locale type varchar(5) using locale::varchar(5); 9 | 10 | alter table notification_sms 11 | alter column locale type varchar(5) using locale::varchar(5); -------------------------------------------------------------------------------- /core/core-db-repositories/src/test/java/com/sflpro/notifier/db/repositories/repositories/notification/push/NotificationRepositoryIntegrationTest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.db.repositories.repositories.notification.push; 2 | 3 | import com.sflpro.notifier.db.repositories.repositories.notification.NotificationRepository; 4 | import com.sflpro.notifier.test.AbstractRepositoryTest; 5 | import org.junit.Test; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | 8 | /** 9 | * Company: SFL LLC 10 | * Created on 1/22/18 11 | * 12 | * @author Yervand Aghababyan 13 | */ 14 | public class NotificationRepositoryIntegrationTest extends AbstractRepositoryTest { 15 | /* Dependencies */ 16 | @Autowired 17 | private NotificationRepository notificationRepository; 18 | 19 | @Test 20 | public void testRepositoryConstruction() { 21 | notificationRepository.count(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/test/java/com/sflpro/notifier/springboot/NotifierRepositoryTestApplication.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.springboot; 2 | 3 | import com.sflpro.notifier.db.NotifierPersistenceConfiguration; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.Import; 6 | import org.springframework.test.context.ActiveProfiles; 7 | 8 | /** 9 | * Company: SFL LLC 10 | * Created on 1/22/18 11 | * 12 | * @author Yervand Aghababyan 13 | */ 14 | @ActiveProfiles("test") 15 | @SpringBootApplication 16 | @Import(NotifierPersistenceConfiguration.class) 17 | public class NotifierRepositoryTestApplication { 18 | } 19 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/test/java/com/sflpro/notifier/test/AbstractRepositoryTest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.test; 2 | 3 | import com.sflpro.notifier.springboot.NotifierRepositoryTestApplication; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | import javax.persistence.EntityManager; 9 | import javax.persistence.PersistenceContext; 10 | 11 | /** 12 | * User: Ruben Dilanyan 13 | * Company: SFL LLC 14 | * Date: 10/01/14 15 | * Time: 10:18 PM 16 | */ 17 | @RunWith(SpringRunner.class) 18 | @SpringBootTest(classes = NotifierRepositoryTestApplication.class) 19 | public abstract class AbstractRepositoryTest { 20 | 21 | /* Dependencies */ 22 | @PersistenceContext 23 | private EntityManager em; 24 | 25 | /* Constructors */ 26 | public AbstractRepositoryTest() { 27 | } 28 | 29 | /* Utility methods */ 30 | protected void flush() { 31 | em.flush(); 32 | } 33 | 34 | protected void clear() { 35 | em.clear(); 36 | } 37 | 38 | protected void flushAndClear() { 39 | em.flush(); 40 | em.clear(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/test/resources/applicationContext-persistence-integrationtest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /core/core-db-repositories/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /core/core-services-impl/src/main/java/com/sflpro/notifier/services/NotifierServicesConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services; 2 | 3 | import com.sflpro.notifier.db.NotifierPersistenceConfiguration; 4 | import com.sflpro.notifier.services.system.concurrency.ExecutorBuilder; 5 | import org.springframework.context.annotation.*; 6 | import org.springframework.security.crypto.factory.PasswordEncoderFactories; 7 | import org.springframework.security.crypto.password.PasswordEncoder; 8 | 9 | import java.util.concurrent.ExecutorService; 10 | 11 | @Configuration 12 | @ComponentScan(basePackages = "com.sflpro.notifier.services") 13 | @PropertySource(value = "classpath:/com/sflpro/notifier/services.properties", ignoreResourceNotFound = true) 14 | @Import({NotifierPersistenceConfiguration.class}) 15 | public class NotifierServicesConfiguration { 16 | 17 | @Bean 18 | public PasswordEncoder passwordEncoder() { 19 | return PasswordEncoderFactories.createDelegatingPasswordEncoder(); 20 | } 21 | 22 | @Bean(destroyMethod = "shutdown") 23 | public ExecutorService executorService(final ExecutorBuilder executorBuilder) { 24 | return executorBuilder.createExecutorService(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /core/core-services-impl/src/main/java/com/sflpro/notifier/services/notification/impl/email/EmailSenderProvider.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.impl.email; 2 | 3 | 4 | import com.sflpro.notifier.spi.email.SimpleEmailSender; 5 | import com.sflpro.notifier.spi.email.TemplatedEmailSender; 6 | 7 | import java.util.Optional; 8 | 9 | /** 10 | * Created by Hayk Mkrtchyan. 11 | * Date: 6/19/19 12 | * Time: 10:24 AM 13 | */ 14 | interface EmailSenderProvider { 15 | 16 | Optional lookupSimpleEmailSenderFor(final String providerType); 17 | 18 | Optional lookupTemplatedEmailSenderFor(final String providerType); 19 | } 20 | -------------------------------------------------------------------------------- /core/core-services-impl/src/main/java/com/sflpro/notifier/services/notification/impl/push/ArnConfigurationService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.impl.push; 2 | 3 | import com.sflpro.notifier.db.entities.device.mobile.DeviceOperatingSystemType; 4 | 5 | /** 6 | * User: Ruben Dilanyan 7 | * Company: SFL LLC 8 | * Date: 1/11/16 9 | * Time: 5:10 PM 10 | */ 11 | public interface ArnConfigurationService { 12 | 13 | /** 14 | * Retrieves SNS ARN for provided mobile application 15 | * 16 | * @param operatingSystemType 17 | * @param applicationType 18 | * @return applicationArn 19 | */ 20 | String getApplicationArnForMobilePlatform(final DeviceOperatingSystemType operatingSystemType, final String applicationType); 21 | } 22 | -------------------------------------------------------------------------------- /core/core-services-impl/src/main/java/com/sflpro/notifier/services/notification/impl/push/PushMessageServiceProvider.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.impl.push; 2 | 3 | import com.sflpro.notifier.db.entities.notification.push.PushNotificationProviderType; 4 | import com.sflpro.notifier.spi.push.PushMessageSender; 5 | import com.sflpro.notifier.spi.push.PushMessageSubscriber; 6 | 7 | import java.util.Optional; 8 | 9 | /** 10 | * Created by Hayk Mkrtchyan. 11 | * Date: 7/3/19 12 | * Time: 12:03 PM 13 | */ 14 | public interface PushMessageServiceProvider { 15 | 16 | Optional lookupPushMessageSender(final PushNotificationProviderType providerType); 17 | 18 | Optional lookupPushMessageSubscriber(final PushNotificationProviderType providerType); 19 | } 20 | -------------------------------------------------------------------------------- /core/core-services-impl/src/main/java/com/sflpro/notifier/services/notification/impl/push/PushNotificationConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.impl.push; 2 | 3 | import com.sflpro.notifier.spi.push.PushMessageServiceRegistry; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.ComponentScan; 8 | import org.springframework.context.annotation.Configuration; 9 | import org.springframework.util.CollectionUtils; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by Hayk Mkrtchyan. 15 | * Date: 7/3/19 16 | * Time: 5:52 PM 17 | */ 18 | @Configuration 19 | @ComponentScan("com.sflpro.notifier.externalclients.push.registry") 20 | class PushNotificationConfiguration { 21 | 22 | private static final Logger logger = LoggerFactory.getLogger(PushNotificationConfiguration.class); 23 | 24 | @Bean 25 | PushMessageServiceProvider pushMessageServiceProvider(final List registries) { 26 | if (CollectionUtils.isEmpty(registries)) { 27 | logger.info("No push notification service was registered for sending(subscribing) push notifications."); 28 | } 29 | return new DefaultPushMessageServiceProvider(registries); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/core-services-impl/src/main/java/com/sflpro/notifier/services/notification/impl/push/PushNotificationProviderProcessor.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.impl.push; 2 | 3 | import com.sflpro.notifier.db.entities.notification.push.PushNotification; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | /** 8 | * User: Ruben Dilanyan 9 | * Company: SFL LLC 10 | * Date: 8/17/15 11 | * Time: 3:36 PM 12 | */ 13 | public interface PushNotificationProviderProcessor { 14 | 15 | /** 16 | * Processes push notification specific implementation 17 | * 18 | * @param pushNotification 19 | * @return providerExternalUuId 20 | * 21 | */ 22 | String processPushNotification(@Nonnull final PushNotification pushNotification); 23 | } 24 | -------------------------------------------------------------------------------- /core/core-services-impl/src/main/java/com/sflpro/notifier/services/notification/impl/sms/SmsSenderProvider.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.impl.sms; 2 | 3 | 4 | import com.sflpro.notifier.spi.sms.SimpleSmsSender; 5 | import com.sflpro.notifier.spi.sms.TemplatedSmsSender; 6 | 7 | import java.util.Optional; 8 | 9 | /** 10 | * Created by Hayk Mkrtchyan. 11 | * Date: 6/18/19 12 | * Time: 4:17 PM 13 | */ 14 | interface SmsSenderProvider { 15 | 16 | Optional lookupSimpleSmsMessageSenderFor(final String providerType); 17 | 18 | Optional lookupTemplatedSmsMessageSenderFor(final String providerType); 19 | } 20 | -------------------------------------------------------------------------------- /core/core-services-impl/src/main/java/com/sflpro/notifier/services/system/concurrency/impl/ExecutorBuilderImpl.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.system.concurrency.impl; 2 | 3 | import com.sflpro.notifier.services.system.concurrency.ExecutorBuilder; 4 | import org.springframework.stereotype.Service; 5 | 6 | import java.util.concurrent.ExecutorService; 7 | import java.util.concurrent.Executors; 8 | import java.util.concurrent.ThreadPoolExecutor; 9 | 10 | /** 11 | * User: Davit Yeghiazaryan 12 | * Company: SFL LLC 13 | * Date 7/20/16 14 | * Time 6:02 PM 15 | */ 16 | @Service("executorBuilder") 17 | public class ExecutorBuilderImpl implements ExecutorBuilder { 18 | /* Constants */ 19 | private static final int MAX_THREAD_POOL_SIZE = 20; 20 | 21 | private static final int CORE_THREAD_POOL_SIZE = 10; 22 | 23 | /* Constructors */ 24 | public ExecutorBuilderImpl() { 25 | // Default constructor 26 | } 27 | 28 | @Override 29 | public ExecutorService createExecutorService() { 30 | final ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) Executors.newFixedThreadPool(MAX_THREAD_POOL_SIZE); 31 | threadPoolExecutor.setCorePoolSize(CORE_THREAD_POOL_SIZE); 32 | threadPoolExecutor.setMaximumPoolSize(MAX_THREAD_POOL_SIZE); 33 | return threadPoolExecutor; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /core/core-services-impl/src/main/java/com/sflpro/notifier/services/template/TemplatingConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.template; 2 | 3 | import freemarker.template.Configuration; 4 | 5 | public interface TemplatingConfiguration { 6 | 7 | Configuration getFreemarkerConfiguration(final boolean localizedLookupEnabled); 8 | 9 | default Configuration getFreemarkerConfiguration() { 10 | return getFreemarkerConfiguration(true); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /core/core-services-impl/src/main/resources/com/sflpro/notifier/services.properties: -------------------------------------------------------------------------------- 1 | #Arn 2 | notification.push.application.arn.customer.ios=customer_ios_arn 3 | notification.push.application.arn.operator.ios=operator_ios_arn 4 | notification.push.application.arn.customer.android=customer_android_arn 5 | notification.push.application.arn.operator.android=customer_ios_arn 6 | 7 | # Freemarker 8 | notifier.templates.path= 9 | 10 | flyway.locations=classpath:db/migration/{vendor} -------------------------------------------------------------------------------- /core/core-services-impl/src/test/java/com/sflpro/notifier/services/notification/NotificationServiceIntegrationTest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification; 2 | 3 | import com.sflpro.notifier.db.entities.notification.Notification; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 3/21/15 10 | * Time: 8:37 PM 11 | */ 12 | public class NotificationServiceIntegrationTest extends AbstractNotificationServiceIntegrationTest { 13 | 14 | /* Dependencies */ 15 | @Autowired 16 | private NotificationService notificationService; 17 | 18 | /* Constructors */ 19 | public NotificationServiceIntegrationTest() { 20 | } 21 | 22 | /* Utility methods */ 23 | @Override 24 | protected AbstractNotificationService getService() { 25 | return notificationService; 26 | } 27 | 28 | @Override 29 | protected Notification getInstance() { 30 | return getServicesTestHelper().createSmsNotification(); 31 | } 32 | 33 | @Override 34 | protected Class getInstanceClass() { 35 | return Notification.class; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/core-services-impl/src/test/java/com/sflpro/notifier/services/test/AbstractServicesUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.test; 2 | 3 | import com.sflpro.notifier.services.helper.ServicesImplTestHelper; 4 | import org.easymock.EasyMockRunner; 5 | import org.easymock.EasyMockSupport; 6 | import org.junit.Ignore; 7 | import org.junit.runner.RunWith; 8 | 9 | import java.util.UUID; 10 | 11 | /** 12 | * User: Ruben Dilanyan 13 | * Company: SFL LLC 14 | * Date: 10/01/14 15 | * Time: 10:18 PM 16 | */ 17 | @RunWith(EasyMockRunner.class) 18 | @Ignore 19 | public abstract class AbstractServicesUnitTest extends EasyMockSupport { 20 | 21 | /* Properties */ 22 | private final ServicesImplTestHelper servicesImplTestHelper; 23 | 24 | public AbstractServicesUnitTest() { 25 | servicesImplTestHelper = new ServicesImplTestHelper(); 26 | } 27 | 28 | /* Utility methods */ 29 | protected boolean isWindowsOS() { 30 | return System.getProperty("os.name").contains("win"); 31 | } 32 | 33 | /* Getters and setters */ 34 | protected ServicesImplTestHelper getServicesImplTestHelper() { 35 | return servicesImplTestHelper; 36 | } 37 | 38 | public static String uuid(){ 39 | return UUID.randomUUID().toString(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /core/core-services-impl/src/test/resources/resources/testfile.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sflpro/notifier/0b62c9c7c070ed0cefbf4646de79728c82f863ee/core/core-services-impl/src/test/resources/resources/testfile.txt -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/common/exception/ServicesRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.common.exception; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 11/17/14 7 | * Time: 12:09 PM 8 | */ 9 | public class ServicesRuntimeException extends RuntimeException { 10 | 11 | private static final long serialVersionUID = -8710986180320271380L; 12 | 13 | public ServicesRuntimeException(final Throwable cause) { 14 | super(cause); 15 | } 16 | 17 | public ServicesRuntimeException(final String message) { 18 | super(message); 19 | } 20 | 21 | public ServicesRuntimeException(final String message, final Throwable cause) { 22 | super(message, cause); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/device/exception/UserDeviceNotFoundForIdException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.device.exception; 2 | 3 | import com.sflpro.notifier.db.entities.device.UserDevice; 4 | import com.sflpro.notifier.services.common.exception.EntityNotFoundForIdException; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 1/10/16 10 | * Time: 1:56 PM 11 | */ 12 | public class UserDeviceNotFoundForIdException extends EntityNotFoundForIdException { 13 | 14 | /* Constructors */ 15 | public UserDeviceNotFoundForIdException(final Long id) { 16 | super(id, UserDevice.class); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/device/exception/UserDeviceNotFoundForUuIdException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.device.exception; 2 | 3 | import com.sflpro.notifier.services.common.exception.ServicesRuntimeException; 4 | 5 | /** 6 | * User: Ruben Dilanyan 7 | * Company: SFL LLC 8 | * Date: 1/10/16 9 | * Time: 3:06 PM 10 | */ 11 | public class UserDeviceNotFoundForUuIdException extends ServicesRuntimeException { 12 | 13 | private static final long serialVersionUID = 550146903255509982L; 14 | 15 | /* Properties */ 16 | private final Long userId; 17 | 18 | private final String uuId; 19 | 20 | /* Constructors */ 21 | public UserDeviceNotFoundForUuIdException(final Long userId, final String uuId) { 22 | super("No user device was found for user with id - " + userId + " and device uuid - " + uuId); 23 | this.userId = userId; 24 | this.uuId = uuId; 25 | } 26 | 27 | /* Properties getters and setters */ 28 | public Long getUserId() { 29 | return userId; 30 | } 31 | 32 | public String getUuId() { 33 | return uuId; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/AbstractNotificationService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification; 2 | 3 | 4 | import com.sflpro.notifier.db.entities.notification.Notification; 5 | import com.sflpro.notifier.db.entities.notification.NotificationState; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | /** 10 | * User: Ruben Dilanyan 11 | * Company: SFL LLC 12 | * Date: 3/21/15 13 | * Time: 7:52 PM 14 | */ 15 | public interface AbstractNotificationService { 16 | 17 | 18 | /** 19 | * Returns notification by id 20 | * 21 | * @param notificationId 22 | * @return notification 23 | */ 24 | @Nonnull 25 | T getNotificationById(@Nonnull final Long notificationId); 26 | 27 | /** 28 | * Update notification state 29 | * 30 | * @param notificationId 31 | * @param notificationState 32 | * @return notification 33 | */ 34 | @Nonnull 35 | T updateNotificationState(@Nonnull final Long notificationId, @Nonnull NotificationState notificationState); 36 | 37 | /** 38 | * Update provider external uuid 39 | * 40 | * @param notificationId 41 | * @param providerExternalUuid 42 | * @return notification 43 | */ 44 | @Nonnull 45 | T updateProviderExternalUuid(@Nonnull final Long notificationId, @Nonnull final String providerExternalUuid); 46 | } 47 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/NotificationProcessingService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification; 2 | 3 | import javax.annotation.Nonnull; 4 | import java.util.Map; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 8/24/15 10 | * Time: 1:07 PM 11 | */ 12 | public interface NotificationProcessingService { 13 | 14 | /** 15 | * Process notification 16 | * 17 | * @param notificationId 18 | */ 19 | void processNotification(@Nonnull final Long notificationId, @Nonnull final Map secureProperties); 20 | } 21 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/NotificationProcessor.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification; 2 | 3 | import javax.annotation.Nonnull; 4 | import java.util.Map; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 8/24/15 10 | * Time: 1:00 PM 11 | */ 12 | public interface NotificationProcessor { 13 | 14 | /** 15 | * Process notification 16 | * 17 | * @param notificationId 18 | */ 19 | void processNotification(@Nonnull final Long notificationId, @Nonnull final Map secureProperties); 20 | } 21 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/NotificationService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification; 2 | 3 | 4 | import com.sflpro.notifier.db.entities.notification.Notification; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 3/21/15 10 | * Time: 7:52 PM 11 | */ 12 | public interface NotificationService extends AbstractNotificationService { 13 | } 14 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/dto/UserNotificationDto.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.dto; 2 | 3 | 4 | import com.sflpro.notifier.db.entities.notification.UserNotification; 5 | import com.sflpro.notifier.services.common.dto.AbstractDomainEntityModelDto; 6 | import org.springframework.util.Assert; 7 | 8 | /** 9 | * User: Ruben Dilanyan 10 | * Company: SFL LLC 11 | * Date: 3/21/15 12 | * Time: 7:36 PM 13 | */ 14 | public class UserNotificationDto extends AbstractDomainEntityModelDto { 15 | private static final long serialVersionUID = -6480459757050740097L; 16 | 17 | /* Properties */ 18 | 19 | /* Constructors */ 20 | public UserNotificationDto() { 21 | super(); 22 | } 23 | 24 | /* Properties getters and setters */ 25 | 26 | /* Public interface methods */ 27 | @Override 28 | public void updateDomainEntityProperties(final UserNotification userNotification) { 29 | Assert.notNull(userNotification, "User notification should not be null"); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/email/EmailNotificationProcessor.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.email; 2 | 3 | import com.sflpro.notifier.services.notification.NotificationProcessor; 4 | 5 | /** 6 | * User: Ruben Dilanyan 7 | * Company: SFL LLC 8 | * Date: 1/11/16 9 | * Time: 11:08 AM 10 | */ 11 | public interface EmailNotificationProcessor extends NotificationProcessor { 12 | } 13 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/email/EmailNotificationService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.email; 2 | 3 | import com.sflpro.notifier.db.entities.notification.email.EmailNotification; 4 | import com.sflpro.notifier.services.notification.AbstractNotificationService; 5 | import com.sflpro.notifier.services.notification.dto.email.EmailNotificationDto; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | /** 10 | * User: Ruben Dilanyan 11 | * Company: SFL LLC 12 | * Date: 3/21/15 13 | * Time: 7:53 PM 14 | */ 15 | public interface EmailNotificationService extends AbstractNotificationService { 16 | 17 | /** 18 | * Creates new email notification 19 | * 20 | * @param emailNotificationDto 21 | * @return emailNotification 22 | */ 23 | @Nonnull 24 | EmailNotification createEmailNotification(@Nonnull final EmailNotificationDto emailNotificationDto); 25 | 26 | /** 27 | * Returns the notification to be processed 28 | * 29 | * @param notificationId 30 | * @return notification 31 | */ 32 | EmailNotification getEmailNotificationForProcessing(final Long notificationId); 33 | } 34 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/event/sms/StartSendingNotificationEventListenerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.event.sms; 2 | 3 | import com.sflpro.notifier.services.system.event.model.ApplicationEvent; 4 | import com.sflpro.notifier.services.system.event.model.ApplicationEventListener; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | /** 9 | * User: Mher Sargsyan 10 | * Company: SFL LLC 11 | * Date: 4/10/15 12 | * Time: 4:28 PM 13 | */ 14 | public abstract class StartSendingNotificationEventListenerAdapter implements ApplicationEventListener { 15 | 16 | /* Constructors */ 17 | public StartSendingNotificationEventListenerAdapter() { 18 | } 19 | 20 | 21 | @Override 22 | public boolean subscribed(@Nonnull final ApplicationEvent applicationEvent) { 23 | return (applicationEvent instanceof StartSendingNotificationEvent); 24 | } 25 | 26 | @Override 27 | public void process(@Nonnull final ApplicationEvent applicationEvent) { 28 | final StartSendingNotificationEvent event = (StartSendingNotificationEvent) applicationEvent; 29 | processStartSendingNotificationEvent(event); 30 | } 31 | 32 | /* Abstract methods */ 33 | protected abstract void processStartSendingNotificationEvent(final StartSendingNotificationEvent event); 34 | } 35 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/exception/NotificationNotFoundForIdException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.exception; 2 | 3 | import com.sflpro.notifier.db.entities.AbstractDomainEntityModel; 4 | import com.sflpro.notifier.services.common.exception.EntityNotFoundForIdException; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 3/21/15 10 | * Time: 7:45 PM 11 | */ 12 | public class NotificationNotFoundForIdException extends EntityNotFoundForIdException { 13 | private static final long serialVersionUID = -2029389887734858316L; 14 | 15 | /* Constructors */ 16 | public NotificationNotFoundForIdException(final Long id, final Class notificationClass) { 17 | super(id, notificationClass); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/exception/NotificationNotFoundForUuIdException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.exception; 2 | 3 | import com.sflpro.notifier.db.entities.AbstractDomainEntityModel; 4 | import com.sflpro.notifier.services.common.exception.EntityNotFoundForUuIdException; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 3/21/15 10 | * Time: 7:45 PM 11 | */ 12 | public class NotificationNotFoundForUuIdException extends EntityNotFoundForUuIdException { 13 | private static final long serialVersionUID = -2029389887734858316L; 14 | 15 | /* Constructors */ 16 | public NotificationNotFoundForUuIdException(final String uuId, final Class notificationClass) { 17 | super(uuId, notificationClass); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/exception/UnsupportedNotificationTypeException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.exception; 2 | 3 | import com.sflpro.notifier.db.entities.notification.NotificationType; 4 | import com.sflpro.notifier.services.common.exception.ServicesRuntimeException; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 8/24/15 10 | * Time: 1:20 PM 11 | */ 12 | public class UnsupportedNotificationTypeException extends ServicesRuntimeException { 13 | 14 | private static final long serialVersionUID = 6841511059561290537L; 15 | 16 | /* Properties */ 17 | private final NotificationType type; 18 | 19 | /* Constructors */ 20 | public UnsupportedNotificationTypeException(final NotificationType type) { 21 | super("Unsupported notification type - " + type); 22 | this.type = type; 23 | } 24 | 25 | /* Properties getters and setters */ 26 | public NotificationType getType() { 27 | return type; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/exception/UserNotificationAlreadyExistsException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.exception; 2 | 3 | import com.sflpro.notifier.services.common.exception.ServicesRuntimeException; 4 | 5 | /** 6 | * User: Ruben Dilanyan 7 | * Company: SFL LLC 8 | * Date: 4/3/15 9 | * Time: 12:19 PM 10 | */ 11 | public class UserNotificationAlreadyExistsException extends ServicesRuntimeException { 12 | 13 | private static final long serialVersionUID = -6976873959871893213L; 14 | 15 | /* Properties */ 16 | private final Long userNotificationId; 17 | 18 | private final Long notificationId; 19 | 20 | public UserNotificationAlreadyExistsException(final Long userNotificationId, final Long notificationId) { 21 | super("User notification already exists for notification with id - " + notificationId + ". User notification id - " + userNotificationId); 22 | this.userNotificationId = userNotificationId; 23 | this.notificationId = notificationId; 24 | } 25 | 26 | /* Properties getters and setters */ 27 | public Long getUserNotificationId() { 28 | return userNotificationId; 29 | } 30 | 31 | public Long getNotificationId() { 32 | return notificationId; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/exception/UserNotificationNotFoundForIdException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.exception; 2 | 3 | import com.sflpro.notifier.db.entities.notification.UserNotification; 4 | import com.sflpro.notifier.services.common.exception.EntityNotFoundForIdException; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 4/3/15 10 | * Time: 12:37 PM 11 | */ 12 | public class UserNotificationNotFoundForIdException extends EntityNotFoundForIdException { 13 | private static final long serialVersionUID = 4459047450797572972L; 14 | 15 | /* Constructors */ 16 | public UserNotificationNotFoundForIdException(final Long id) { 17 | super(id, UserNotification.class); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/exception/push/PushNotificationRecipientNotFoundForIdException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.exception.push; 2 | 3 | import com.sflpro.notifier.db.entities.notification.push.PushNotificationRecipient; 4 | import com.sflpro.notifier.services.common.exception.EntityNotFoundForIdException; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 8/13/15 10 | * Time: 1:43 PM 11 | */ 12 | public class PushNotificationRecipientNotFoundForIdException extends EntityNotFoundForIdException { 13 | 14 | private static final long serialVersionUID = 2957810414639971590L; 15 | 16 | /* Constructors */ 17 | public PushNotificationRecipientNotFoundForIdException(final Long id, final Class recipientClass) { 18 | super(id, recipientClass); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/exception/push/PushNotificationSubscriptionAlreadyExistsForUserException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.exception.push; 2 | 3 | import com.sflpro.notifier.services.common.exception.ServicesRuntimeException; 4 | 5 | /** 6 | * User: Ruben Dilanyan 7 | * Company: SFL LLC 8 | * Date: 8/13/15 9 | * Time: 10:45 AM 10 | */ 11 | public class PushNotificationSubscriptionAlreadyExistsForUserException extends ServicesRuntimeException { 12 | 13 | private static final long serialVersionUID = 6331583001630717942L; 14 | 15 | /* Properties */ 16 | private final Long userId; 17 | 18 | private final Long existingSubscriptionId; 19 | 20 | public PushNotificationSubscriptionAlreadyExistsForUserException(final Long userId, final Long existingSubscriptionId) { 21 | super("User with id - " + userId + " already have subscription with id - " + existingSubscriptionId); 22 | this.userId = userId; 23 | this.existingSubscriptionId = existingSubscriptionId; 24 | } 25 | 26 | /* Properties getters and setters */ 27 | public Long getUserId() { 28 | return userId; 29 | } 30 | 31 | public Long getExistingSubscriptionId() { 32 | return existingSubscriptionId; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/exception/push/PushNotificationSubscriptionNotFoundForIdException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.exception.push; 2 | 3 | import com.sflpro.notifier.db.entities.notification.push.PushNotificationSubscription; 4 | import com.sflpro.notifier.services.common.exception.EntityNotFoundForIdException; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 8/13/15 10 | * Time: 10:45 AM 11 | */ 12 | public class PushNotificationSubscriptionNotFoundForIdException extends EntityNotFoundForIdException { 13 | 14 | private static final long serialVersionUID = 6331583001630717942L; 15 | 16 | public PushNotificationSubscriptionNotFoundForIdException(final Long subscriptionId) { 17 | super(subscriptionId, PushNotificationSubscription.class); 18 | } 19 | } 20 | 21 | 22 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/exception/push/PushNotificationSubscriptionNotFoundForUserException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.exception.push; 2 | 3 | import com.sflpro.notifier.services.common.exception.ServicesRuntimeException; 4 | 5 | /** 6 | * User: Ruben Dilanyan 7 | * Company: SFL LLC 8 | * Date: 8/13/15 9 | * Time: 10:45 AM 10 | */ 11 | public class PushNotificationSubscriptionNotFoundForUserException extends ServicesRuntimeException { 12 | 13 | private static final long serialVersionUID = 6331583001630717942L; 14 | 15 | /* Properties */ 16 | private final Long userId; 17 | 18 | public PushNotificationSubscriptionNotFoundForUserException(final Long userId) { 19 | super("No push notification subscription is found for user with id - " + userId); 20 | this.userId = userId; 21 | } 22 | 23 | /* Properties getters and setters */ 24 | public Long getUserId() { 25 | return userId; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/exception/push/PushNotificationSubscriptionRequestNotFoundForIdException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.exception.push; 2 | 3 | import com.sflpro.notifier.db.entities.notification.push.PushNotificationSubscriptionRequest; 4 | import com.sflpro.notifier.services.common.exception.EntityNotFoundForIdException; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 8/21/15 10 | * Time: 9:15 AM 11 | */ 12 | public class PushNotificationSubscriptionRequestNotFoundForIdException extends EntityNotFoundForIdException { 13 | 14 | private static final long serialVersionUID = -8914689959749037244L; 15 | 16 | /* Constructors */ 17 | public PushNotificationSubscriptionRequestNotFoundForIdException(final Long id) { 18 | super(id, PushNotificationSubscriptionRequest.class); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/exception/push/PushNotificationSubscriptionRequestNotFoundForUuIdException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.exception.push; 2 | 3 | import com.sflpro.notifier.db.entities.notification.push.PushNotificationSubscriptionRequest; 4 | import com.sflpro.notifier.services.common.exception.EntityNotFoundForUuIdException; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 8/21/15 10 | * Time: 9:15 AM 11 | */ 12 | public class PushNotificationSubscriptionRequestNotFoundForUuIdException extends EntityNotFoundForUuIdException { 13 | 14 | private static final long serialVersionUID = -8914689959749037244L; 15 | 16 | /* Constructors */ 17 | public PushNotificationSubscriptionRequestNotFoundForUuIdException(final String uuId) { 18 | super(uuId, PushNotificationSubscriptionRequest.class); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/push/PushNotificationProcessor.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.push; 2 | 3 | import com.sflpro.notifier.services.notification.NotificationProcessor; 4 | 5 | /** 6 | * User: Ruben Dilanyan 7 | * Company: SFL LLC 8 | * Date: 8/17/15 9 | * Time: 2:51 PM 10 | */ 11 | public interface PushNotificationProcessor extends NotificationProcessor { 12 | } 13 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/push/PushNotificationSubscriptionProcessingService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.push; 2 | 3 | import com.sflpro.notifier.db.entities.notification.push.PushNotificationRecipient; 4 | import com.sflpro.notifier.services.notification.dto.push.PushNotificationSubscriptionProcessingParameters; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | /** 9 | * User: Ruben Dilanyan 10 | * Company: SFL LLC 11 | * Date: 8/20/15 12 | * Time: 11:01 AM 13 | */ 14 | public interface PushNotificationSubscriptionProcessingService { 15 | 16 | /** 17 | * Processes push notification subscription 18 | * 19 | * @param parameters 20 | * @return pushNotificationRecipient 21 | * 22 | */ 23 | PushNotificationRecipient processPushNotificationSubscriptionChange(@Nonnull final PushNotificationSubscriptionProcessingParameters parameters); 24 | } 25 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/push/PushNotificationSubscriptionRequestProcessingService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.push; 2 | 3 | import com.sflpro.notifier.db.entities.notification.push.PushNotificationRecipient; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | /** 8 | * User: Ruben Dilanyan 9 | * Company: SFL LLC 10 | * Date: 8/21/15 11 | * Time: 11:08 AM 12 | */ 13 | public interface PushNotificationSubscriptionRequestProcessingService { 14 | 15 | /** 16 | * Process push notification subscription request 17 | * 18 | * @param requestId 19 | * @return pushNotificationRecipient 20 | */ 21 | @Nonnull 22 | PushNotificationRecipient processPushNotificationSubscriptionRequest(@Nonnull final Long requestId); 23 | } 24 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/sms/SmsNotificationProcessor.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.sms; 2 | 3 | import com.sflpro.notifier.services.notification.NotificationProcessor; 4 | 5 | /** 6 | * User: Mher Sargsyan 7 | * Company: SFL LLC 8 | * Date: 4/10/15 9 | * Time: 12:49 PM 10 | */ 11 | public interface SmsNotificationProcessor extends NotificationProcessor { 12 | } 13 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/notification/sms/SmsNotificationService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.sms; 2 | 3 | import com.sflpro.notifier.db.entities.notification.sms.SmsNotification; 4 | import com.sflpro.notifier.services.notification.AbstractNotificationService; 5 | import com.sflpro.notifier.services.notification.dto.sms.SmsNotificationDto; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | /** 10 | * User: Ruben Dilanyan 11 | * Company: SFL LLC 12 | * Date: 3/21/15 13 | * Time: 7:52 PM 14 | */ 15 | public interface SmsNotificationService extends AbstractNotificationService { 16 | 17 | /** 18 | * Creates new SMS notification 19 | * 20 | * @param smsNotificationDto 21 | * @return smsNotification 22 | */ 23 | @Nonnull 24 | SmsNotification createSmsNotification(@Nonnull final SmsNotificationDto smsNotificationDto); 25 | 26 | /** 27 | * Returns the notification to be processed 28 | * 29 | * @param notificationId 30 | * @return notification 31 | */ 32 | SmsNotification getSmsNotificationForProcessing(final Long notificationId); 33 | } 34 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/system/concurrency/ExecutorBuilder.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.system.concurrency; 2 | 3 | import javax.annotation.Nonnull; 4 | import java.util.concurrent.ExecutorService; 5 | 6 | /** 7 | * User: Davit Yeghiazaryan 8 | * Company: SFL LLC 9 | * Date 7/20/16 10 | * Time 6:10 PM 11 | */ 12 | @FunctionalInterface 13 | public interface ExecutorBuilder { 14 | 15 | /** 16 | * Creates executor service 17 | * 18 | * @return Executor service 19 | */ 20 | @Nonnull 21 | ExecutorService createExecutorService(); 22 | } 23 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/system/concurrency/ScheduledTaskExecutorService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.system.concurrency; 2 | 3 | import javax.annotation.Nonnull; 4 | import java.util.concurrent.TimeUnit; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 7/16/15 10 | * Time: 12:24 PM 11 | */ 12 | public interface ScheduledTaskExecutorService { 13 | 14 | /** 15 | * Execute task after provided delay 16 | * 17 | * @param runnable 18 | * @param delay 19 | * @param timeUnit 20 | * @param runInPersistenceContext 21 | * 22 | */ 23 | void scheduleTaskForExecution(@Nonnull final Runnable runnable, @Nonnull final int delay, @Nonnull final TimeUnit timeUnit, @Nonnull final boolean runInPersistenceContext); 24 | } 25 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/system/environment/model/EnvironmentType.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.system.environment.model; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 12/23/14 7 | * Time: 9:53 AM 8 | */ 9 | public enum EnvironmentType { 10 | PRODUCTION, STAGING, ACCEPTANCE, TEST 11 | } 12 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/system/event/ApplicationEventDistributionService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.system.event; 2 | 3 | import com.sflpro.notifier.services.system.event.model.ApplicationEvent; 4 | import com.sflpro.notifier.services.system.event.model.ApplicationEventListener; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | /** 9 | * User: Ruben Dilanyan 10 | * Company: SFL LLC 11 | * Date: 12/13/14 12 | * Time: 10:03 PM 13 | */ 14 | public interface ApplicationEventDistributionService { 15 | 16 | /** 17 | * Subscribes listener for particular event 18 | * 19 | * @param eventListener 20 | */ 21 | void subscribe(@Nonnull final ApplicationEventListener eventListener); 22 | 23 | /** 24 | * Publishes event using asynchronous publishing 25 | * 26 | * @param applicationEvent 27 | */ 28 | void publishAsynchronousEvent(@Nonnull final ApplicationEvent applicationEvent); 29 | 30 | /** 31 | * Publishes event using synchronous publishing 32 | * 33 | * @param applicationEvent 34 | */ 35 | void publishSynchronousEvent(@Nonnull final ApplicationEvent applicationEvent); 36 | } 37 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/system/event/model/ApplicationEvent.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.system.event.model; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 12/13/14 7 | * Time: 10:05 PM 8 | */ 9 | public interface ApplicationEvent { 10 | } 11 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/system/event/model/ApplicationEventListener.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.system.event.model; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | /** 6 | * User: Ruben Dilanyan 7 | * Company: SFL LLC 8 | * Date: 12/13/14 9 | * Time: 10:06 PM 10 | */ 11 | public interface ApplicationEventListener { 12 | 13 | /** 14 | * Returns if event listener is interested in the event 15 | * 16 | * @param applicationEvent 17 | * @return subscribed 18 | */ 19 | boolean subscribed(@Nonnull final ApplicationEvent applicationEvent); 20 | 21 | /** 22 | * Processes provided event 23 | * 24 | * @param applicationEvent 25 | */ 26 | void process(@Nonnull final ApplicationEvent applicationEvent); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/template/TemplatingService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.template; 2 | 3 | import javax.annotation.Nonnull; 4 | import java.util.Locale; 5 | import java.util.Map; 6 | 7 | /** 8 | * User: Ruben Vardanyan 9 | * Company: SFL LLC 10 | * Date: 4/17/19 11 | * Time: 9:32 PM 12 | */ 13 | public interface TemplatingService { 14 | 15 | /** 16 | * Generates content according to the given template name with the given parameters 17 | * 18 | * @param templateName templateName 19 | * @param parameters parameters 20 | * @return Generated content 21 | */ 22 | String getContentForTemplate(@Nonnull final String templateName, @Nonnull final Map parameters); 23 | 24 | /** 25 | * Generates content according to the given template name with the given parameters 26 | * 27 | * @param templateName templateName 28 | * @param parameters parameters 29 | * @param locale 30 | * @return Generated content 31 | */ 32 | String getContentForTemplate(@Nonnull final String templateName, @Nonnull final Map parameters, final Locale locale); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/user/exception/UserAlreadyExistsForUuIdException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.user.exception; 2 | 3 | import com.sflpro.notifier.services.common.exception.ServicesRuntimeException; 4 | 5 | /** 6 | * User: Ruben Dilanyan 7 | * Company: SFL LLC 8 | * Date: 1/9/16 9 | * Time: 7:19 PM 10 | */ 11 | public class UserAlreadyExistsForUuIdException extends ServicesRuntimeException { 12 | 13 | /* Properties */ 14 | private final String uuId; 15 | 16 | private final Long userId; 17 | 18 | /* Constructors */ 19 | public UserAlreadyExistsForUuIdException(final String uuId, final Long existingUserId) { 20 | super("User with id - " + existingUserId + " already has uuid - " + uuId); 21 | this.uuId = uuId; 22 | this.userId = existingUserId; 23 | } 24 | 25 | /* Properties getters and setters */ 26 | public String getUuId() { 27 | return uuId; 28 | } 29 | 30 | public Long getExistingUserId() { 31 | return userId; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/user/exception/UserNotFoundForIdException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.user.exception; 2 | 3 | import com.sflpro.notifier.db.entities.user.User; 4 | import com.sflpro.notifier.services.common.exception.EntityNotFoundForIdException; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 11/19/14 10 | * Time: 10:09 AM 11 | */ 12 | public class UserNotFoundForIdException extends EntityNotFoundForIdException { 13 | private static final long serialVersionUID = 947713076446052984L; 14 | 15 | public UserNotFoundForIdException(final Long id) { 16 | super(id, User.class); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /core/core-services/src/main/java/com/sflpro/notifier/services/user/exception/UserNotFoundForUuidException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.user.exception; 2 | 3 | import com.sflpro.notifier.db.entities.user.User; 4 | import com.sflpro.notifier.services.common.exception.EntityNotFoundForUuIdException; 5 | 6 | /** 7 | * User: Ruben Dilanyan 8 | * Company: SFL LLC 9 | * Date: 1/17/15 10 | * Time: 2:53 PM 11 | */ 12 | public class UserNotFoundForUuidException extends EntityNotFoundForUuIdException { 13 | 14 | private static final long serialVersionUID = -2552415605596284708L; 15 | 16 | /* Constructors */ 17 | public UserNotFoundForUuidException(final String uuId) { 18 | super(uuId, User.class); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/core-test-toolkit/src/main/java/com/sflpro/notifier/services/notification/impl/DummyPushMessageSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.impl; 2 | 3 | import com.sflpro.notifier.spi.push.PushMessage; 4 | import com.sflpro.notifier.spi.push.PushMessageSender; 5 | import com.sflpro.notifier.spi.push.PushMessageSendingResult; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | /** 10 | * Created by Hayk Mkrtchyan. 11 | * Date: 7/3/19 12 | * Time: 6:00 PM 13 | */ 14 | public class DummyPushMessageSender implements PushMessageSender { 15 | 16 | private static final Logger logger = LoggerFactory.getLogger(DummyPushMessageSender.class); 17 | 18 | @Override 19 | public PushMessageSendingResult send(final PushMessage message) { 20 | logger.debug("Simulating simple push notification sending for {}", message); 21 | return PushMessageSendingResult.of(message.destinationRouteToken()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /core/core-test-toolkit/src/main/java/com/sflpro/notifier/services/notification/impl/DummySimpleEmailSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.impl; 2 | 3 | 4 | import com.sflpro.notifier.spi.email.SimpleEmailMessage; 5 | import com.sflpro.notifier.spi.email.SimpleEmailSender; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | /** 10 | * Created by Hayk Mkrtchyan. 11 | * Date: 6/19/19 12 | * Time: 12:36 PM 13 | */ 14 | public class DummySimpleEmailSender implements SimpleEmailSender { 15 | 16 | private static final Logger logger = LoggerFactory.getLogger(DummySimpleEmailSender.class); 17 | 18 | @Override 19 | public void send(final SimpleEmailMessage message) { 20 | logger.debug("Simulating simple email sending for {}", message); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/core-test-toolkit/src/main/java/com/sflpro/notifier/services/notification/impl/DummySimpleSmsSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.impl; 2 | 3 | 4 | import com.sflpro.notifier.spi.sms.SimpleSmsMessage; 5 | import com.sflpro.notifier.spi.sms.SimpleSmsSender; 6 | import com.sflpro.notifier.spi.sms.SmsMessageSendingResult; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | 10 | /** 11 | * Created by Hayk Mkrtchyan. 12 | * Date: 6/19/19 13 | * Time: 12:36 PM 14 | */ 15 | public class DummySimpleSmsSender implements SimpleSmsSender { 16 | 17 | private static final Logger logger = LoggerFactory.getLogger(DummySimpleSmsSender.class); 18 | 19 | @Override 20 | public SmsMessageSendingResult send(final SimpleSmsMessage simpleSmsMessage) { 21 | logger.debug("Simulating sms sending for {}", simpleSmsMessage); 22 | return SmsMessageSendingResult.of(simpleSmsMessage.recipientNumber()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /core/core-test-toolkit/src/main/java/com/sflpro/notifier/services/notification/impl/DummyTemplatedEmailSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.impl; 2 | 3 | 4 | import com.sflpro.notifier.spi.email.TemplatedEmailMessage; 5 | import com.sflpro.notifier.spi.email.TemplatedEmailSender; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | /** 10 | * Created by Hayk Mkrtchyan. 11 | * Date: 6/19/19 12 | * Time: 12:36 PM 13 | */ 14 | public class DummyTemplatedEmailSender implements TemplatedEmailSender { 15 | 16 | private static final Logger logger = LoggerFactory.getLogger(DummyTemplatedEmailSender.class); 17 | 18 | @Override 19 | public void send(final TemplatedEmailMessage message) { 20 | logger.debug("Simulating templayed email sending for {}", message); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/core-test-toolkit/src/main/java/com/sflpro/notifier/services/notification/impl/DummyTemplatedSmsSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.services.notification.impl; 2 | 3 | import com.sflpro.notifier.spi.sms.SmsMessageSendingResult; 4 | import com.sflpro.notifier.spi.sms.TemplatedSmsMessage; 5 | import com.sflpro.notifier.spi.sms.TemplatedSmsSender; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | /** 10 | * Created by Hayk Mkrtchyan. 11 | * Date: 6/19/19 12 | * Time: 12:36 PM 13 | */ 14 | public class DummyTemplatedSmsSender implements TemplatedSmsSender { 15 | 16 | private static final Logger logger = LoggerFactory.getLogger(DummyTemplatedSmsSender.class); 17 | 18 | @Override 19 | public SmsMessageSendingResult send(final TemplatedSmsMessage simpleSmsMessage) { 20 | logger.debug("Simulating sms sending for {}", simpleSmsMessage); 21 | return SmsMessageSendingResult.of(simpleSmsMessage.recipientNumber()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /core/core-test-toolkit/src/main/resources/com/sflpro/notifier/test/applicationContext-mocks-integrationtest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 10 | -------------------------------------------------------------------------------- /core/core-test-toolkit/src/main/resources/com/sflpro/notifier/test/services-integration-test.properties: -------------------------------------------------------------------------------- 1 | # Email settings 2 | email.from=fakeemail@qlim.com 3 | email.to=fakeemail@qlim.com 4 | email.replay.to = fakeemail@qlim.com 5 | 6 | email.admin.address = fakeemail@qlim.com 7 | email.support.address=fakeemail@qlim.com 8 | 9 | smtp.host=smtp2.fakesmtp.com 10 | smtp.port=00 11 | smtp.timeout = 10 12 | 13 | ## Sms 14 | sms.sender=Test sender 15 | 16 | # Amazon SNS configuration 17 | amazon.account.sns.region=EU_CENTRAL_1 18 | notification.push.application.arn.customer.ios=customer_ios_arn 19 | notification.push.application.arn.operator.ios=operator_ios_arn 20 | notification.push.application.arn.customer.android=customer_android_arn 21 | notification.push.application.arn.operator.android=customer_ios_arn 22 | 23 | # Freemarker 24 | freemarker.templatesPath=classpath:/templates 25 | -------------------------------------------------------------------------------- /core/core-test-toolkit/src/main/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.sflpro.notifier 5 | notifier 6 | 1.10.2 7 | 8 | 9 | core 10 | 1.10.2 11 | 12 | pom 13 | 14 | 15 | Core contains all the general business logic and required components. 16 | 17 | 18 | 19 | 20 | org.sonatype.plugins 21 | nexus-staging-maven-plugin 22 | 23 | true 24 | 25 | 26 | 27 | 28 | 29 | 30 | core-db-entities 31 | core-db-repositories 32 | core-services 33 | core-services-impl 34 | core-test-toolkit 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-common/src/main/java/com/sflpro/notifier/externalclients/common/http/exception/ExternalClientRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.common.http.exception; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 3/15/15 7 | * Time: 12:12 PM 8 | */ 9 | public class ExternalClientRuntimeException extends RuntimeException { 10 | private static final long serialVersionUID = -4285381500428801260L; 11 | 12 | /* Constructors */ 13 | public ExternalClientRuntimeException(final Throwable throwable) { 14 | super(throwable); 15 | } 16 | 17 | public ExternalClientRuntimeException(final String message) { 18 | super(message); 19 | } 20 | 21 | public ExternalClientRuntimeException(final String message, final Throwable throwable) { 22 | super(message, throwable); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-common/src/main/java/com/sflpro/notifier/externalclients/common/http/rest/RestClient.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.common.http.rest; 2 | 3 | import org.springframework.web.client.RestOperations; 4 | 5 | /** 6 | * User: Mher Sargsyan 7 | * Company: SFL LLC 8 | * Date: 12/25/14 9 | * Time: 2:47 PM 10 | */ 11 | public interface RestClient extends RestOperations { 12 | } 13 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/main/java/com/sflpro/notifier/externalclients/email/common/exception/ExternalEmailNotificationClientRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.email.common.exception; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 4/9/15 7 | * Time: 7:42 PM 8 | */ 9 | public abstract class ExternalEmailNotificationClientRuntimeException extends RuntimeException { 10 | 11 | private static final long serialVersionUID = 4525851652146053826L; 12 | 13 | /* Constructors */ 14 | public ExternalEmailNotificationClientRuntimeException(final String exceptionMessage, final Exception originalException) { 15 | super(exceptionMessage, originalException); 16 | } 17 | 18 | public ExternalEmailNotificationClientRuntimeException(final String exceptionMessage) { 19 | super(exceptionMessage); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/main/java/com/sflpro/notifier/externalclients/email/mandrill/MandrillSimpleEmailSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.email.mandrill; 2 | 3 | import com.sflpro.notifier.externalclients.email.mandrill.communicator.MandrillApiCommunicator; 4 | import com.sflpro.notifier.spi.email.SimpleEmailMessage; 5 | import com.sflpro.notifier.spi.email.SimpleEmailSender; 6 | import org.springframework.util.Assert; 7 | 8 | /** 9 | * Created by Hayk Mkrtchyan. 10 | * Date: 7/1/19 11 | * Time: 11:54 AM 12 | */ 13 | class MandrillSimpleEmailSender implements SimpleEmailSender { 14 | 15 | private final MandrillApiCommunicator mandrillApiCommunicator; 16 | 17 | MandrillSimpleEmailSender(final MandrillApiCommunicator mandrillApiCommunicator) { 18 | this.mandrillApiCommunicator = mandrillApiCommunicator; 19 | } 20 | 21 | @Override 22 | public void send(final SimpleEmailMessage message) { 23 | Assert.notNull(message,"Null was passed as an argument for parameter 'message'."); 24 | mandrillApiCommunicator.sendEmail(message); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/main/java/com/sflpro/notifier/externalclients/email/mandrill/MandrillTemplatedEmailSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.email.mandrill; 2 | 3 | 4 | import com.sflpro.notifier.externalclients.email.mandrill.communicator.MandrillApiCommunicator; 5 | import com.sflpro.notifier.spi.email.TemplatedEmailMessage; 6 | import com.sflpro.notifier.spi.email.TemplatedEmailSender; 7 | import org.springframework.util.Assert; 8 | 9 | /** 10 | * Created by Hayk Mkrtchyan. 11 | * Date: 6/19/19 12 | * Time: 11:27 AM 13 | */ 14 | class MandrillTemplatedEmailSender implements TemplatedEmailSender { 15 | 16 | private final MandrillApiCommunicator mandrillApiCommunicator; 17 | 18 | MandrillTemplatedEmailSender(final MandrillApiCommunicator mandrillApiCommunicator) { 19 | this.mandrillApiCommunicator = mandrillApiCommunicator; 20 | } 21 | 22 | @Override 23 | public void send(final TemplatedEmailMessage message) { 24 | Assert.notNull(message,"Null was passed as an argument for parameter 'message'."); 25 | mandrillApiCommunicator.sendEmailTemplate(message); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/main/java/com/sflpro/notifier/externalclients/email/mandrill/communicator/MandrillApiCommunicator.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.email.mandrill.communicator; 2 | 3 | 4 | import com.sflpro.notifier.spi.email.SimpleEmailMessage; 5 | import com.sflpro.notifier.spi.email.TemplatedEmailMessage; 6 | 7 | /** 8 | * Company: SFL LLC 9 | * Created on 04/12/2017 10 | * 11 | * @author Davit Harutyunyan 12 | */ 13 | public interface MandrillApiCommunicator { 14 | 15 | /** 16 | * Send templated email 17 | * 18 | * @param message 19 | */ 20 | void sendEmailTemplate(final TemplatedEmailMessage message); 21 | 22 | 23 | /** 24 | * Send simple email 25 | * 26 | * @param message 27 | */ 28 | void sendEmail(final SimpleEmailMessage message); 29 | } 30 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/main/java/com/sflpro/notifier/externalclients/email/mandrill/exception/MandrillApiDisabledException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.email.mandrill.exception; 2 | 3 | /** 4 | * Company: SFL LLC 5 | * Created on 08/12/2017 6 | * 7 | * @author Davit Harutyunyan 8 | */ 9 | public class MandrillApiDisabledException extends MandrillEmailClientRuntimeException { 10 | 11 | public MandrillApiDisabledException() { 12 | super("Mandrill Api disabled, please provide api token"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/main/java/com/sflpro/notifier/externalclients/email/mandrill/exception/MandrillEmailClientRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.email.mandrill.exception; 2 | 3 | import com.sflpro.notifier.externalclients.email.common.exception.ExternalEmailNotificationClientRuntimeException; 4 | 5 | /** 6 | * Company: SFL LLC 7 | * Created on 04/12/2017 8 | * 9 | * @author Davit Harutyunyan 10 | */ 11 | public class MandrillEmailClientRuntimeException extends ExternalEmailNotificationClientRuntimeException { 12 | 13 | private static final long serialVersionUID = 3157858197834455252L; 14 | 15 | /* Constructors */ 16 | public MandrillEmailClientRuntimeException(final String message) { 17 | super(message); 18 | } 19 | 20 | public MandrillEmailClientRuntimeException(final String message, final Exception originalException) { 21 | super(message, originalException); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/main/java/com/sflpro/notifier/externalclients/email/mandrill/exception/MandrillMessageInvalidException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.email.mandrill.exception; 2 | 3 | import com.microtripit.mandrillapp.lutung.view.MandrillMessageStatus; 4 | 5 | /** 6 | * Company: SFL LLC 7 | * Created on 07/12/2017 8 | * 9 | * @author Davit Harutyunyan 10 | */ 11 | public class MandrillMessageInvalidException extends MandrillEmailClientRuntimeException { 12 | 13 | private static final long serialVersionUID = 6499081323669417175L; 14 | private final transient MandrillMessageStatus mandrillMessageStatus; 15 | 16 | public MandrillMessageInvalidException(MandrillMessageStatus mandrillMessageStatus) { 17 | super("Email considered invalid"); 18 | this.mandrillMessageStatus = mandrillMessageStatus; 19 | } 20 | 21 | public MandrillMessageStatus getMandrillMessageStatus() { 22 | return mandrillMessageStatus; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/main/java/com/sflpro/notifier/externalclients/email/mandrill/exception/MandrillMessageRejectedException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.email.mandrill.exception; 2 | 3 | import com.microtripit.mandrillapp.lutung.view.MandrillMessageStatus; 4 | 5 | /** 6 | * Company: SFL LLC 7 | * Created on 07/12/2017 8 | * 9 | * @author Davit Harutyunyan 10 | */ 11 | public class MandrillMessageRejectedException extends MandrillEmailClientRuntimeException { 12 | 13 | private static final long serialVersionUID = -8375948228824433272L; 14 | private final transient MandrillMessageStatus mandrillMessageStatus; 15 | 16 | public MandrillMessageRejectedException(MandrillMessageStatus mandrillMessageStatus) { 17 | super("Email rejected"); 18 | this.mandrillMessageStatus = mandrillMessageStatus; 19 | } 20 | 21 | public MandrillMessageStatus getMandrillMessageStatus() { 22 | return mandrillMessageStatus; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/main/java/com/sflpro/notifier/externalclients/email/registry/EmailSenderRegistryConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.email.registry; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.PropertySource; 6 | 7 | /** 8 | * Created by Hayk Mkrtchyan. 9 | * Date: 6/18/19 10 | * Time: 7:49 PM 11 | */ 12 | @Configuration 13 | @PropertySource("classpath:integrations-email.properties") 14 | @ComponentScan(basePackages = { 15 | "com.sflpro.notifier.externalclients.email.mandrill", 16 | "com.sflpro.notifier.externalclients.email.smtp", 17 | "com.sflpro.notifier.externalclients.email.provider.autoconfiguration" 18 | }) 19 | public class EmailSenderRegistryConfiguration { 20 | } 21 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/main/java/com/sflpro/notifier/externalclients/email/smtp/SmtpSimpleEmailSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.email.smtp; 2 | 3 | 4 | import com.sflpro.notifier.spi.email.SimpleEmailMessage; 5 | import com.sflpro.notifier.spi.email.SimpleEmailSender; 6 | 7 | /** 8 | * Created by Hayk Mkrtchyan. 9 | * Date: 6/19/19 10 | * Time: 11:08 AM 11 | */ 12 | class SmtpSimpleEmailSender implements SimpleEmailSender { 13 | 14 | private final com.sflpro.notifier.externalclients.email.smtp.SmtpTransportService smtpTransportService; 15 | 16 | SmtpSimpleEmailSender(final com.sflpro.notifier.externalclients.email.smtp.SmtpTransportService smtpTransportService) { 17 | this.smtpTransportService = smtpTransportService; 18 | } 19 | 20 | @Override 21 | public void send(final SimpleEmailMessage message) { 22 | smtpTransportService.sendMessageOverSmtp( 23 | message.from(), 24 | message.to(), 25 | message.replyTo(), 26 | message.subject(), 27 | message.body(), 28 | message.fileAttachments() 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/main/java/com/sflpro/notifier/externalclients/email/smtp/SmtpTransportException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.email.smtp; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 11/4/14 7 | * Time: 4:16 PM 8 | */ 9 | class SmtpTransportException extends RuntimeException { 10 | private static final long serialVersionUID = -8536487738405812588L; 11 | 12 | /* Properties */ 13 | private final String smtpHost; 14 | 15 | private final String smtpUsername; 16 | 17 | SmtpTransportException(final String smtpHost, final String smtpUsername, final Throwable cause) { 18 | super("Unable to send message over smtp for host - " + smtpHost + " with username - " + smtpUsername, cause); 19 | this.smtpHost = smtpHost; 20 | this.smtpUsername = smtpUsername; 21 | } 22 | 23 | /* Getters and setters */ 24 | public String getSmtpHost() { 25 | return smtpHost; 26 | } 27 | 28 | public String getSmtpUsername() { 29 | return smtpUsername; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/main/java/com/sflpro/notifier/externalclients/email/smtp/SmtpTransportService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.email.smtp; 2 | 3 | import com.sflpro.notifier.spi.email.SpiEmailNotificationFileAttachment; 4 | 5 | import java.util.Set; 6 | 7 | /** 8 | * User: Ruben Dilanyan 9 | * Company: SFL LLC 10 | * Date: 1/11/16 11 | * Time: 10:55 AM 12 | */ 13 | 14 | interface SmtpTransportService { 15 | 16 | 17 | /** 18 | * Perform email over SMTP 19 | * 20 | * @param from 21 | * @param to 22 | * @param replyTo 23 | * @param subject 24 | * @param body 25 | * @param fileAttachments 26 | */ 27 | void sendMessageOverSmtp( 28 | final String from, 29 | final String to, 30 | final Set replyTo, 31 | final String subject, 32 | final String body, 33 | final Set fileAttachments); 34 | } 35 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/main/resources/integrations-email.properties: -------------------------------------------------------------------------------- 1 | #SMTP 2 | #smtp.host=smtp.dummy.com 3 | #smtp.port=25 4 | #smtp.timeout=100000 5 | #smtp.username= 6 | #smtp.password= 7 | 8 | #mandrill.service.token -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/test/java/com/sflpro/notifier/externalclients/email/mock/DummyTemplateContentResolver.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.email.mock; 2 | 3 | import com.sflpro.notifier.spi.template.TemplateContent; 4 | import com.sflpro.notifier.spi.template.TemplateContentResolver; 5 | 6 | import java.util.Locale; 7 | import java.util.Map; 8 | import java.util.stream.Collectors; 9 | 10 | import static java.lang.String.format; 11 | 12 | /** 13 | * Created by Hayk Mkrtchyan. 14 | * Date: 7/12/19 15 | * Time: 6:48 PM 16 | */ 17 | class DummyTemplateContentResolver implements TemplateContentResolver { 18 | 19 | @Override 20 | public TemplateContent resolve(final String templateId, final Map variables) { 21 | return TemplateContent.of("Hey!", format("%s - %s", templateId, variables.entrySet().stream().map(entry -> entry.getKey() + " is " + entry.getValue()).collect(Collectors.joining("\n")))); 22 | } 23 | 24 | @Override 25 | public TemplateContent resolve(String templateId, Map variables, Locale locale) { 26 | return TemplateContent.of("Hey!", format("%s - %s - %s", templateId, locale, variables.entrySet().stream().map(entry -> entry.getKey() + " is " + entry.getValue()).collect(Collectors.joining("\n")))); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/test/java/com/sflpro/notifier/externalclients/email/test/AbstractEmailNotificationIntegrationTest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.email.test; 2 | 3 | import org.junit.Ignore; 4 | import org.springframework.test.context.ContextConfiguration; 5 | import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; 6 | 7 | /** 8 | * Company: SFL LLC 9 | * Created on 07/12/2017 10 | * 11 | * @author Davit Harutyunyan 12 | */ 13 | @Ignore 14 | @ContextConfiguration(value = {"classpath:applicationContext-externalclients-email-integrationtest.xml"}) 15 | public class AbstractEmailNotificationIntegrationTest extends AbstractJUnit4SpringContextTests { 16 | 17 | /* Dependencies */ 18 | 19 | /* Constructors */ 20 | public AbstractEmailNotificationIntegrationTest() { 21 | } 22 | 23 | /* Utility methods */ 24 | } 25 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/test/java/com/sflpro/notifier/externalclients/email/test/AbstractEmailNotificationUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.email.test; 2 | 3 | import org.junit.Ignore; 4 | import org.junit.runner.RunWith; 5 | import org.mockito.junit.MockitoJUnitRunner; 6 | 7 | import java.util.UUID; 8 | 9 | /** 10 | * Company: SFL LLC 11 | * Created on 07/12/2017 12 | * 13 | * @author Davit Harutyunyan 14 | */ 15 | @Ignore 16 | @RunWith(MockitoJUnitRunner.class) 17 | public abstract class AbstractEmailNotificationUnitTest { 18 | 19 | 20 | public static String uuid(){ 21 | return UUID.randomUUID().toString(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-email/src/test/resources/applicationContext-externalclients-email-integrationtest.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-push/src/main/java/com/sflpro/notifier/externalclients/push/amazon/exception/AmazonSnsClientRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.push.amazon.exception; 2 | 3 | import com.sflpro.notifier.externalclients.push.common.exception.ExternalPushNotificationClientRuntimeException; 4 | 5 | /** 6 | * User: Ruben Dilanyan 7 | * Company: SFL LLC 8 | * Date: 4/9/15 9 | * Time: 7:42 PM 10 | */ 11 | public class AmazonSnsClientRuntimeException extends ExternalPushNotificationClientRuntimeException { 12 | 13 | private static final long serialVersionUID = 3157858197834455252L; 14 | 15 | /* Constructors */ 16 | public AmazonSnsClientRuntimeException(final String message) { 17 | super(message); 18 | } 19 | 20 | public AmazonSnsClientRuntimeException(final String message, final Exception originalException) { 21 | super(message, originalException); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-push/src/main/java/com/sflpro/notifier/externalclients/push/common/exception/ExternalPushNotificationClientRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.push.common.exception; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 4/9/15 7 | * Time: 7:42 PM 8 | */ 9 | public abstract class ExternalPushNotificationClientRuntimeException extends RuntimeException { 10 | 11 | private static final long serialVersionUID = 4525851652146053826L; 12 | 13 | /* Constructors */ 14 | public ExternalPushNotificationClientRuntimeException(final String exceptionMessage, final Exception originalException) { 15 | super(exceptionMessage, originalException); 16 | } 17 | 18 | public ExternalPushNotificationClientRuntimeException(final String exceptionMessage) { 19 | super(exceptionMessage); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-push/src/main/java/com/sflpro/notifier/externalclients/push/firebase/MessageSendingFaildException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.push.firebase; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 7/5/19 6 | * Time: 3:43 PM 7 | */ 8 | final class MessageSendingFaildException extends RuntimeException { 9 | 10 | MessageSendingFaildException(final String message, final Throwable cause) { 11 | super(message, cause); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-push/src/main/resources/applicationContext-externalclients-push-communicators.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-push/src/main/resources/applicationContext-externalclients-push.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-push/src/test/java/com/sflpro/notifier/externalclients/push/registry/PushMessageRegistryConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.push.registry; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | /** 7 | * Created by Hayk Mkrtchyan. 8 | * Date: 7/3/19 9 | * Time: 5:49 PM 10 | */ 11 | @Configuration 12 | @ComponentScan(basePackages = { 13 | "com.sflpro.notifier.externalclients.push.amazon", 14 | "com.sflpro.notifier.externalclients.push.firebase", 15 | "com.sflpro.notifier.externalclients.push.autoconfiguration" 16 | }) 17 | class PushMessageRegistryConfiguration { 18 | } 19 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-push/src/test/java/com/sflpro/notifier/externalclients/push/test/AbstractPushNotificationIntegrationTest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.push.test; 2 | 3 | import org.junit.Ignore; 4 | import org.springframework.test.context.ContextConfiguration; 5 | import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; 6 | 7 | /** 8 | * User: Ruben Dilanyan 9 | * Company: SFL LLC 10 | * Date: 3/15/15 11 | * Time: 10:50 AM 12 | */ 13 | @Ignore 14 | @ContextConfiguration(value = {"classpath:applicationContext-externalclients-push-integrationtest.xml"}) 15 | public class AbstractPushNotificationIntegrationTest extends AbstractJUnit4SpringContextTests { 16 | 17 | /* Dependencies */ 18 | 19 | /* Constructors */ 20 | public AbstractPushNotificationIntegrationTest() { 21 | } 22 | 23 | /* Utility methods */ 24 | } 25 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-push/src/test/java/com/sflpro/notifier/externalclients/push/test/AbstractPushNotificationUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.push.test; 2 | 3 | import org.junit.Ignore; 4 | import org.junit.runner.RunWith; 5 | import org.mockito.junit.MockitoJUnitRunner; 6 | 7 | import java.util.UUID; 8 | 9 | /** 10 | * Created by Hayk Mkrtchyan. 11 | * Date: 7/3/19 12 | * Time: 2:30 PM 13 | */ 14 | @Ignore 15 | @RunWith(MockitoJUnitRunner.class) 16 | public abstract class AbstractPushNotificationUnitTest { 17 | 18 | public static String uuid(){ 19 | return UUID.randomUUID().toString(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-push/src/test/resources/applicationContext-externalclients-push-integrationtest.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-push/src/test/resources/externalclients_push_integrationtest.properties: -------------------------------------------------------------------------------- 1 | 2 | # Amazon SNS configuration 3 | amazon.account.sns.accesskey= 4 | amazon.account.sns.secretkey= 5 | amazon.account.sns.region=EU_CENTRAL_1 6 | amazon.account.sns.development=false 7 | notification.push.application.arn.customer.ios=customer_ios_arn 8 | notification.push.application.arn.operator.ios=operator_ios_arn 9 | notification.push.application.arn.customer.android=customer_android_arn 10 | notification.push.application.arn.operator.android=customer_ios_arn -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/msgam/MsgAmSimpleSmsSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.msgam; 2 | 3 | import com.sflpro.notifier.externalclients.sms.msgam.communicator.MsgAmApiCommunicator; 4 | import com.sflpro.notifier.spi.sms.SimpleSmsMessage; 5 | import com.sflpro.notifier.spi.sms.SimpleSmsSender; 6 | 7 | /** 8 | * Created by Hayk Mkrtchyan. 9 | * Date: 6/20/19 10 | * Time: 5:53 PM 11 | */ 12 | class MsgAmSimpleSmsSender extends AbstractMsgAmSmsSender implements SimpleSmsSender { 13 | 14 | MsgAmSimpleSmsSender(final MsgAmApiCommunicator msgAmApiCommunicator) { 15 | super(msgAmApiCommunicator); 16 | } 17 | 18 | @Override 19 | String bodyFor(final SimpleSmsMessage message) { 20 | return message.messageBody(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/msgam/MsgAmTemplatedSmsSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.msgam; 2 | 3 | import com.sflpro.notifier.externalclients.sms.msgam.communicator.MsgAmApiCommunicator; 4 | import com.sflpro.notifier.spi.sms.SmsTemplateContentResolver; 5 | import com.sflpro.notifier.spi.sms.TemplatedSmsMessage; 6 | import com.sflpro.notifier.spi.sms.TemplatedSmsSender; 7 | 8 | 9 | /** 10 | * Created by Hayk Mkrtchyan. 11 | * Date: 6/21/19 12 | * Time: 12:11 PM 13 | */ 14 | class MsgAmTemplatedSmsSender extends AbstractMsgAmSmsSender implements TemplatedSmsSender { 15 | 16 | private final SmsTemplateContentResolver smsTemplateContentResolver; 17 | 18 | MsgAmTemplatedSmsSender(final MsgAmApiCommunicator msgAmApiCommunicator, 19 | final SmsTemplateContentResolver smsTemplateContentResolver) { 20 | super(msgAmApiCommunicator); 21 | this.smsTemplateContentResolver = smsTemplateContentResolver; 22 | } 23 | 24 | @Override 25 | String bodyFor(final TemplatedSmsMessage message) { 26 | return message.resolveBodyWith(smsTemplateContentResolver); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/msgam/client/MsgAmRestClient.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.msgam.client; 2 | 3 | import com.sflpro.notifier.externalclients.sms.msgam.model.request.ClientSmsSendMessagesRequest; 4 | import com.sflpro.notifier.externalclients.sms.msgam.model.response.SendMessagesResponse; 5 | 6 | /** 7 | * User: Tigran Tserunyan 8 | * Company: SFL LLC 9 | * Date: 18/05/2017 10 | * Time: 5:02 PM 11 | */ 12 | public interface MsgAmRestClient { 13 | 14 | SendMessagesResponse sendMessage(final ClientSmsSendMessagesRequest sendMessagesRequest); 15 | } 16 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/msgam/communicator/MsgAmApiCommunicator.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.msgam.communicator; 2 | 3 | 4 | import com.sflpro.notifier.externalclients.sms.msgam.model.request.SendMessagesRequest; 5 | import com.sflpro.notifier.externalclients.sms.msgam.model.response.SendMessagesResponse; 6 | 7 | /** 8 | * User: Tigran Tserunyan 9 | * Company: SFL LLC 10 | * Date: 18/05/2017 11 | * Time: 4:51 PM 12 | */ 13 | public interface MsgAmApiCommunicator { 14 | 15 | SendMessagesResponse sendMessage(final SendMessagesRequest sendMessagesRequest); 16 | } 17 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/msgam/exception/MsgAmClientRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.msgam.exception; 2 | 3 | import com.sflpro.notifier.externalclients.sms.common.exception.ExternalSmsClientRuntimeException; 4 | 5 | /** 6 | * User: Tigran Tserunyan 7 | * Company: SFL LLC 8 | * Date: 22/05/2017 9 | * Time: 5:01 PM 10 | */ 11 | public class MsgAmClientRuntimeException extends ExternalSmsClientRuntimeException { 12 | 13 | private static final long serialVersionUID = 2318648898642455252L; 14 | 15 | public MsgAmClientRuntimeException(final String senderNumber, final String recipientNumber) { 16 | super(senderNumber, recipientNumber); 17 | } 18 | 19 | public MsgAmClientRuntimeException(final String senderNumber, final String recipientNumber, final Exception cause) { 20 | super(senderNumber, recipientNumber, cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/nikitamobile/NikitamobileDateTimeUtil.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.nikitamobile; 2 | 3 | import org.springframework.util.Assert; 4 | 5 | import java.time.LocalDateTime; 6 | import java.time.format.DateTimeFormatter; 7 | 8 | public class NikitamobileDateTimeUtil { 9 | 10 | private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss"); 11 | 12 | public static LocalDateTime parse(final String strVal) { 13 | Assert.hasText(strVal,"Null or empty text was passed as an argument for parameter 'strVal'."); 14 | return LocalDateTime.parse(strVal, FORMATTER); 15 | } 16 | 17 | public static String format(final LocalDateTime localDateTime) { 18 | Assert.notNull(localDateTime,"Null was passed as an argument for parameter 'localDateTime'."); 19 | return FORMATTER.format(localDateTime); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/nikitamobile/NikitamobileSimpleSmsSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.nikitamobile; 2 | 3 | import com.sflpro.notifier.externalclients.sms.nikitamobile.communicator.NikitamobileApiCommunicator; 4 | import com.sflpro.notifier.spi.sms.SimpleSmsMessage; 5 | import com.sflpro.notifier.spi.sms.SimpleSmsSender; 6 | 7 | /** 8 | * Created by Hayk Mkrtchyan. 9 | * Date: 6/24/19 10 | * Time: 11:46 AM 11 | */ 12 | class NikitamobileSimpleSmsSender extends AbstractNikitamobileSmsSender implements SimpleSmsSender { 13 | 14 | NikitamobileSimpleSmsSender(final NikitamobileApiCommunicator nikitamobileApiCommunicator, final String login, final String password, final String version) { 15 | super(nikitamobileApiCommunicator, login, password, version); 16 | } 17 | 18 | @Override 19 | String bodyFor(final SimpleSmsMessage message) { 20 | return message.messageBody(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/nikitamobile/communicator/NikitamobileApiCommunicator.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.nikitamobile.communicator; 2 | 3 | import com.sflpro.notifier.externalclients.sms.nikitamobile.model.request.SendMessageRequest; 4 | import com.sflpro.notifier.externalclients.sms.nikitamobile.model.response.SendMessageResponse; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | /** 9 | * User: Mher Sargsyan 10 | * Company: SFL LLC 11 | * Date: 12/25/14 12 | * Time: 6:50 PM 13 | */ 14 | public interface NikitamobileApiCommunicator { 15 | 16 | /** 17 | * Send sms message 18 | * 19 | * @param request 20 | * @return sendMessageResponse 21 | */ 22 | @Nonnull 23 | SendMessageResponse sendMessage(@Nonnull final SendMessageRequest request); 24 | } 25 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/nikitamobile/exception/NikitamobileClientRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.nikitamobile.exception; 2 | 3 | import com.sflpro.notifier.externalclients.sms.common.exception.ExternalSmsClientRuntimeException; 4 | 5 | /** 6 | * Company: SFL LLC 7 | * Date: 4/9/15 8 | * Time: 7:42 PM 9 | */ 10 | public class NikitamobileClientRuntimeException extends ExternalSmsClientRuntimeException { 11 | 12 | private static final long serialVersionUID = 3157858197834455252L; 13 | 14 | /* Constructors */ 15 | public NikitamobileClientRuntimeException(final String senderNumber, final String recipientNumber,final Exception originalException) { 16 | super(senderNumber, recipientNumber, originalException); 17 | } 18 | 19 | public NikitamobileClientRuntimeException(final String senderNumber, final String recipientNumber) { 20 | super(senderNumber, recipientNumber); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/nikitamobile/model/NikitamobileDateTimeAdapter.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.nikitamobile.model; 2 | 3 | import com.sflpro.notifier.externalclients.sms.nikitamobile.NikitamobileDateTimeUtil; 4 | import org.springframework.util.StringUtils; 5 | 6 | import javax.xml.bind.annotation.adapters.XmlAdapter; 7 | import java.time.LocalDateTime; 8 | 9 | /** 10 | * Created by Hayk Mkrtchyan. 11 | * Date: 6/24/19 12 | * Time: 11:16 AM 13 | */ 14 | public class NikitamobileDateTimeAdapter extends XmlAdapter { 15 | 16 | 17 | @Override 18 | public LocalDateTime unmarshal(final String strVal) { 19 | return StringUtils.isEmpty(strVal) ? null : NikitamobileDateTimeUtil.parse(strVal); 20 | } 21 | 22 | @Override 23 | public String marshal(final LocalDateTime localDateTime) { 24 | return localDateTime == null ? null : NikitamobileDateTimeUtil.format(localDateTime); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/nikitamobile/model/response/SendMessageResponse.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.nikitamobile.model.response; 2 | 3 | import org.apache.commons.lang3.builder.EqualsBuilder; 4 | import org.apache.commons.lang3.builder.HashCodeBuilder; 5 | import org.apache.commons.lang3.builder.ToStringBuilder; 6 | 7 | import javax.xml.bind.annotation.XmlAccessType; 8 | import javax.xml.bind.annotation.XmlAccessorType; 9 | import javax.xml.bind.annotation.XmlElement; 10 | import javax.xml.bind.annotation.XmlRootElement; 11 | 12 | /** 13 | * Company: SFL LLC 14 | * Date: 4/9/15 15 | * Time: 5:29 PM 16 | */ 17 | @XmlRootElement(name = "bulk-response") 18 | @XmlAccessorType(XmlAccessType.FIELD) 19 | public class SendMessageResponse { 20 | 21 | /* Properties */ 22 | public SendMessageResponse() { 23 | super(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/registry/SmsRegistryConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.registry; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.PropertySource; 6 | 7 | /** 8 | * Created by Hayk Mkrtchyan. 9 | * Date: 6/18/19 10 | * Time: 7:49 PM 11 | */ 12 | @Configuration 13 | @PropertySource("classpath:integrations-sms.properties") 14 | @ComponentScan(basePackages = { 15 | "com.sflpro.notifier.externalclients.sms.twillio", 16 | "com.sflpro.notifier.externalclients.sms.msgam", 17 | "com.sflpro.notifier.externalclients.sms.nikitamobile", 18 | "com.sflpro.notifier.externalclients.sms.external", 19 | "com.sflpro.notifier.externalclients.sms.provider.autoconfiguration" 20 | }) 21 | class SmsRegistryConfiguration { 22 | } 23 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/twillio/TwillioSimpleSmsSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.twillio; 2 | 3 | import com.sflpro.notifier.externalclients.sms.twillio.communicator.TwillioApiCommunicator; 4 | import com.sflpro.notifier.spi.sms.SimpleSmsMessage; 5 | import com.sflpro.notifier.spi.sms.SimpleSmsSender; 6 | 7 | /** 8 | * Created by Hayk Mkrtchyan. 9 | * Date: 6/18/19 10 | * Time: 4:37 PM 11 | */ 12 | class TwillioSimpleSmsSender extends AbstractTwillioSmsSender implements SimpleSmsSender { 13 | 14 | TwillioSimpleSmsSender(final TwillioApiCommunicator twillioApiCommunicator) { 15 | super(twillioApiCommunicator); 16 | } 17 | 18 | @Override 19 | String bodyFor(final SimpleSmsMessage message) { 20 | return message.messageBody(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/twillio/TwillioTemplatedSmsSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.twillio; 2 | 3 | import com.sflpro.notifier.externalclients.sms.twillio.communicator.TwillioApiCommunicator; 4 | import com.sflpro.notifier.spi.sms.SmsTemplateContentResolver; 5 | import com.sflpro.notifier.spi.sms.TemplatedSmsMessage; 6 | import com.sflpro.notifier.spi.sms.TemplatedSmsSender; 7 | 8 | /** 9 | * Created by Hayk Mkrtchyan. 10 | * Date: 6/18/19 11 | * Time: 4:37 PM 12 | */ 13 | class TwillioTemplatedSmsSender extends AbstractTwillioSmsSender implements TemplatedSmsSender { 14 | 15 | private final SmsTemplateContentResolver smsTemplateContentResolver; 16 | 17 | TwillioTemplatedSmsSender(final TwillioApiCommunicator twillioApiCommunicator, final SmsTemplateContentResolver smsTemplateContentResolver) { 18 | super(twillioApiCommunicator); 19 | this.smsTemplateContentResolver = smsTemplateContentResolver; 20 | } 21 | 22 | @Override 23 | String bodyFor(final TemplatedSmsMessage message) { 24 | return smsTemplateContentResolver.resolve(message.templateId(), message.variables()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/twillio/communicator/TwillioApiCommunicator.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.twillio.communicator; 2 | 3 | import com.sflpro.notifier.externalclients.sms.twillio.model.request.SendMessageRequest; 4 | import com.sflpro.notifier.externalclients.sms.twillio.model.response.SendMessageResponse; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | /** 9 | * User: Mher Sargsyan 10 | * Company: SFL LLC 11 | * Date: 12/25/14 12 | * Time: 6:50 PM 13 | */ 14 | public interface TwillioApiCommunicator { 15 | 16 | /** 17 | * Send sms message 18 | * 19 | * @param request 20 | * @return sendMessageResponse 21 | */ 22 | @Nonnull 23 | SendMessageResponse sendMessage(@Nonnull final SendMessageRequest request); 24 | } 25 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/twillio/exception/TwillioClientRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.twillio.exception; 2 | 3 | import com.sflpro.notifier.externalclients.sms.common.exception.ExternalSmsClientRuntimeException; 4 | 5 | /** 6 | * User: Mher Sargsyan 7 | * Company: SFL LLC 8 | * Date: 4/9/15 9 | * Time: 7:42 PM 10 | */ 11 | public class TwillioClientRuntimeException extends ExternalSmsClientRuntimeException { 12 | 13 | private static final long serialVersionUID = 3157858197834455252L; 14 | 15 | /* Constructors */ 16 | public TwillioClientRuntimeException(final String senderNumber, final String recipientNumber,final Exception originalException) { 17 | super(senderNumber, recipientNumber, originalException); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/webhook/WebhookSimpleSmsSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.webhook; 2 | 3 | import com.sflpro.notifier.externalclients.sms.webhook.client.WebhookApiRestClient; 4 | import com.sflpro.notifier.spi.sms.SimpleSmsMessage; 5 | import com.sflpro.notifier.spi.sms.SimpleSmsSender; 6 | 7 | /** 8 | * Created by Hayk Mkrtchyan. 9 | * Date: 6/24/19 10 | * Time: 11:46 AM 11 | */ 12 | class WebhookSimpleSmsSender extends AbstractWebhookSmsSender implements SimpleSmsSender { 13 | 14 | WebhookSimpleSmsSender(final WebhookApiRestClient apiRestClient) { 15 | super(apiRestClient); 16 | } 17 | 18 | @Override 19 | String buildMessageBody(final SimpleSmsMessage message) { 20 | return message.messageBody(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/webhook/WebhookTemplatedSmsSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.webhook; 2 | 3 | import com.sflpro.notifier.externalclients.sms.webhook.client.WebhookApiRestClient; 4 | import com.sflpro.notifier.spi.sms.SmsTemplateContentResolver; 5 | import com.sflpro.notifier.spi.sms.TemplatedSmsMessage; 6 | import com.sflpro.notifier.spi.sms.TemplatedSmsSender; 7 | 8 | /** 9 | * User: Armen Nazaretyan 10 | * Company: SFL LLC 11 | * Date: 6/24/21 12 | * Time: 4:06 PM 13 | */ 14 | class WebhookTemplatedSmsSender extends AbstractWebhookSmsSender implements TemplatedSmsSender { 15 | 16 | private final SmsTemplateContentResolver smsTemplateContentResolver; 17 | 18 | WebhookTemplatedSmsSender(final WebhookApiRestClient apiRestClient, 19 | final SmsTemplateContentResolver smsTemplateContentResolver) { 20 | super(apiRestClient); 21 | this.smsTemplateContentResolver = smsTemplateContentResolver; 22 | } 23 | 24 | @Override 25 | String buildMessageBody(final TemplatedSmsMessage message) { 26 | return message.resolveBodyWith(smsTemplateContentResolver); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/webhook/client/WebhookApiRestClient.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.webhook.client; 2 | 3 | import com.sflpro.notifier.externalclients.sms.webhook.request.WebhookSmsSendMessagesRequest; 4 | 5 | /** 6 | * User: Armen Nazaretyan 7 | * Company: SFL LLC 8 | * Date: 6/24/21 9 | * Time: 5:27 PM 10 | */ 11 | public interface WebhookApiRestClient { 12 | 13 | void sendMessage(final WebhookSmsSendMessagesRequest messagesRequest); 14 | } 15 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/java/com/sflpro/notifier/externalclients/sms/webhook/exception/WebhookSenderClientRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.webhook.exception; 2 | 3 | import com.sflpro.notifier.externalclients.sms.common.exception.ExternalSmsClientRuntimeException; 4 | 5 | /** 6 | * User: Tigran Tserunyan 7 | * Company: SFL LLC 8 | * Date: 22/05/2017 9 | * Time: 5:01 PM 10 | */ 11 | public class WebhookSenderClientRuntimeException extends ExternalSmsClientRuntimeException { 12 | 13 | public WebhookSenderClientRuntimeException(final String senderNumber, final String recipientNumber) { 14 | super(senderNumber, recipientNumber); 15 | } 16 | 17 | public WebhookSenderClientRuntimeException(final String senderNumber, final String recipientNumber, final Exception cause) { 18 | super(senderNumber, recipientNumber, cause); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/main/resources/integrations-sms.properties: -------------------------------------------------------------------------------- 1 | # SMS Twillio Api Credentials 2 | #twillio.account.sid = ACtwillio_account_sid2222222222222 3 | #twillio.account.authToken = twillio_account_auth_token 4 | 5 | #MsgAm 6 | #msgam.url = https://msg.am/Xml_Api/index.php 7 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/test/java/com/sflpro/notifier/externalclients/sms/mock/DummySmsTemplateContentResolver.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.mock; 2 | 3 | import com.sflpro.notifier.spi.sms.SmsTemplateContentResolver; 4 | 5 | import java.util.Locale; 6 | import java.util.Map; 7 | import java.util.stream.Collectors; 8 | 9 | import static java.lang.String.format; 10 | 11 | /** 12 | * Created by Hayk Mkrtchyan. 13 | * Date: 7/12/19 14 | * Time: 6:39 PM 15 | */ 16 | class DummySmsTemplateContentResolver implements SmsTemplateContentResolver { 17 | 18 | @Override 19 | public String resolve(final String templateId, final Map variables) { 20 | return format("%s - %s", templateId, variables.entrySet().stream() 21 | .map(entry -> entry.getKey() + " is " + entry.getValue()) 22 | .collect(Collectors.joining("\n"))); 23 | } 24 | 25 | @Override 26 | public String resolve(String templateId, Map variables, Locale locale) { 27 | return format("%s - %s - %s", 28 | templateId, 29 | variables.entrySet().stream() 30 | .map(entry -> entry.getKey() + " is " + entry.getValue()) 31 | .collect(Collectors.joining("\n")), 32 | locale); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/test/java/com/sflpro/notifier/externalclients/sms/test/AbstractSmsIntegrationTest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.test; 2 | 3 | import org.junit.Ignore; 4 | import org.springframework.test.context.ContextConfiguration; 5 | import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; 6 | 7 | /** 8 | * User: Ruben Dilanyan 9 | * Company: SFL LLC 10 | * Date: 3/15/15 11 | * Time: 10:50 AM 12 | */ 13 | @Ignore 14 | @ContextConfiguration(value = {"classpath:applicationContext-externalclients-sms-integrationtest.xml"}) 15 | public class AbstractSmsIntegrationTest extends AbstractJUnit4SpringContextTests { 16 | 17 | /* Dependencies */ 18 | 19 | /* Constructors */ 20 | public AbstractSmsIntegrationTest() { 21 | } 22 | 23 | /* Utility methods */ 24 | } 25 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/test/java/com/sflpro/notifier/externalclients/sms/test/AbstractSmsUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.externalclients.sms.test; 2 | 3 | import org.junit.Ignore; 4 | import org.junit.runner.RunWith; 5 | import org.mockito.junit.MockitoJUnitRunner; 6 | 7 | import java.util.UUID; 8 | 9 | /** 10 | * Created by Hayk Mkrtchyan. 11 | * Date: 6/24/19 12 | * Time: 5:24 PM 13 | */ 14 | @Ignore 15 | @RunWith(MockitoJUnitRunner.class) 16 | public abstract class AbstractSmsUnitTest { 17 | 18 | public static String uuid(){ 19 | return UUID.randomUUID().toString(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/test/resources/applicationContext-externalclients-sms-integrationtest.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /infra/infra-integrations/infra-integrations-sms/src/test/resources/externalclients_sms_integrationtest.properties: -------------------------------------------------------------------------------- 1 | # Sms Twillio Api Credentials 2 | twillio.account.sid = twillio_account_sid 3 | twillio.account.authToken = twillio_account_auth_token -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-common/src/main/java/com/sflpro/notifier/queue/QueueConfigurationDefaults.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.ComponentScan; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.context.annotation.PropertySource; 8 | 9 | @Configuration 10 | @ComponentScan(basePackages = "com.sflpro.notifier.queue.amqp") 11 | @PropertySource(value = "classpath:/com/sflpro/notifier/queue.properties", ignoreResourceNotFound = true) 12 | public class QueueConfigurationDefaults { 13 | 14 | @Bean 15 | public ObjectMapper amqpObjectMapper() { 16 | return new ObjectMapper(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-common/src/main/java/com/sflpro/notifier/queue/amqp/model/AbstractRPCTransferModel.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.amqp.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * User: Ruben Dilanyan 7 | * Company: SFL LLC 8 | * Date: 12/13/14 9 | * Time: 11:59 PM 10 | */ 11 | public abstract class AbstractRPCTransferModel implements Serializable { 12 | 13 | private static final long serialVersionUID = -6289605685747745410L; 14 | 15 | /* Constructors */ 16 | public AbstractRPCTransferModel() { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-common/src/main/java/com/sflpro/notifier/queue/amqp/queues/UniquelyNamedConfigurableQueue.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.amqp.queues; 2 | 3 | import org.springframework.amqp.core.Queue; 4 | 5 | import java.util.UUID; 6 | 7 | /** 8 | * @author Ruben Dilanyan 9 | * 10 | * May 18, 2014 11 | */ 12 | public class UniquelyNamedConfigurableQueue extends Queue 13 | { 14 | 15 | /** 16 | * @param durable 17 | * @param exclusive 18 | * @param autoDelete 19 | */ 20 | public UniquelyNamedConfigurableQueue(final String namePrefix, final boolean durable, final boolean exclusive, final boolean autoDelete) 21 | { 22 | super(namePrefix + UUID.randomUUID().toString(), durable, exclusive, autoDelete); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-common/src/main/java/com/sflpro/notifier/queue/amqp/rpc/RPCCallType.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.amqp.rpc; 2 | 3 | /** 4 | * User: Ruben Dilanyan 5 | * Company: SFL LLC 6 | * Date: 12/13/14 7 | * Time: 11:54 PM 8 | */ 9 | public enum RPCCallType { 10 | START_NOTIFICATION_PROCESSING("notification.processing.start"), 11 | START_PUSH_NOTIFICATION_SUBSCRIPTION_PROCESSING("notification.push.subscription.processing.start"); 12 | 13 | /* Properties */ 14 | private final String callIdentifier; 15 | 16 | RPCCallType(final String callIdentifier) { 17 | this.callIdentifier = callIdentifier; 18 | } 19 | 20 | /* Properties getters and setters */ 21 | 22 | public String getCallIdentifier() { 23 | return callIdentifier; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-common/src/main/java/com/sflpro/notifier/queue/amqp/rpc/RPCQueueMessageHandler.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.amqp.rpc; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | /** 6 | * User: Ruben Dilanyan 7 | * Company: SFL LLC 8 | * Date: 12/12/14 9 | * Time: 1:45 PM 10 | */ 11 | public interface RPCQueueMessageHandler { 12 | 13 | /** 14 | * Handles and returns RPC message 15 | * 16 | * @param messageBytes 17 | * @return handledMessageResult 18 | */ 19 | @Nonnull 20 | String handleMessage(@Nonnull final byte[] messageBytes); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-common/src/main/java/com/sflpro/notifier/queue/amqp/rpc/RPCServiceAdapter.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.amqp.rpc; 2 | 3 | import com.sflpro.notifier.queue.amqp.rpc.message.RPCMethodHandler; 4 | 5 | import javax.annotation.Nonnull; 6 | import java.util.List; 7 | 8 | /** 9 | * User: Ruben Dilanyan 10 | * Company: SFL LLC 11 | * Date: 12/12/14 12 | * Time: 1:54 PM 13 | */ 14 | public interface RPCServiceAdapter { 15 | 16 | /** 17 | * Returns methods handlers for adapter 18 | * 19 | * @return rpcMethodHandlers 20 | */ 21 | @Nonnull 22 | List> getMethodHandlers(); 23 | } 24 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-common/src/main/java/com/sflpro/notifier/queue/amqp/rpc/ServiceRPCAdaptersRegistry.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.amqp.rpc; 2 | 3 | 4 | import com.sflpro.notifier.queue.amqp.rpc.message.RPCMethodHandler; 5 | 6 | import javax.annotation.Nonnull; 7 | 8 | /** 9 | * User: Ruben Dilanyan 10 | * Company: SFL LLC 11 | * Date: 12/12/14 12 | * Time: 1:39 PM 13 | */ 14 | public interface ServiceRPCAdaptersRegistry { 15 | 16 | /** 17 | * Returns RPC message handler for provided identifier 18 | * 19 | * @param identifier 20 | * @return rpcMethodHandler 21 | */ 22 | RPCMethodHandler getRpcMethodHandlerForIdentifier(@Nonnull final String identifier); 23 | } 24 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-common/src/main/resources/com/sflpro/notifier/queue.properties: -------------------------------------------------------------------------------- 1 | # AMQP configuration 2 | spring.rabbitmq.host=localhost 3 | spring.rabbitmq.username=guest 4 | spring.rabbitmq.password=guest 5 | # Kafka configuration 6 | kafka.bootstrap.servers=localhost 7 | kafka.heartbeat.interval.ms=2000 8 | kafka.concurrency.factor=10 9 | kafka.request.timeout.ms=20000 10 | kafka.retry.backoff.ms=500 11 | kafka.auto.offset.reset=latest 12 | # Kafka Security 13 | kafka.ssl.endpoint.identification.algorithm= 14 | kafka.sasl.mechanism= 15 | kafka.sasl.jaas.config= 16 | kafka.security.protocol= 17 | # Notifier specific configuration 18 | notifier.queue.topic=notification 19 | # Notifier RabbitMQ 20 | notifier.rabbitmq.replyTimeout=6000 21 | notifier.rabbitmq.concurrentConsumers=2 22 | amqp.maxConcurrentConsumers=4 23 | amqp.executor.coreSize=2 24 | amqp.executor.maxSize=9 25 | amqp.prefetchCount=10 -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-consumer/src/main/java/com/sflpro/notifier/queue/consumer/ConsumerConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.consumer; 2 | 3 | import com.sflpro.notifier.queue.QueueConfigurationDefaults; 4 | import org.springframework.context.annotation.ComponentScan; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.context.annotation.Import; 7 | 8 | @Configuration 9 | @Import({QueueConfigurationDefaults.class, KafkaConsumerConfiguration.class, RabbitConsumerConfiguration.class}) 10 | @ComponentScan("com.sflpro.notifier") 11 | public class ConsumerConfiguration { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-consumer/src/main/java/com/sflpro/notifier/queue/consumer/common/NotificationQueueConsumerService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.consumer.common; 2 | 3 | import javax.annotation.Nonnull; 4 | import java.util.Map; 5 | 6 | /** 7 | * User: Mher Sargsyan 8 | * Company: SFL LLC 9 | * Date: 4/10/15 10 | * Time: 6:49 PM 11 | */ 12 | public interface NotificationQueueConsumerService { 13 | 14 | /** 15 | * Processes notification 16 | * 17 | * @param notificationId 18 | */ 19 | void processNotification(@Nonnull final Long notificationId, @Nonnull final Map secureProperties); 20 | } 21 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-consumer/src/main/java/com/sflpro/notifier/queue/consumer/push/KafkaConsumerListenerServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.consumer.push; 2 | 3 | import com.sflpro.notifier.queue.amqp.rpc.RPCQueueMessageHandler; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 8 | import org.springframework.kafka.annotation.KafkaListener; 9 | import org.springframework.stereotype.Service; 10 | 11 | /** 12 | * Company: SFL LLC 13 | * Created on 06/02/2018 14 | * 15 | * @author William Arustamyan 16 | */ 17 | @Service 18 | @ConditionalOnProperty(name = "notifier.queue.engine", havingValue = "kafka") 19 | public class KafkaConsumerListenerServiceImpl { 20 | 21 | private static final Logger LOGGER = LoggerFactory.getLogger(KafkaConsumerListenerServiceImpl.class); 22 | 23 | @Autowired 24 | private RPCQueueMessageHandler amqpRpcQueueMessageHandler; 25 | 26 | @KafkaListener(topics = "${kafka.topic.names}", properties = {"${kafka.auto.offset.reset:latest}"}) 27 | public void listen(byte[] model) { 28 | LOGGER.debug("Listening kafka topic"); 29 | amqpRpcQueueMessageHandler.handleMessage(model); 30 | } 31 | } -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-consumer/src/main/java/com/sflpro/notifier/queue/consumer/push/PushNotificationQueueConsumerService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.consumer.push; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | /** 6 | * Created by alfkaghyan 7 | * Date: 9/17/15 8 | * Time: 2:05 PM 9 | */ 10 | public interface PushNotificationQueueConsumerService { 11 | 12 | /** 13 | * Process station review push notification 14 | * 15 | * @param carWashAppointmentId 16 | */ 17 | void processStationReviewPushNotification(@Nonnull final Long carWashAppointmentId); 18 | 19 | /** 20 | * Process order payment notification 21 | * 22 | * @param carWashAppointmentUuid 23 | */ 24 | void processOrderPaymentNotification(@Nonnull final String carWashAppointmentUuid); 25 | 26 | /** 27 | * Process reminder push notification to pay order 28 | * 29 | * @param carWashAppointmentUuid 30 | */ 31 | void processOrderPaymentReminderNotification(@Nonnull final String carWashAppointmentUuid); 32 | 33 | /** 34 | * Process car wash retention reminder push notification 35 | * 36 | * @param carWashRetentionReminderId 37 | */ 38 | void processCarWashRetentionReminderNotification(@Nonnull final Long carWashRetentionReminderId); 39 | } 40 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-consumer/src/main/java/com/sflpro/notifier/queue/consumer/push/PushNotificationSubscriptionRequestQueueConsumerService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.consumer.push; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | /** 6 | * User: Ruben Dilanyan 7 | * Company: SFL LLC 8 | * Date: 8/22/15 9 | * Time: 8:01 PM 10 | */ 11 | public interface PushNotificationSubscriptionRequestQueueConsumerService { 12 | 13 | /** 14 | * Process push notification subscription request 15 | * 16 | * @param requestId 17 | */ 18 | void processPushNotificationSubscriptionRequest(@Nonnull final Long requestId); 19 | } 20 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-consumer/src/test/java/com/sflpro/notifier/queue/consumer/test/AbstractQueueConsumerUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.consumer.test; 2 | 3 | import org.easymock.EasyMockRunner; 4 | import org.easymock.EasyMockSupport; 5 | import org.junit.Ignore; 6 | import org.junit.runner.RunWith; 7 | 8 | /** 9 | * User: Ruben Dilanyan 10 | * Company: SFL LLC 11 | * Date: 12/12/14 12 | * Time: 11:03 PM 13 | */ 14 | @RunWith(EasyMockRunner.class) 15 | @Ignore 16 | public class AbstractQueueConsumerUnitTest extends EasyMockSupport { 17 | } 18 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-producer/src/main/java/com/sflpro/notifier/queue/producer/ProducerConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.producer; 2 | 3 | import com.sflpro.notifier.queue.QueueConfigurationDefaults; 4 | import com.sflpro.notifier.queue.producer.notification.NotificationQueueProducerConfiguration; 5 | import org.springframework.context.annotation.ComponentScan; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.context.annotation.Import; 8 | 9 | @Configuration 10 | @ComponentScan("com.sflpro.notifier.queue.producer") 11 | @Import({ 12 | QueueConfigurationDefaults.class, 13 | RabbitProducerConfiguration.class, 14 | KafkaProducerConfiguration.class, 15 | NotificationQueueProducerConfiguration.class 16 | }) 17 | public class ProducerConfiguration { 18 | } 19 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-producer/src/main/java/com/sflpro/notifier/queue/producer/connector/AmqpConnectorService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.producer.connector; 2 | 3 | import com.sflpro.notifier.db.entities.notification.NotificationSendingPriority; 4 | import com.sflpro.notifier.queue.amqp.model.AbstractRPCTransferModel; 5 | import com.sflpro.notifier.queue.amqp.rpc.RPCCallType; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | /** 10 | * User: Ruben Dilanyan 11 | * Company: SFL LLC 12 | * Date: 12/13/14 13 | * Time: 11:44 PM 14 | */ 15 | public interface AmqpConnectorService { 16 | 17 | /** 18 | * Publish amqp message 19 | * 20 | * @param callType 21 | */ 22 | void publishMessage( 23 | @Nonnull final RPCCallType callType, 24 | @Nonnull final AbstractRPCTransferModel requestModel, 25 | @Nonnull final NotificationSendingPriority sendingPriority, 26 | @Nonnull final Class responseModelClass, 27 | @Nonnull final AmqpResponseHandler responseHandler 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-producer/src/main/java/com/sflpro/notifier/queue/producer/connector/AmqpResponseHandler.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.producer.connector; 2 | 3 | import com.sflpro.notifier.queue.amqp.model.AbstractRPCTransferModel; 4 | 5 | import javax.annotation.Nonnull; 6 | 7 | /** 8 | * User: Ruben Dilanyan 9 | * Company: SFL LLC 10 | * Date: 12/14/14 11 | * Time: 1:10 AM 12 | */ 13 | public interface AmqpResponseHandler { 14 | 15 | /** 16 | * Handles AMQP response model 17 | * 18 | * @param responseModel 19 | */ 20 | void handleResponse(@Nonnull final T responseModel); 21 | } 22 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-producer/src/main/java/com/sflpro/notifier/queue/producer/notification/common/NotificationQueueProducerService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.producer.notification.common; 2 | 3 | import com.sflpro.notifier.db.entities.notification.NotificationSendingPriority; 4 | 5 | import javax.annotation.Nonnull; 6 | import java.util.Map; 7 | 8 | /** 9 | * User: Mher Sargsyan 10 | * Company: SFL LLC 11 | * Date: 4/10/15 12 | * Time: 7:49 PM 13 | */ 14 | public interface NotificationQueueProducerService { 15 | 16 | /** 17 | * Processes event to start sending notification 18 | * 19 | * @param notificationId 20 | */ 21 | void processStartSendingNotificationEvent(@Nonnull final Long notificationId, @Nonnull final NotificationSendingPriority sendingPriority, @Nonnull final Map secureProperties); 22 | } 23 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-producer/src/main/java/com/sflpro/notifier/queue/producer/notification/push/PushNotificationSubscriptionRequestQueueProducerService.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.producer.notification.push; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | /** 6 | * User: Ruben Dilanyan 7 | * Company: SFL LLC 8 | * Date: 8/22/15 9 | * Time: 8:01 PM 10 | */ 11 | public interface PushNotificationSubscriptionRequestQueueProducerService { 12 | 13 | 14 | /** 15 | * Process push notification subscription request 16 | * 17 | * @param requestId 18 | * 19 | */ 20 | void processPushNotificationSubscriptionRequest(@Nonnull final Long requestId); 21 | } 22 | -------------------------------------------------------------------------------- /infra/infra-queue/infra-queue-producer/src/test/java/com/sflpro/notifier/queue/producer/AbstractQueueProducerUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.producer; 2 | 3 | import org.easymock.EasyMockRunner; 4 | import org.easymock.EasyMockSupport; 5 | import org.junit.Ignore; 6 | import org.junit.runner.RunWith; 7 | 8 | /** 9 | * User: Ruben Dilanyan 10 | * Company: SFL LLC 11 | * Date: 12/14/14 12 | * Time: 7:29 PM 13 | */ 14 | @RunWith(EasyMockRunner.class) 15 | @Ignore 16 | public class AbstractQueueProducerUnitTest extends EasyMockSupport { 17 | } 18 | -------------------------------------------------------------------------------- /infra/infra-queue/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.sflpro.notifier 5 | infra 6 | 1.10.2 7 | 8 | 9 | infra-queue 10 | pom 11 | 12 | Queue sub module represents queue layer of SFL NMS project. 13 | 14 | 15 | infra-queue-common 16 | infra-queue-consumer 17 | infra-queue-producer 18 | 19 | 20 | 21 | 22 | 23 | org.sonatype.plugins 24 | nexus-staging-maven-plugin 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /infra/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.sflpro.notifier 5 | notifier 6 | 1.10.2 7 | 8 | 9 | infra 10 | pom 11 | 12 | Infrastructural components 13 | 14 | 15 | infra-queue 16 | infra-integrations 17 | 18 | 19 | 20 | 21 | 22 | org.sonatype.plugins 23 | nexus-staging-maven-plugin 24 | 25 | true 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/email/EmailMessage.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.email; 2 | 3 | import java.util.Set; 4 | 5 | /** 6 | * Created by Hayk Mkrtchyan. 7 | * Date: 6/19/19 8 | * Time: 10:38 AM 9 | */ 10 | public interface EmailMessage { 11 | 12 | String from(); 13 | 14 | String to(); 15 | 16 | Set replyTo(); 17 | 18 | Set fileAttachments(); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/email/EmailSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.email; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 6/19/19 6 | * Time: 11:23 AM 7 | */ 8 | public interface EmailSender { 9 | 10 | void send(final M message); 11 | } 12 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/email/ImmutableSimpleEmailSenderRegistry.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.email; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 6/19/19 6 | * Time: 11:48 AM 7 | */ 8 | final class ImmutableSimpleEmailSenderRegistry implements SimpleEmailSenderRegistry { 9 | 10 | private final String name; 11 | private final SimpleEmailSender sender; 12 | 13 | ImmutableSimpleEmailSenderRegistry(final String name, final SimpleEmailSender sender) { 14 | this.name = name; 15 | this.sender = sender; 16 | } 17 | 18 | @Override 19 | public String name() { 20 | return name; 21 | } 22 | 23 | @Override 24 | public SimpleEmailSender sender() { 25 | return sender; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/email/ImmutableTemplatedEmailSenderRegistry.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.email; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 6/19/19 6 | * Time: 11:44 AM 7 | */ 8 | final class ImmutableTemplatedEmailSenderRegistry implements TemplatedEmailSenderRegistry { 9 | 10 | private final String name; 11 | private final TemplatedEmailSender sender; 12 | 13 | ImmutableTemplatedEmailSenderRegistry(final String name, final TemplatedEmailSender sender) { 14 | this.name = name; 15 | this.sender = sender; 16 | } 17 | 18 | @Override 19 | public String name() { 20 | return name; 21 | } 22 | 23 | @Override 24 | public TemplatedEmailSender sender() { 25 | return sender; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/email/SimpleEmailMessage.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.email; 2 | 3 | import org.springframework.util.Assert; 4 | 5 | import java.util.Set; 6 | 7 | /** 8 | * Created by Hayk Mkrtchyan. 9 | * Date: 6/19/19 10 | * Time: 10:31 AM 11 | */ 12 | public interface SimpleEmailMessage extends EmailMessage { 13 | 14 | String body(); 15 | 16 | String subject(); 17 | 18 | static SimpleEmailMessage of( 19 | final String from, 20 | final String to, 21 | final Set replyTo, 22 | final String subject, 23 | final String body, 24 | final Set fileAttachments 25 | ) { 26 | Assert.hasText(from, "Null or empty text was passed as an argument for parameter 'from'."); 27 | Assert.hasText(to, "Null or empty text was passed as an argument for parameter 'to'."); 28 | Assert.hasText(body, "Null or empty text was passed as an argument for parameter 'body'."); 29 | Assert.hasText(subject, "Null or empty text was passed as an argument for parameter 'subject'."); 30 | return new ImmutableSimpleEmailMessage(from, to, replyTo, subject, body, fileAttachments); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/email/SimpleEmailSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.email; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 6/19/19 6 | * Time: 10:22 AM 7 | */ 8 | public interface SimpleEmailSender extends EmailSender { 9 | } 10 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/email/SimpleEmailSenderRegistry.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.email; 2 | 3 | import org.springframework.util.Assert; 4 | 5 | /** 6 | * Created by Hayk Mkrtchyan. 7 | * Date: 6/19/19 8 | * Time: 11:44 AM 9 | */ 10 | public interface SimpleEmailSenderRegistry { 11 | 12 | String name(); 13 | 14 | SimpleEmailSender sender(); 15 | 16 | static SimpleEmailSenderRegistry of(final String name, final SimpleEmailSender sender) { 17 | Assert.hasText(name, "Null or empty text was passed as an argument for parameter 'name'."); 18 | Assert.notNull(sender, "Null was passed as an argument for parameter 'sender'."); 19 | return new ImmutableSimpleEmailSenderRegistry(name, sender); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/email/TemplatedEmailSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.email; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 6/19/19 6 | * Time: 11:22 AM 7 | */ 8 | public interface TemplatedEmailSender extends EmailSender { 9 | } 10 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/email/TemplatedEmailSenderRegistry.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.email; 2 | import org.springframework.util.Assert; 3 | 4 | /** 5 | * Created by Hayk Mkrtchyan. 6 | * Date: 6/19/19 7 | * Time: 11:44 AM 8 | */ 9 | public interface TemplatedEmailSenderRegistry { 10 | 11 | String name(); 12 | 13 | TemplatedEmailSender sender(); 14 | 15 | static TemplatedEmailSenderRegistry of(final String name, final TemplatedEmailSender sender) { 16 | Assert.hasText(name, "Null or empty text was passed as an argument for parameter 'name'."); 17 | Assert.notNull(sender, "Null was passed as an argument for parameter 'sender'."); 18 | return new ImmutableTemplatedEmailSenderRegistry(name, sender); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/push/ImmutablePushMessageServiceRegistry.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.push; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 7/3/19 6 | * Time: 10:59 AM 7 | */ 8 | final class ImmutablePushMessageServiceRegistry implements PushMessageServiceRegistry { 9 | 10 | private final String name; 11 | private final PushMessageSender sender; 12 | private final PushMessageSubscriber subscriber; 13 | 14 | ImmutablePushMessageServiceRegistry(final String name, final PushMessageSender sender, final PushMessageSubscriber subscriber) { 15 | this.name = name; 16 | this.sender = sender; 17 | this.subscriber = subscriber; 18 | } 19 | 20 | @Override 21 | public String name() { 22 | return name; 23 | } 24 | 25 | @Override 26 | public PushMessageSender sender() { 27 | return sender; 28 | } 29 | 30 | @Override 31 | public PushMessageSubscriber subscriber() { 32 | return subscriber; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/push/PlatformType.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.push; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 7/3/19 6 | * Time: 11:58 AM 7 | */ 8 | public enum PlatformType { 9 | GCM, APNS 10 | } 11 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/push/PushMessageSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.push; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 7/3/19 6 | * Time: 10:42 AM 7 | */ 8 | public interface PushMessageSender { 9 | 10 | PushMessageSendingResult send(final PushMessage message); 11 | } 12 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/push/PushMessageSendingResult.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.push; 2 | 3 | import org.springframework.util.Assert; 4 | 5 | /** 6 | * Created by Hayk Mkrtchyan. 7 | * Date: 7/3/19 8 | * Time: 10:43 AM 9 | */ 10 | public interface PushMessageSendingResult { 11 | 12 | String messageId(); 13 | 14 | static PushMessageSendingResult of(final String messageId){ 15 | Assert.hasText(messageId, "Null or empty text was passed as an argument for parameter 'messageId'."); 16 | return new ImmutablePushMessageSendingResult(messageId); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/push/PushMessageServiceRegistry.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.push; 2 | 3 | import org.springframework.util.Assert; 4 | 5 | /** 6 | * Created by Hayk Mkrtchyan. 7 | * Date: 7/3/19 8 | * Time: 10:58 AM 9 | */ 10 | public interface PushMessageServiceRegistry { 11 | 12 | String name(); 13 | 14 | PushMessageSender sender(); 15 | 16 | PushMessageSubscriber subscriber(); 17 | 18 | static PushMessageServiceRegistry of(final String name, final PushMessageSender sender, final PushMessageSubscriber subscriber) { 19 | Assert.hasText(name, "Null or empty text was passed as an argument for parameter 'name'."); 20 | Assert.hasText(name, "Null was passed as an argument for parameter 'sender'."); 21 | Assert.hasText(name, "Null text was passed as an argument for parameter 'subscriber'."); 22 | return new ImmutablePushMessageServiceRegistry(name, sender, subscriber); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/push/PushMessageSubscriber.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.push; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 7/3/19 6 | * Time: 10:56 AM 7 | */ 8 | public interface PushMessageSubscriber { 9 | 10 | String refreshDeviceEndpointArn(final String existingDeviceEndpointArn, final String userDeviceToken, 11 | final String applicationArn); 12 | 13 | String registerDeviceEndpointArn(final String userDeviceToken, 14 | final String applicationArn); 15 | } 16 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/sms/ImmutableSimpleSmsSenderRegistry.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.sms; 2 | 3 | 4 | 5 | /** 6 | * Created by Hayk Mkrtchyan. 7 | * Date: 6/18/19 8 | * Time: 5:21 PM 9 | */ 10 | final class ImmutableSimpleSmsSenderRegistry implements SimpleSmsSenderRegistry { 11 | 12 | private final String name; 13 | private final SimpleSmsSender sender; 14 | 15 | ImmutableSimpleSmsSenderRegistry(final String name, final SimpleSmsSender sender) { 16 | this.name = name; 17 | this.sender = sender; 18 | } 19 | 20 | @Override 21 | public String name() { 22 | return name; 23 | } 24 | 25 | @Override 26 | public SimpleSmsSender sender() { 27 | return sender; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/sms/ImmutableTemplatedSmsSenderRegistry.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.sms; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 6/18/19 6 | * Time: 5:21 PM 7 | */ 8 | final class ImmutableTemplatedSmsSenderRegistry implements TemplatedSmsSenderRegistry { 9 | 10 | private final String name; 11 | private final TemplatedSmsSender sender; 12 | 13 | ImmutableTemplatedSmsSenderRegistry(final String name, final TemplatedSmsSender sender) { 14 | this.name = name; 15 | this.sender = sender; 16 | } 17 | 18 | @Override 19 | public String name() { 20 | return name; 21 | } 22 | 23 | @Override 24 | public TemplatedSmsSender sender() { 25 | return sender; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/sms/SimpleSmsMessage.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.sms; 2 | 3 | import org.springframework.util.Assert; 4 | 5 | /** 6 | * Created by Hayk Mkrtchyan. 7 | * Date: 6/18/19 8 | * Time: 3:48 PM 9 | */ 10 | public interface SimpleSmsMessage extends SmsMessage { 11 | 12 | String messageBody(); 13 | 14 | static SimpleSmsMessage of(final long internalId,final String sender, final String recipientNumber, final String messageBody) { 15 | Assert.hasText(sender, "Null or empty text was passed as an argument for parameter 'sender'."); 16 | Assert.hasText(recipientNumber, "Null or empty text was passed as an argument for parameter 'recipientNumber'."); 17 | Assert.hasText(messageBody, "Null or empty text was passed as an argument for parameter 'messageBody'."); 18 | return new ImmutableSimpleSmsMessage(internalId,sender, recipientNumber, messageBody); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/sms/SimpleSmsSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.sms; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 6/18/19 6 | * Time: 3:45 PM 7 | */ 8 | public interface SimpleSmsSender extends SmsSender { 9 | } 10 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/sms/SimpleSmsSenderRegistry.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.sms; 2 | 3 | import org.springframework.util.Assert; 4 | 5 | /** 6 | * Created by Hayk Mkrtchyan. 7 | * Date: 6/18/19 8 | * Time: 5:21 PM 9 | */ 10 | public interface SimpleSmsSenderRegistry { 11 | 12 | String name(); 13 | 14 | SimpleSmsSender sender(); 15 | 16 | static SimpleSmsSenderRegistry of(final String name, final SimpleSmsSender sender) { 17 | Assert.hasText(name, "Null or empty text was passed as an argument for parameter 'sender'."); 18 | Assert.notNull(sender, "Null was passed as an argument for parameter 'sender'."); 19 | return new ImmutableSimpleSmsSenderRegistry(name, sender); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/sms/SmsMessage.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.sms; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 6/20/19 6 | * Time: 3:04 PM 7 | */ 8 | public interface SmsMessage { 9 | 10 | String sender(); 11 | 12 | String recipientNumber(); 13 | 14 | long internalId(); 15 | 16 | default String contentType(){ 17 | return "text/plain"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/sms/SmsMessageSendingResult.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.sms; 2 | 3 | import org.springframework.util.Assert; 4 | 5 | /** 6 | * Created by Hayk Mkrtchyan. 7 | * Date: 6/18/19 8 | * Time: 3:49 PM 9 | */ 10 | public interface SmsMessageSendingResult { 11 | 12 | String sid(); 13 | 14 | static SmsMessageSendingResult of(final String sid) { 15 | Assert.hasText(sid, "Null or empty text was passed as an argument for parameter 'sid'."); 16 | return new ImmutableSmsMessageSendingResult(sid); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/sms/SmsSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.sms; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 6/20/19 6 | * Time: 3:15 PM 7 | */ 8 | public interface SmsSender { 9 | 10 | SmsMessageSendingResult send(final M message); 11 | } 12 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/sms/SmsTemplateContentResolver.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.sms; 2 | 3 | import java.util.Locale; 4 | import java.util.Map; 5 | 6 | /** 7 | * Created by Hayk Mkrtchyan. 8 | * Date: 6/19/19 9 | * Time: 5:17 PM 10 | */ 11 | public interface SmsTemplateContentResolver { 12 | 13 | String resolve(final String templateId, final Map variables); 14 | 15 | String resolve(final String templateId,final Map variables,final Locale locale); 16 | } 17 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/sms/TemplatedSmsSender.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.sms; 2 | 3 | /** 4 | * Created by Hayk Mkrtchyan. 5 | * Date: 6/20/19 6 | * Time: 3:14 PM 7 | */ 8 | public interface TemplatedSmsSender extends SmsSender { 9 | } 10 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/sms/TemplatedSmsSenderRegistry.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.sms; 2 | 3 | import org.springframework.util.Assert; 4 | 5 | /** 6 | * Created by Hayk Mkrtchyan. 7 | * Date: 6/18/19 8 | * Time: 5:21 PM 9 | */ 10 | public interface TemplatedSmsSenderRegistry { 11 | 12 | String name(); 13 | 14 | TemplatedSmsSender sender(); 15 | 16 | static TemplatedSmsSenderRegistry of(final String name, final TemplatedSmsSender sender) { 17 | Assert.hasText(name, "Null or empty text was passed as an argument for parameter 'sender'."); 18 | Assert.notNull(sender, "Null was passed as an argument for parameter 'sender'."); 19 | return new ImmutableTemplatedSmsSenderRegistry(name, sender); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/template/TemplateContent.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.template; 2 | 3 | import org.springframework.util.Assert; 4 | 5 | /** 6 | * Created by Hayk Mkrtchyan. 7 | * Date: 6/19/19 8 | * Time: 5:28 PM 9 | */ 10 | public interface TemplateContent { 11 | 12 | String subject(); 13 | 14 | String body(); 15 | 16 | static TemplateContent of(final String subject, final String body) { 17 | Assert.hasText(subject, "Null or empty text was passed as an argument for parameter 'subject'."); 18 | Assert.hasText(body, "Null or empty text was passed as an argument for parameter 'body'."); 19 | return new ImmutableTemplateContent(subject, body); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /notification-provider-spi/src/main/java/com/sflpro/notifier/spi/template/TemplateContentResolver.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.spi.template; 2 | 3 | import java.util.Locale; 4 | import java.util.Map; 5 | 6 | /** 7 | * Created by Hayk Mkrtchyan. 8 | * Date: 6/19/19 9 | * Time: 5:17 PM 10 | */ 11 | public interface TemplateContentResolver { 12 | 13 | TemplateContent resolve(final String templateId, final Map variables); 14 | 15 | TemplateContent resolve(final String templateId, final Map variables, final Locale locale); 16 | } 17 | -------------------------------------------------------------------------------- /samples/db_init/create_database.sql: -------------------------------------------------------------------------------- 1 | create database notifier; -------------------------------------------------------------------------------- /samples/notifier-postgres-noworker/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | 5 | notifier-api: 6 | image: sflpro/notifier:snapshot 7 | ports: 8 | - "8099:8099" 9 | depends_on: 10 | - db 11 | links: 12 | - db 13 | environment: 14 | - SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/notifier 15 | - SPRING_DATASOURCE_USERNAME=notifier 16 | - SPRING_DATASOURCE_PASSWORD=notifier 17 | - SPRING_JPA_PROPERTIES_HIBERNATE_JDBC_LOB_NON_CONTEXTUAL_CREATION=true 18 | - SPRING_FLYWAY_ENABLED=true 19 | - SMS_ACCOUNT_SENDER_PHONE=00000000 20 | - FIREBASE_PUSH_ENABLED=true 21 | - PUSH_NOTIFICATION_PROVIDER=FIREBASE_CLOUD_MESSAGING 22 | - SMTP_ENABLED=true 23 | - SMTP_HOST=smtp 24 | - SMTP_PORT=25 25 | - SMTP_TIMEOUT=10000 26 | - SMTP_USERNAME=john 27 | - SMTP_PASSWORD=secret 28 | - JAVA_TOOL_OPTIONS="-Dnotification.push.application.arn.test_app.android=test_app -Xmx256m" 29 | 30 | smtp: 31 | image: namshi/smtp 32 | environment: 33 | - SMARTHOST_USER=john 34 | - SMARTHOST_PASSWORD=secret 35 | 36 | db: 37 | image: postgres:11.5 38 | restart: always 39 | environment: 40 | POSTGRES_USER: notifier 41 | POSTGRES_PASSWORD: notifier 42 | ports: 43 | - "5433:5432" 44 | volumes: 45 | - ./../db_init:/docker-entrypoint-initdb.d -------------------------------------------------------------------------------- /samples/send_email.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | curl -X POST \ 4 | http://localhost:8099/notification/email/create \ 5 | -H 'Accept: application/json' \ 6 | -H 'Cache-Control: no-cache' \ 7 | -H 'Content-Type: application/json' \ 8 | -d '{ 9 | "recipientEmail": "poghos.poghosyan@mailinator.com", 10 | "senderEmail": "noreply@testmail.com", 11 | "subject": "Hey!", 12 | "body": "Hey! Bro, how are you?" 13 | }' -------------------------------------------------------------------------------- /samples/send_push_notification.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | curl -X POST \ 4 | http://localhost:8099/notification/push/create \ 5 | -H 'Accept: application/json' \ 6 | -H 'Cache-Control: no-cache' \ 7 | -H 'Content-Type: application/json' \ 8 | -d '{ 9 | "subject": "Ehey!!!", 10 | "properties":[ {"propertyKey":"testKey","propertyValue": "Test value"}, 11 | {"propertyKey":"priority","propertyValue": "HIGH"}], 12 | "userUuId": "user_id_poghos_poghosi_poghosyan", 13 | "body": "Hey!" 14 | }' -------------------------------------------------------------------------------- /samples/subscribe_to_push_notifications.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | curl -X POST \ 4 | http://localhost:8099/notification/push/subscribe \ 5 | -H 'Accept: application/json' \ 6 | -H 'Cache-Control: no-cache' \ 7 | -H 'Content-Type: application/json' \ 8 | -d '{ 9 | "userUuId": "user_id_pogho_poghos_poghosyan", 10 | "subscribe": "true", 11 | "deviceUuId": "device_id_poghos_poghosi_poghosya", 12 | "deviceOperatingSystemType": "ANDROID", 13 | "application": "test_app", 14 | "userDeviceToken": "{userDeviceToken obtained for corresponding device(browser as well)}" 15 | }' -------------------------------------------------------------------------------- /secret.tar.bz2.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sflpro/notifier/0b62c9c7c070ed0cefbf4646de79728c82f863ee/secret.tar.bz2.enc -------------------------------------------------------------------------------- /worker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:11-jre 2 | ARG JAR_FILE 3 | ADD target/${JAR_FILE} /worker.jar 4 | ENTRYPOINT ["java", "-jar", "/worker.jar"] -------------------------------------------------------------------------------- /worker/src/main/java/com/sflpro/notifier/worker/NotifierWorkerApplication.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.worker; 2 | 3 | import com.sflpro.notifier.queue.consumer.ConsumerConfiguration; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.builder.SpringApplicationBuilder; 6 | import org.springframework.context.annotation.Import; 7 | import org.springframework.context.annotation.PropertySource; 8 | 9 | /** 10 | * Company: SFL LLC 11 | * Created on 06/12/2017 12 | * 13 | * @author Davit Harutyunyan 14 | */ 15 | @SpringBootApplication 16 | @PropertySource(value = "classpath:application.properties") 17 | @Import(ConsumerConfiguration.class) 18 | @PropertySource("classpath:application.properties") 19 | public class NotifierWorkerApplication { 20 | 21 | public static void main(String[] args) { 22 | new SpringApplicationBuilder(NotifierWorkerApplication.class).run(args); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /worker/src/main/java/com/sflpro/notifier/worker/resources/maintanance/HeartBeatResource.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.worker.resources.maintanance; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | /** 7 | * Company: SFL LLC 8 | * Created on 06/12/2017 9 | * 10 | * @author Davit Harutyunyan 11 | */ 12 | 13 | @RestController 14 | public class HeartBeatResource { 15 | 16 | @GetMapping(path = "heartbeat") 17 | public String checkHeartBeat() { 18 | return "ALIVE"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /worker/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8094 2 | spring.jpa.open-in-view=false -------------------------------------------------------------------------------- /worker/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /worker/src/test/java/com/sflpro/notifier/queue/consumer/test/ConsumerTestConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.sflpro.notifier.queue.consumer.test; 2 | 3 | import com.sflpro.notifier.services.springboot.NotifierTestApplication; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.context.annotation.Import; 6 | 7 | /** 8 | * Created by Hayk Mkrtchyan. 9 | * Date: 7/4/19 10 | * Time: 10:33 AM 11 | */ 12 | @Configuration 13 | @Import(NotifierTestApplication.class) 14 | class ConsumerTestConfiguration { 15 | } 16 | --------------------------------------------------------------------------------