Package com.alpaca.service.impl
Class UserServiceImpl
- All Implemented Interfaces:
IGenericService<User,
,UUID> 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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
existsByEmail
(String email) Checks whether a user exists based on their email address.findByEmail
(String email) Retrieves aUser
by their email address.protected IGenericDAO
<User, UUID> getDAO()
Provides the DAO component used by inherited service operations.protected String
Supplies a human-readable entity name used in exception messages.Registers a newUser
in the system.Methods inherited from class com.alpaca.service.impl.GenericServiceImpl
deleteById, existsAllByIds, existsById, existsByUniqueProperties, findAll, findAllByIds, findAllByIdsToSet, findAllPage, findById, save, saveAll, updateById
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.alpaca.service.IGenericService
deleteById, existsAllByIds, existsById, existsByUniqueProperties, findAll, findAllByIds, findAllByIdsToSet, findAllPage, findById, save, saveAll, updateById
-
Field Details
-
dao
-
-
Constructor Details
-
UserServiceImpl
public UserServiceImpl()
-
-
Method Details
-
getDAO
Provides the DAO component used by inherited service operations.- Specified by:
getDAO
in classGenericServiceImpl<User,
UUID> - Returns:
- the
IGenericDAO
implementation managingUser
persistence
-
getEntityName
Supplies a human-readable entity name used in exception messages.- Specified by:
getEntityName
in classGenericServiceImpl<User,
UUID> - Returns:
- the name of the entity ("User")
-
register
Registers a newUser
in the system.- Specified by:
register
in interfaceIUserService
- Parameters:
user
- the user to register; must not benull
- Returns:
- the saved
User
instance - Throws:
BadRequestException
- if the provided user isnull
-
existsByEmail
Checks whether a user exists based on their email address.- Specified by:
existsByEmail
in interfaceIUserService
- Parameters:
email
- the email to check; may benull
or blank- Returns:
true
if a user with the specified email exists;false
otherwise
-
findByEmail
Retrieves aUser
by their email address.- Specified by:
findByEmail
in interfaceIUserService
- Parameters:
email
- the email of the user to find; must not benull
or blank- Returns:
- the found
User
- Throws:
BadRequestException
- if the email isnull
or blankNotFoundException
- if no user is found with the given email
-