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 TypeMethodDescriptionboolean
existsByUniqueProperties
(Role role) Determines whether a role already exists based on its unique properties.findByRoleName
(String roleName) Retrieves aRole
entity 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 existingRole
identified by the given ID with the non-null, non-blank properties from the suppliedrole
object.Methods inherited from class com.alpaca.persistence.impl.GenericDAOImpl
deleteById, existsAllByIds, existsById, findAll, findAllByIds, findAllPage, findById, save, saveAll
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
getRepo
in classGenericDAOImpl<Role,
UUID> - Returns:
- the
GenericRepo
implementation forRole
-
getEntity
Returns the class object representing the entity managed by this DAO.- Specified by:
getEntity
in classGenericDAOImpl<Role,
UUID> - Returns:
Role.class
-
findByRoleName
Retrieves aRole
entity by its role name.- Specified by:
findByRoleName
in interfaceIRoleDAO
- Parameters:
roleName
- the name of the role to search for; may benull
or blank- Returns:
- an
Optional
containing the found role, or empty if not found or invalid input
-
updateById
Updates an existingRole
identified by the given ID with the non-null, non-blank properties from the suppliedrole
object. Only changed fields are applied. ThrowsNotFoundException
if no existing entity is found.- Specified by:
updateById
in interfaceIGenericDAO<Role,
UUID> - Parameters:
role
- the role object containing updated valuesid
- the unique identifier of the role to update- Returns:
- the updated and saved
Role
instance - 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:
existsByUniqueProperties
in interfaceIGenericDAO<Role,
UUID> - Parameters:
role
- the role object whose uniqueness is to be verified- Returns:
true
if a role with the same name exists;false
otherwise or if input is invalid
-