Interface RoleRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Role,Long>, org.springframework.data.jpa.repository.JpaRepository<Role,Long>, org.springframework.data.repository.ListCrudRepository<Role,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<Role,Long>, org.springframework.data.repository.PagingAndSortingRepository<Role,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<Role>, org.springframework.data.querydsl.QuerydslPredicateExecutor<Role>, org.springframework.data.repository.Repository<Role,Long>

public interface RoleRepository extends org.springframework.data.jpa.repository.JpaRepository<Role,Long>, org.springframework.data.querydsl.QuerydslPredicateExecutor<Role>
Repository class to represent the data access layer of the `role` entity.
Author:
Infosys Equinox
  • Method Details

    • findAllBusinessLevelUserRolesByUserId

      @Query(value="select r_u.business_id as businessid, r_u.role_name as rolenames from user_role r_u where r_u.user_id = ?1", nativeQuery=true) List<RoleRepository.BusinessLevelRoleNamesProjection> findAllBusinessLevelUserRolesByUserId(Long userId)
    • findAllBusinessLevelGroupRolesByUserId

      @Query(value="select c.businessid as businessid, r.name as rolenames from collection c, role r, authgroup_role ag_r, authgroup_userids ag_u where c.id = r.collectionid and r.id = ag_r.roles_id and ag_u.userids = ?1", nativeQuery=true) List<RoleRepository.BusinessLevelRoleNamesProjection> findAllBusinessLevelGroupRolesByUserId(Long userId)
    • findAllRolesByUserIdAndCollectionId

      @Query(value="select p.id as privilegeid, p.entity as entity,p.service as service, p.action as action, r.id as roleid, r.collectionId as collectionid , c.businessId as businessId, r.name as name, r.description as description, r.category as category, r_us.userids as userid, r.createdBy as createdBy,r.updatedBy as updatedBy,r.createdTIMESTAMP as createdTimestamp,r.updatedTIMESTAMP as updatedTimestamp from (role r INNER JOIN collection c on c.id = r.collectionid and c.id in :collectionId) LEFT JOIN (user_role as r_us) on r_us.role_id = r.id LEFT JOIN (role_privilegeset r_ps INNER JOIN privilegeset_privilege ps_p INNER JOIN privilege p) on r_us.userids in :userId and r.collectionid in :collectionId and r_ps.role_id = r_us.role_id and ps_p.privilegeset_id = r_ps.privilegesets_id and ps_p.privileges_id = p.id", nativeQuery=true) List<RoleRepository.UserRoleProjection> findAllRolesByUserIdAndCollectionId(@Param("userId") List<Long> userId, @Param("collectionId") Long collectionId)
    • findAllBusinessRolesByUserIdAndCollectionId

      @Query(value="select r.id as roleid, r.collectionId as collectionid , c.businessId as businessId, r.name as name, r.description as description, r.category as category,r.createdBy as createdBy,r.updatedBy as updatedBy,r.createdTIMESTAMP as createdTimestamp,r.updatedTIMESTAMP as updatedTimestamp from role r,collection c,user_role r_us where c.id = r.collectionid and r_us.role_id = r.id and r_us.userids = :userId and r.collectionid=:collectionId", nativeQuery=true) List<RoleRepository.RoleBusinessIdProjection> findAllBusinessRolesByUserIdAndCollectionId(@Param("userId") Long userId, @Param("collectionId") Long collectionId)
      Find by user id and collection id and get all roles including business id.
      Parameters:
      userId - - The user id
      collectionId - - The collection id
      Returns:
      The list of RoleBusinessIdProjection object.
    • findBusinessRolesByUserIdAndCollectionId

      @Query(value="select r.id as roleid, r.collectionId as collectionid , c.businessId as businessId, r.name as name, r.description as description,r.createdBy as createdBy,r.updatedBy as updatedBy,r.createdTIMESTAMP as createdTimestamp,r.updatedTIMESTAMP as updatedTimestamp from role r,collection c,user_role r_us where c.id = r.collectionid and r_us.role_name = r.name and r_us.user_id = :userId and r.collectionid=:collectionId", nativeQuery=true) List<RoleRepository.RoleBusinessIdProjection> findBusinessRolesByUserIdAndCollectionId(@Param("userId") Long userId, @Param("collectionId") Long collectionId)
      Find by user id and collection id and get all roles including business id.
      Parameters:
      userId - - The user id
      collectionId - - The collection id
      Returns:
      The list of RoleBusinessIdProjection object.
    • findAll

      org.springframework.data.domain.Page<Role> findAll(org.springframework.data.jpa.domain.Specification<Role> getAllCollectionSpec, org.springframework.data.domain.Pageable pageRequest)
    • findByNameAndCollectionIdIn

      List<Role> findByNameAndCollectionIdIn(String roleName, List<Long> collectionId)
    • findByNameAndBusinessIdInAndCollectionIdIn

      Optional<Role> findByNameAndBusinessIdInAndCollectionIdIn(String roleName, List<Long> businessIds, List<Long> collectionIds)
    • findByNameIn

      @Query("SELECT p.id as privilegeId, p.entity as entity, p.service as service, p.action as action, r.type as type , r.name as roleName, r.businessId as businessId from role r LEFT JOIN r.privileges p where r.name in (:roleNames)") List<RoleRepository.SSOPrivilege> findByNameIn(@Param("roleNames") List<String> roleNames)