Class UserService
java.lang.Object
es.kukenan.smartfi.microservice.firm.service.events.UserService
Service for handler user events.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AmqpControllerAMQP controller.private StringSpring application name.private es.kukenan.smartfi.common.context.RequestContextManagersmartfi request context manager.private DocumentTypeRepositoryDocumentType repository.private KafkaControllerKafka Controller.private static final es.kukenan.smartfi.logger.WalletLoggerWallet logger.private UserCivilStatusRepositoryuserCivilStatus repository use for database queries.private UserGenderRepositoryuserGender repository use for database queries.private UserLanguageRepositoryuserLanguage repository.private UserRepositoryUser repository use for database queries.private UserStateRepositoryuserState repository.private UserTypeRepositoryuserType repository. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ObjectgetComposedObject(Object value, String attributeName) Get composed object from entities.voidhandleUserCreatedEvent(es.kukenan.smartfi.microservice.clients.events.created.UserCreatedEvent userCreatedEvent) Method for handle event for user creation.voidhandleUserUpdatedEvent(es.kukenan.smartfi.microservice.clients.events.updated.UserUpdatedEvent userUpdatedEvent) Method for handle event for update information.private ObjectinvokeGetter(Object object, Method method) Helper util to invoke a method capturing, controlling and logging any exception thrown.private ObjectinvokeSetter(Object object, String setMethodName, Object argument, String getMethodName) Helper util to invoke a method capturing, controlling and logging any exception thrown.private <T,Q> T merge(T original, Q remote) merge user info Method.private voidpublishUserCreationErrorEvent(String userId, String sourceEventId, String errorCode, String errorDescription) Publish a user creation error event.
-
Field Details
-
logAudit
private static final es.kukenan.smartfi.logger.WalletLogger logAuditWallet logger. -
appName
Spring application name. -
userRepository
User repository use for database queries. -
contextManager
@Autowired private es.kukenan.smartfi.common.context.RequestContextManager contextManagersmartfi request context manager. -
amqpController
AMQP controller. -
kafkaController
Kafka Controller. -
documentTypeRepository
DocumentType repository. -
userLanguageRepository
userLanguage repository. -
userGenderRepository
userGender repository use for database queries. -
userCivilStatusRepository
userCivilStatus repository use for database queries. -
userTypeRepository
userType repository. -
userStateRepository
userState repository.
-
-
Constructor Details
-
UserService
public UserService()
-
-
Method Details
-
handleUserUpdatedEvent
public void handleUserUpdatedEvent(es.kukenan.smartfi.microservice.clients.events.updated.UserUpdatedEvent userUpdatedEvent) Method for handle event for update information.- Parameters:
userUpdatedEvent- UserUpdatedEvent update event.
-
handleUserCreatedEvent
public void handleUserCreatedEvent(es.kukenan.smartfi.microservice.clients.events.created.UserCreatedEvent userCreatedEvent) Method for handle event for user creation.- Parameters:
userCreatedEvent- userCreatedEvent user created event.
-
merge
private <T,Q> T merge(T original, Q remote) merge user info Method.- Type Parameters:
T- user original.Q- user from event.- Parameters:
original- user from event.remote- user from event.- Returns:
- object merged.
-
getComposedObject
Get composed object from entities.- Parameters:
value- value of eventbody attribute.attributeName- name of attribute.- Returns:
- value to be set.
-
invokeSetter
private Object invokeSetter(Object object, String setMethodName, Object argument, String getMethodName) Helper util to invoke a method capturing, controlling and logging any exception thrown.- Parameters:
object- the object which method will be invoked.setMethodName- the name of the method to invoke.argument- the setter argument.getMethodName- the setter argument.- Returns:
- the method invocation result or null if any exception is captured.
-
invokeGetter
Helper util to invoke a method capturing, controlling and logging any exception thrown.- Parameters:
object- the object which method will be invoked.method- the method.- Returns:
- the method invocation result or null if any exception is captured.
-
publishUserCreationErrorEvent
private void publishUserCreationErrorEvent(String userId, String sourceEventId, String errorCode, String errorDescription) Publish a user creation error event.- Parameters:
userId- the user whose creation has failed.sourceEventId- event received that caused the failure.errorCode- Error code.errorDescription- Error description.
-