Class UserUtils
java.lang.Object
es.kukenan.smartfi.microservice.clients.utils.UserUtils
UserUtils class for users-microservice.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Userget user before change.static StringReturn Local date as String.static StringgenerateRandomPassword(String characters, int length) Generate password with defined length.static UserDocumentgetActiveDocument(List<UserDocument> documents) Get the user active document given the list.private static ObjectinvokeGetter(Object object, Method method) Helper util to invoke a method capturing, controlling and logging any exception thrown.private static ObjectinvokeSetter(Object object, String setMethodName, Object argument) Helper util to invoke a method capturing, controlling and logging any exception thrown.static List<es.kukenan.smartfi.microservice.clients.events.common.UserBackoffice>map(List<UserBackoffice> userBackofficeEntities) Map the givenUserBackofficelist to aUserBackofficelist.static <T,Q> T mergeEntityUser(T original, Q remote) merge user info Method.static StringtoJsonString(Object object) Return de object in json format.
-
Constructor Details
-
UserUtils
public UserUtils()
-
-
Method Details
-
mergeEntityUser
public static <T,Q> T mergeEntityUser(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.
-
invokeSetter
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.- 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.
-
clone
get user before change.- Parameters:
user- User identifier.- Returns:
- user old user
-
map
public static List<es.kukenan.smartfi.microservice.clients.events.common.UserBackoffice> map(List<UserBackoffice> userBackofficeEntities) Map the givenUserBackofficelist to aUserBackofficelist.- Parameters:
userBackofficeEntities- a user backoffice entity list.- Returns:
- the mapped user backoffice dto list.
-
toJsonString
Return de object in json format.- Parameters:
object- the object to get json format.- Returns:
- json formater
-
convertLocalDateToString
Return Local date as String.- Parameters:
date- local Date.- Returns:
- date as String
-
generateRandomPassword
Generate password with defined length.- Parameters:
characters- String with all characters.length- String length.- Returns:
- Random password.
-
getActiveDocument
Get the user active document given the list.- Parameters:
documents- list of user documents- Returns:
- active document
-