Class UserLifecycleEventService
java.lang.Object
es.kukenan.smartfi.microservice.communication.service.messaging.UserLifecycleEventService
This service owns the logic of the users lifecycle domain events processing.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CompanyRepositorySpring repository with the methods to access theCompanydatabase table.static final booleanDefault value for robinson list.private UserManagementServiceLocal user management service. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanenableNotifications(String userState) Enable notifications based on the given user state.voidhandleUserCreatedEvent(es.kukenan.smartfi.microservice.clients.events.created.UserCreatedEvent usersEvent) Handle theUserCreatedEventreceived from the messaging system.voidhandleUserUpdatedEvent(es.kukenan.smartfi.microservice.clients.events.updated.UserUpdatedEvent usersEvent) Handle theUserUpdatedEventreceived from the messaging system.private Useruser(es.kukenan.smartfi.microservice.clients.events.created.UserCreatedEvent event) Create the user entity with the information in the given user created event.private UserCreate the user entity with the information in the given user updated event.
-
Field Details
-
DEF_ROBINSONLIST_VALUE
public static final boolean DEF_ROBINSONLIST_VALUEDefault value for robinson list.- See Also:
-
companyRepository
Spring repository with the methods to access theCompanydatabase table. -
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 theUserCreatedEventreceived from the messaging system.- Parameters:
usersEvent-UserCreatedEvent.
-
handleUserUpdatedEvent
public void handleUserUpdatedEvent(es.kukenan.smartfi.microservice.clients.events.updated.UserUpdatedEvent usersEvent) Handle theUserUpdatedEventreceived from the messaging system.- Parameters:
usersEvent-UserUpdatedEvent.
-
user
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
Enable notifications based on the given user state.- Parameters:
userState- user state.- Returns:
trueif notifications must be enabled based on the given user state.
-