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 TypeMethodDescriptionbooleanexistsByEmail(String email) Checks whether a user exists based on their email address.findByEmail(String email) Retrieves aUserby their email address.protected IGenericDAO<User, UUID> getDAO()Provides the DAO component used by inherited service operations.protected StringSupplies a human-readable entity name used in exception messages.Registers a newUserin the system.Methods inherited from class com.alpaca.service.impl.GenericServiceImpl
deleteById, existsAllByIds, existsById, existsByUniqueProperties, findAll, findAllByIds, findAllByIdsToSet, findAllPage, findById, save, saveAll, updateByIdMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
getDAOin classGenericServiceImpl<User,UUID> - Returns:
- the
IGenericDAOimplementation managingUserpersistence
-
getEntityName
Supplies a human-readable entity name used in exception messages.- Specified by:
getEntityNamein classGenericServiceImpl<User,UUID> - Returns:
- the name of the entity ("User")
-
register
Registers a newUserin the system.- Specified by:
registerin interfaceIUserService- Parameters:
user- the user to register; must not benull- Returns:
- the saved
Userinstance - Throws:
BadRequestException- if the provided user isnull
-
existsByEmail
Checks whether a user exists based on their email address.- Specified by:
existsByEmailin interfaceIUserService- Parameters:
email- the email to check; may benullor blank- Returns:
trueif a user with the specified email exists;falseotherwise
-
findByEmail
Retrieves aUserby their email address.- Specified by:
findByEmailin interfaceIUserService- Parameters:
email- the email of the user to find; must not benullor blank- Returns:
- the found
User - Throws:
BadRequestException- if the email isnullor blankNotFoundException- if no user is found with the given email
-