Class UserServiceFacade

java.lang.Object
org.eco.mubisoft.good_and_cheap.user.domain.service.UserServiceFacade
All Implemented Interfaces:
UserService, org.springframework.security.core.userdetails.UserDetailsService

@Service
public class UserServiceFacade
extends java.lang.Object
implements UserService, org.springframework.security.core.userdetails.UserDetailsService
  • Field Details

    • userRepo

      private final UserRepository userRepo
    • locationRepo

      private final LocationRepository locationRepo
    • passwordEncoder

      private final org.springframework.security.crypto.password.PasswordEncoder passwordEncoder
  • Constructor Details

    • UserServiceFacade

      public UserServiceFacade()
  • Method Details

    • saveUser

      public AppUser saveUser​(AppUser user)
      Description copied from interface: UserService

      SAVE USER

      Save a user on the database. It makes sure if the user's email is unique on the database. If the email is already taken or any other error is detected, the user won't be created.

      Specified by:
      saveUser in interface UserService
      Parameters:
      user - The user that is going to be added.
      Returns:
      The user that has been added on the database, with an encrypted password.
    • getUser

      public AppUser getUser​(java.lang.Long id)
      Description copied from interface: UserService

      GET USER BY ID

      Get a user form the database using it's user ID.

      Specified by:
      getUser in interface UserService
      Parameters:
      id - The ID of the user that is going to be searched.
      Returns:
      The user from the database.
    • getUser

      public AppUser getUser​(java.lang.String username)
      Description copied from interface: UserService

      GET USER BY USERNAME

      Get a user form the database using its email.

      Specified by:
      getUser in interface UserService
      Parameters:
      username - The email of the user that is going to be searched.
      Returns:
      The user from the database.
    • deleteUser

      public AppUser deleteUser​(AppUser user)
      Description copied from interface: UserService

      DELETE USER

      Remove a user from the database. If the user doesn't exist won't it return anything.

      Specified by:
      deleteUser in interface UserService
      Parameters:
      user - The user that is going to be removed.
      Returns:
      The user that has been removed from the database.
    • loadUserByUsername

      public org.springframework.security.core.userdetails.UserDetails loadUserByUsername​(java.lang.String username) throws org.springframework.security.core.userdetails.UsernameNotFoundException
      Specified by:
      loadUserByUsername in interface org.springframework.security.core.userdetails.UserDetailsService
      Throws:
      org.springframework.security.core.userdetails.UsernameNotFoundException