Package com.alpaca.persistence.impl
Class PermissionDAOImpl
java.lang.Object
com.alpaca.persistence.impl.GenericDAOImpl<Permission,UUID>
com.alpaca.persistence.impl.PermissionDAOImpl
- All Implemented Interfaces:
IGenericDAO<Permission,
,UUID> IPermissionDAO
@Component
public class PermissionDAOImpl
extends GenericDAOImpl<Permission,UUID>
implements IPermissionDAO
Implementation of the
IPermissionDAO
interface for managing Permission
entities.
Extends the generic DAO implementation (GenericDAOImpl
) to provide standard CRUD
operations and permission-specific persistence logic.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
existsByUniqueProperties
(Permission permission) Determines whether a permission with the same name already exists.findByPermissionName
(String permissionName) Searches for aPermission
entity by its permission name.protected Class
<Permission> Returns thePermission
entity class managed by this DAO.protected GenericRepo
<Permission, UUID> getRepo()
Provides the repository used by the generic DAO framework.updateById
(Permission permission, UUID id) Updates an existingPermission
identified by the given ID with the non-null and non-blank values from the providedpermission
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
-
-
Constructor Details
-
PermissionDAOImpl
public PermissionDAOImpl()
-
-
Method Details
-
getRepo
Provides the repository used by the generic DAO framework.- Specified by:
getRepo
in classGenericDAOImpl<Permission,
UUID> - Returns:
- the
GenericRepo
forPermission
-
getEntity
Returns thePermission
entity class managed by this DAO.- Specified by:
getEntity
in classGenericDAOImpl<Permission,
UUID> - Returns:
Permission.class
-
updateById
Updates an existingPermission
identified by the given ID with the non-null and non-blank values from the providedpermission
object. Only changed fields are applied. Throws aNotFoundException
if no matching entity is found.- Specified by:
updateById
in interfaceIGenericDAO<Permission,
UUID> - Parameters:
permission
- the permission object containing updated valuesid
- the unique identifier of the permission to update- Returns:
- the updated and saved
Permission
instance - Throws:
NotFoundException
- if no permission exists with the specified ID
-
existsByUniqueProperties
Determines whether a permission with the same name already exists.- Specified by:
existsByUniqueProperties
in interfaceIGenericDAO<Permission,
UUID> - Parameters:
permission
- the permission to check; its name must be non-null and non-blank- Returns:
true
if a permission with the same name exists;false
otherwise
-
findByPermissionName
Searches for aPermission
entity by its permission name.- Specified by:
findByPermissionName
in interfaceIPermissionDAO
- Parameters:
permissionName
- the name of the permission to search for; may be null or blank- Returns:
- an
Optional
containing the found permission, or empty if none found
-