Interface AnnouncementUserJoinRepository

    • Method Detail

      • getAnnouncementsForUser

        @Query("select new ca.corefacility.bioinformatics.irida.ria.web.announcements.dto.AnnouncementUserReadDetails(a.id, a.title, a.priority, a.createdDate, j.createdDate) from Announcement a left join AnnouncementUserJoin j on a.id = j.announcement.id and j.user = ?1")
        java.util.List<AnnouncementUserReadDetails> getAnnouncementsForUser​(User user)
        Get a collection of the Announcements related to a User, meaning the collection of Announcements read and unread by the User
        Parameters:
        user - The User to get read and unread announcements for
        Returns:
        A collection of AnnouncementUserReadDetailss representing the read and unread announcements for a user
      • getAnnouncementsReadByUser

        @Query("select j from AnnouncementUserJoin j where j.user = ?1")
        java.util.List<AnnouncementUserJoin> getAnnouncementsReadByUser​(User user)
        Get a collection of the Announcements related to a User, meaning the collection of Announcements marked as read by the User
        Parameters:
        user - The User to get read announcements for
        Returns:
        A collection of AnnouncementUserJoins describing the link between announcement and user
      • getAnnouncementsUnreadByUser

        @Query("select a from Announcement a where a not in (select j.announcement from AnnouncementUserJoin j where j.user = ?1)")
        java.util.List<Announcement> getAnnouncementsUnreadByUser​(User user)
        Gets a collection of Announcements that have not been marked as read by the User.
        Parameters:
        user - The User for which we want to fetch all unread Announcements
        Returns:
        List of Announcements unread by the user
      • getUsersByAnnouncementRead

        @Query("select j from AnnouncementUserJoin j where j.announcement = ?1")
        java.util.List<AnnouncementUserJoin> getUsersByAnnouncementRead​(Announcement announcement)
        Get a collection of the Users that have read an Announcement
        Parameters:
        announcement - The Announcement to get list of users that have read it
        Returns:
        A collection of AnnouncementUserJoins describing the link between announcement and user
      • getUsersByAnnouncementUnread

        @Query("select u from User u where u not in (select j.user from AnnouncementUserJoin j where j.announcement = ?1)")
        java.util.List<User> getUsersByAnnouncementUnread​(Announcement announcement)
        Get a collection of the Users that have not read an Announcement
        Parameters:
        announcement - The Announcement to get list of users that have not read it
        Returns:
        A collection of AnnouncementUserJoins describing the link between announcement and user
      • countUsersForAnnouncement

        @Query("select count (j.id) from AnnouncementUserJoin j where j.announcement = ?1")
        java.lang.Long countUsersForAnnouncement​(Announcement announcement)
        Count how many Users have read a specific Announcement
        Parameters:
        announcement - The Announcement for which we want to count the number of users
        Returns:
        count of Users that have read the announcement