Interface AnnouncementUserJoinRepository
-
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<AnnouncementUserJoin,java.lang.Long>
,org.springframework.data.jpa.repository.JpaSpecificationExecutor<AnnouncementUserJoin>
,org.springframework.data.repository.PagingAndSortingRepository<AnnouncementUserJoin,java.lang.Long>
,org.springframework.data.repository.Repository<AnnouncementUserJoin,java.lang.Long>
public interface AnnouncementUserJoinRepository extends org.springframework.data.repository.PagingAndSortingRepository<AnnouncementUserJoin,java.lang.Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<AnnouncementUserJoin>
Repository for managingAnnouncementUserJoin
s
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Long
countUsersForAnnouncement(Announcement announcement)
Count how manyUser
s have read a specificAnnouncement
java.util.List<AnnouncementUserReadDetails>
getAnnouncementsForUser(User user)
Get a collection of theAnnouncement
s related to aUser
, meaning the collection ofAnnouncement
s read and unread by theUser
java.util.List<AnnouncementUserJoin>
getAnnouncementsReadByUser(User user)
Get a collection of theAnnouncement
s related to aUser
, meaning the collection ofAnnouncement
s marked as read by theUser
java.util.List<Announcement>
getAnnouncementsUnreadByUser(User user)
Gets a collection ofAnnouncement
s that have not been marked as read by theUser
.AnnouncementUserJoin
getAnnouncementUserJoin(Announcement announcement, User user)
java.util.List<AnnouncementUserJoin>
getUsersByAnnouncementRead(Announcement announcement)
Get a collection of theUser
s that have read anAnnouncement
java.util.List<User>
getUsersByAnnouncementUnread(Announcement announcement)
Get a collection of theUser
s that have not read anAnnouncement
-
Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAllById, findById, save, saveAll
-
-
-
-
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 theAnnouncement
s related to aUser
, meaning the collection ofAnnouncement
s read and unread by theUser
- Parameters:
user
- TheUser
to get read and unread announcements for- Returns:
- A collection of
AnnouncementUserReadDetails
s 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 theAnnouncement
s related to aUser
, meaning the collection ofAnnouncement
s marked as read by theUser
- Parameters:
user
- TheUser
to get read announcements for- Returns:
- A collection of
AnnouncementUserJoin
s 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 ofAnnouncement
s that have not been marked as read by theUser
.- Parameters:
user
- TheUser
for which we want to fetch all unreadAnnouncement
s- Returns:
- List of
Announcement
s unread by the user
-
getAnnouncementUserJoin
@Query("select j from AnnouncementUserJoin j where j.announcement = ?1 and j.user = ?2") AnnouncementUserJoin getAnnouncementUserJoin(Announcement announcement, User user)
- Parameters:
announcement
- TheAnnouncement
user
- TheAnnouncement
to get list of users that have read it- Returns:
AnnouncementUserJoin
described by the announcement/user pair
-
getUsersByAnnouncementRead
@Query("select j from AnnouncementUserJoin j where j.announcement = ?1") java.util.List<AnnouncementUserJoin> getUsersByAnnouncementRead(Announcement announcement)
Get a collection of theUser
s that have read anAnnouncement
- Parameters:
announcement
- TheAnnouncement
to get list of users that have read it- Returns:
- A collection of
AnnouncementUserJoin
s 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 theUser
s that have not read anAnnouncement
- Parameters:
announcement
- TheAnnouncement
to get list of users that have not read it- Returns:
- A collection of
AnnouncementUserJoin
s 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 manyUser
s have read a specificAnnouncement
- Parameters:
announcement
- TheAnnouncement
for which we want to count the number of users- Returns:
- count of
User
s that have read the announcement
-
-