Package com.alpaca.persistence.impl
Class RoleDAOImpl
- All Implemented Interfaces:
IGenericDAO<Role,,UUID> IRoleDAO
Implementation of the
IRoleDAO interface for managing Role entities. This class
extends the generic DAO implementation (GenericDAOImpl) to provide standard CRUD
operations along with custom role-specific persistence logic.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanexistsByUniqueProperties(Role role) Determines whether a role already exists based on its unique properties.findByRoleName(String roleName) Retrieves aRoleentity by its role name.Returns the class object representing the entity managed by this DAO.protected GenericRepo<Role, UUID> getRepo()Provides the specific repository used by the generic DAO system.updateById(Role role, UUID id) Updates an existingRoleidentified by the given ID with the non-null, non-blank properties from the suppliedroleobject.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
-
rolePermissionRepo
-
-
Constructor Details
-
RoleDAOImpl
public RoleDAOImpl()
-
-
Method Details
-
getRepo
Provides the specific repository used by the generic DAO system.- Specified by:
getRepoin classGenericDAOImpl<Role,UUID> - Returns:
- the
GenericRepoimplementation forRole
-
getEntity
Returns the class object representing the entity managed by this DAO.- Specified by:
getEntityin classGenericDAOImpl<Role,UUID> - Returns:
Role.class
-
findByRoleName
Retrieves aRoleentity by its role name.- Specified by:
findByRoleNamein interfaceIRoleDAO- Parameters:
roleName- the name of the role to search for; may benullor blank- Returns:
- an
Optionalcontaining the found role, or empty if not found or invalid input
-
updateById
Updates an existingRoleidentified by the given ID with the non-null, non-blank properties from the suppliedroleobject. Only changed fields are applied. ThrowsNotFoundExceptionif no existing entity is found.- Specified by:
updateByIdin interfaceIGenericDAO<Role,UUID> - Parameters:
role- the role object containing updated valuesid- the unique identifier of the role to update- Returns:
- the updated and saved
Roleinstance - Throws:
NotFoundException- if no role exists with the specified ID
-
existsByUniqueProperties
Determines whether a role already exists based on its unique properties. Both role name and description are required to be non-null and non-blank to perform the check.- Specified by:
existsByUniquePropertiesin interfaceIGenericDAO<Role,UUID> - Parameters:
role- the role object whose uniqueness is to be verified- Returns:
trueif a role with the same name exists;falseotherwise or if input is invalid
-