Class UserServiceImpl

java.lang.Object
org.example.crmedu.domain.service.user.UserServiceImpl
All Implemented Interfaces:
UserService

@Service public class UserServiceImpl extends Object implements UserService
Implementation of the UserService interface. Provides business logic for managing User entities.
  • Constructor Details

    • UserServiceImpl

      public UserServiceImpl()
  • Method Details

    • create

      public User create(User user)
      Description copied from interface: UserService
      Creates a new user. If user has role 'tutor', a tutor corresponding to that user is also created.
      Specified by:
      create in interface UserService
      Parameters:
      user - the user to create
      Returns:
      the created User
    • findById

      @Transactional public User findById(Long id)
      Description copied from interface: UserService
      Retrieves an user by its unique identifier.
      Specified by:
      findById in interface UserService
      Parameters:
      id - the unique identifier of the user
      Returns:
      the found User
    • findByEmail

      @Transactional public User findByEmail(String email)
      Description copied from interface: UserService
      Retrieves a user by its email.
      Specified by:
      findByEmail in interface UserService
      Parameters:
      email - the email of the user
      Returns:
      the found User
    • findByVerificationToken

      @Transactional public User findByVerificationToken(String token)
      Description copied from interface: UserService
      Retrieves a user by its token.
      Specified by:
      findByVerificationToken in interface UserService
      Parameters:
      token - the verification token of the user
      Returns:
      the found User
    • findAll

      public Page<User> findAll(int pageNumber, int pageSize)
      Description copied from interface: UserService
      Retrieves a paginated list of users.
      Specified by:
      findAll in interface UserService
      Parameters:
      pageNumber - the page number (starting from 0)
      pageSize - the number of users per page
      Returns:
      a Page containing the requested users
    • update

      @Transactional public void update(User user, Long id)
      Description copied from interface: UserService
      Updates an existing user.
      Specified by:
      update in interface UserService
      Parameters:
      user - the updated user data
      id - the unique identifier of the user to update
    • delete

      public void delete(Long id)
      Description copied from interface: UserService
      Deletes a user by its unique identifier.
      Specified by:
      delete in interface UserService
      Parameters:
      id - the unique identifier of the user to delete
    • verifyUserByVerificationToken

      @Transactional public void verifyUserByVerificationToken(String token)
      Description copied from interface: UserService
      Verifies user in system by his verification token.
      Specified by:
      verifyUserByVerificationToken in interface UserService
      Parameters:
      token - verification token of the user