java.lang.Object
es.kukenan.smartfi.microservice.clients.utils.UserUtils

public class UserUtils extends Object
UserUtils class for users-microservice.
  • 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

      private static Object invokeSetter(Object object, String setMethodName, Object argument)
      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

      private static Object invokeGetter(Object object, Method method)
      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

      public static User clone(User user)
      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 given UserBackoffice list to a UserBackoffice list.
      Parameters:
      userBackofficeEntities - a user backoffice entity list.
      Returns:
      the mapped user backoffice dto list.
    • toJsonString

      public static String toJsonString(Object object)
      Return de object in json format.
      Parameters:
      object - the object to get json format.
      Returns:
      json formater
    • convertLocalDateToString

      public static String convertLocalDateToString(LocalDate date)
      Return Local date as String.
      Parameters:
      date - local Date.
      Returns:
      date as String
    • generateRandomPassword

      public static String generateRandomPassword(String characters, int length)
      Generate password with defined length.
      Parameters:
      characters - String with all characters.
      length - String length.
      Returns:
      Random password.
    • getActiveDocument

      public static UserDocument getActiveDocument(List<UserDocument> documents)
      Get the user active document given the list.
      Parameters:
      documents - list of user documents
      Returns:
      active document