Class UserLifecycleEventService

java.lang.Object
es.kukenan.smartfi.microservice.communication.service.messaging.UserLifecycleEventService

@Service public class UserLifecycleEventService extends Object
This service owns the logic of the users lifecycle domain events processing.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Spring repository with the methods to access the Company database table.
    static final boolean
    Default value for robinson list.
    Local user management service.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private boolean
    Enable notifications based on the given user state.
    void
    handleUserCreatedEvent(es.kukenan.smartfi.microservice.clients.events.created.UserCreatedEvent usersEvent)
    Handle the UserCreatedEvent received from the messaging system.
    void
    handleUserUpdatedEvent(es.kukenan.smartfi.microservice.clients.events.updated.UserUpdatedEvent usersEvent)
    Handle the UserUpdatedEvent received from the messaging system.
    private User
    user(es.kukenan.smartfi.microservice.clients.events.created.UserCreatedEvent event)
    Create the user entity with the information in the given user created event.
    private User
    user(User oldUser, es.kukenan.smartfi.microservice.clients.events.updated.UserUpdatedEvent event)
    Create the user entity with the information in the given user updated event.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEF_ROBINSONLIST_VALUE

      public static final boolean DEF_ROBINSONLIST_VALUE
      Default value for robinson list.
      See Also:
    • companyRepository

      @Autowired private CompanyRepository companyRepository
      Spring repository with the methods to access the Company database table.
    • usersService

      @Autowired private UserManagementService usersService
      Local user management service.
  • Constructor Details

    • UserLifecycleEventService

      public UserLifecycleEventService()
  • Method Details

    • handleUserCreatedEvent

      public void handleUserCreatedEvent(es.kukenan.smartfi.microservice.clients.events.created.UserCreatedEvent usersEvent)
      Handle the UserCreatedEvent received from the messaging system.
      Parameters:
      usersEvent - UserCreatedEvent.
    • handleUserUpdatedEvent

      public void handleUserUpdatedEvent(es.kukenan.smartfi.microservice.clients.events.updated.UserUpdatedEvent usersEvent)
      Handle the UserUpdatedEvent received from the messaging system.
      Parameters:
      usersEvent - UserUpdatedEvent.
    • user

      private User user(es.kukenan.smartfi.microservice.clients.events.created.UserCreatedEvent event)
      Create the user entity with the information in the given user created event.
      Parameters:
      event - users event.
      Returns:
      the user entity with the information in the given event.
    • user

      private User user(User oldUser, es.kukenan.smartfi.microservice.clients.events.updated.UserUpdatedEvent event)
      Create the user entity with the information in the given user updated event.
      Parameters:
      oldUser - old user data.
      event - users event.
      Returns:
      the user entity with the information in the given event.
    • enableNotifications

      private boolean enableNotifications(String userState)
      Enable notifications based on the given user state.
      Parameters:
      userState - user state.
      Returns:
      true if notifications must be enabled based on the given user state.