Class UserServiceImpl

java.lang.Object
com.alpaca.service.impl.GenericServiceImpl<User,UUID>
com.alpaca.service.impl.UserServiceImpl
All Implemented Interfaces:
IGenericService<User,UUID>, IUserService

@Service public class UserServiceImpl extends GenericServiceImpl<User,UUID> implements IUserService
Service layer implementation for managing User entities and encapsulating business logic beyond simple CRUD operations inherited from IGenericService.

Provides transactional operations for user registration, verification, and search by email. Error handling is included for invalid inputs and missing users.

See Also:
  • Field Details

  • Constructor Details

    • UserServiceImpl

      public UserServiceImpl()
  • Method Details

    • getDAO

      protected IGenericDAO<User,UUID> getDAO()
      Provides the DAO component used by inherited service operations.
      Specified by:
      getDAO in class GenericServiceImpl<User,UUID>
      Returns:
      the IGenericDAO implementation managing User persistence
    • getEntityName

      protected String getEntityName()
      Supplies a human-readable entity name used in exception messages.
      Specified by:
      getEntityName in class GenericServiceImpl<User,UUID>
      Returns:
      the name of the entity ("User")
    • register

      @Transactional public User register(User user)
      Registers a new User in the system.
      Specified by:
      register in interface IUserService
      Parameters:
      user - the user to register; must not be null
      Returns:
      the saved User instance
      Throws:
      BadRequestException - if the provided user is null
    • existsByEmail

      @Transactional public boolean existsByEmail(String email)
      Checks whether a user exists based on their email address.
      Specified by:
      existsByEmail in interface IUserService
      Parameters:
      email - the email to check; may be null or blank
      Returns:
      true if a user with the specified email exists; false otherwise
    • findByEmail

      @Transactional public User findByEmail(String email)
      Retrieves a User by their email address.
      Specified by:
      findByEmail in interface IUserService
      Parameters:
      email - the email of the user to find; must not be null or blank
      Returns:
      the found User
      Throws:
      BadRequestException - if the email is null or blank
      NotFoundException - if no user is found with the given email