Interface GroupRepository

    • Method Detail

      • getAllIds

        @Query("SELECT g.id FROM GroupEntity g")
        List<String> getAllIds()
      • getGroupsForGroupsByAccessRights

        @Query("SELECT NEW EntitlementsDBWrapper(group.id, r.id, group.name,ug.memberEntity.id,ug.startDate,ug.endDate, ug.description ) FROM GroupToGroupMembershipXrefEntity ug JOIN ug.rights as r  JOIN ug.entity as group WHERE ug.memberEntity.id IN (:groupIds) and r.id IN (:accessRightIds)")
        List<EntitlementsDBWrapper> getGroupsForGroupsByAccessRights​(@Param("groupIds")
                                                                     List<String> groupIds,
                                                                     @Param("accessRightIds")
                                                                     List<String> accessRightIds)
      • getGroupsForRolesByAccessRights

        @Query("SELECT NEW EntitlementsDBWrapper(group.id, r.id, group.name,ug.entity.id,ug.startDate,ug.endDate, ug.description ) FROM RoleToGroupMembershipXrefEntity ug JOIN ug.rights as r  JOIN ug.memberEntity as group WHERE ug.entity.id IN (:roleIds) and r.id IN (:accessRightIds)")
        List<EntitlementsDBWrapper> getGroupsForRolesByAccessRights​(@Param("roleIds")
                                                                    List<String> roleIds,
                                                                    @Param("accessRightIds")
                                                                    List<String> accessRightIds)
      • getDetachedForUser

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

        @Query("SELECT count(m) FROM UserToGroupMembershipXrefEntity m join m.entity r join m.memberEntity u WHERE r.id=:groupId and u.id=:userId")
        int doesUserLinkedWithGroup​(@Param("groupId")
                                    String groupId,
                                    @Param("userId")
                                    String userId)
      • numberOfUsersForGroups

        @Query("SELECT new CountXrefDBWrapper (g.id, count(distinct u.id), g.maxUserNumber, \'Group\') FROM GroupEntity g left join g.users u WHERE g.id in (:groupIds) group by g.id, g.maxUserNumber")
        List<CountXrefDBWrapper> numberOfUsersForGroups​(@Param("groupIds")
                                                        Collection<String> groupIds)
      • numberOfUsersForAllGroups

        @Query("SELECT new CountXrefDBWrapper (g.id, count(distinct u.id), g.maxUserNumber, \'Group\') FROM GroupEntity g left join g.users u group by g.id, g.maxUserNumber")
        List<CountXrefDBWrapper> numberOfUsersForAllGroups()
      • collectPolicyIdsByGroupIds

        @Query("SELECT g.policy.id FROM GroupEntity g WHERE g.id IN :ids")
        Set<String> collectPolicyIdsByGroupIds​(@Param("ids")
                                               Collection<String> ids)