Package com.alpaca.persistence.impl
Class UserDAOImpl
- All Implemented Interfaces:
IGenericDAO<User,,UUID> IUserDAO
Implementation of the
IUserDAO interface for managing User entities. Extends the
generic DAO implementation (GenericDAOImpl) to provide CRUD and custom user-related
persistence operations.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanexistsByEmail(String email) Checks whether a user exists with the given email.booleanexistsByUniqueProperties(User user) Determines whether a user already exists in the database based on its unique properties.findByEmail(String email) Searches for aUserby email.Returns the entity class managed by this DAO.protected GenericRepo<User, UUID> getRepo()Provides the repository used by the generic DAO operations.updateById(User user, UUID id) Updates an existingUseridentified by the given ID with the non-null and non-blank properties provided in the supplieduserobject.Methods inherited from class com.alpaca.persistence.impl.GenericDAOImpl
deleteById, existsAllByIds, existsById, findAll, findAllByIds, findAllPage, findById, save, saveAllMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.alpaca.persistence.IGenericDAO
deleteById, existsAllByIds, existsById, findAll, findAllByIds, findAllPage, findById, save, saveAll
-
Field Details
-
repo
-
-
Constructor Details
-
UserDAOImpl
public UserDAOImpl()
-
-
Method Details
-
getRepo
Provides the repository used by the generic DAO operations.- Specified by:
getRepoin classGenericDAOImpl<User,UUID> - Returns:
- the
GenericRepoimplementation specific toUser
-
getEntity
Returns the entity class managed by this DAO.- Specified by:
getEntityin classGenericDAOImpl<User,UUID> - Returns:
- the
Classobject forUser
-
findByEmail
Searches for aUserby email.- Specified by:
findByEmailin interfaceIUserDAO- Parameters:
email- the email address to search for; may benullor blank- Returns:
- an
Optionalcontaining the found user, or empty if not found
-
updateById
Updates an existingUseridentified by the given ID with the non-null and non-blank properties provided in the supplieduserobject. Only fields that are different, non-null, and non-blank are updated. Throws aNotFoundExceptionif no user with the specified ID exists.- Specified by:
updateByIdin interfaceIGenericDAO<User,UUID> - Parameters:
user- user object containing updated valuesid- the unique identifier of the user to update- Returns:
- the updated and saved
Userinstance - Throws:
NotFoundException- if no existing user is found with the given ID
-
existsByUniqueProperties
Determines whether a user already exists in the database based on its unique properties.- Specified by:
existsByUniquePropertiesin interfaceIGenericDAO<User,UUID> - Parameters:
user- the user to check; uses its email as the unique property- Returns:
trueif a user with the same email exists,falseotherwise
-
existsByEmail
Checks whether a user exists with the given email.- Specified by:
existsByEmailin interfaceIUserDAO- Parameters:
email- the email to check; may benullor blank- Returns:
trueif a user exists with the specified email,falseotherwise
-