Interface RoleRepository

    • Method Detail

      • findByManagedSystemId

        @Query("SELECT m FROM RoleEntity m WHERE m.managedSystem.id = :managedSysId")
        List<RoleEntity> findByManagedSystemId​(@Param("managedSysId")
                                               String managedSysId)
      • getAllIds

        @Query("SELECT m.id FROM RoleEntity m")
        List<String> getAllIds()
      • getDetachedForUser

        @Query("SELECT m FROM RoleEntity m JOIN m.users u  WHERE lower (m.name) LIKE lower(concat(\'%\', :name,\'%\'))  AND  u.memberEntity.id=:userId AND m.resources is empty order by m.name")
        org.springframework.data.domain.Page<RoleEntity> getDetachedForUser​(@Param("userId")
                                                                            String userId,
                                                                            @Param("name")
                                                                            String name,
                                                                            org.springframework.data.domain.Pageable page)
        method is used to detect all user's role that are not linked with any resources.
        Specified by:
        getDetachedForUser in interface IDetacheableEntityRepository<RoleEntity,​String>
        Parameters:
        userId - - id of User to check detached roles
        name - - name for case INSENSITIVE CONTAINS match search.
        page - - Pageable for paging
        Returns:
        - Page with results;
      • doesUserLinkedWithRole

        @Query("SELECT count(m) FROM UserToRoleMembershipXrefEntity m join m.entity r join m.memberEntity u WHERE r.id=:roleId and u.id=:userId")
        int doesUserLinkedWithRole​(@Param("roleId")
                                   String roleId,
                                   @Param("userId")
                                   String userId)
      • numberOfUsersForRoles

        @Query("SELECT new CountXrefDBWrapper (r.id, count(distinct u.id), r.maxUserNumber, \'Role\') FROM RoleEntity r left join r.users u WHERE r.id in (:roleIds)  group by r.id, r.maxUserNumber")
        List<CountXrefDBWrapper> numberOfUsersForRoles​(@Param("roleIds")
                                                       Collection<String> roleIds)
      • numberOfUsersForAllRoles

        @Query("SELECT new CountXrefDBWrapper (r.id, count(distinct u.id), r.maxUserNumber, \'Role\') FROM RoleEntity r left join r.users u  group by r.id, r.maxUserNumber")
        List<CountXrefDBWrapper> numberOfUsersForAllRoles()
      • collectPolicyIdsByRoleIds

        @Query("SELECT r.policy.id FROM RoleEntity r WHERE r.id IN :ids")
        Set<String> collectPolicyIdsByRoleIds​(@Param("ids")
                                              Collection<String> ids)