Package com.google.gerrit.server.notedb
Class StarredChangesUtilNoteDbImpl
java.lang.Object
com.google.gerrit.server.notedb.StarredChangesUtilNoteDbImpl
- All Implemented Interfaces:
StarredChangesReader
,StarredChangesWriter
public class StarredChangesUtilNoteDbImpl
extends Object
implements StarredChangesReader, StarredChangesWriter
-
Method Summary
Modifier and TypeMethodDescriptionareStarred
(org.eclipse.jgit.lib.Repository allUsersRepo, List<Change.Id> virtualIds, Account.Id caller) Returns a subset ofChange.Id
s among the inputchangeIds
list that are starred by thecaller
user.com.google.common.collect.ImmutableSet
<Change.Id> byAccountId
(Account.Id accountId) Retrieves a set ofchangeIds
starred byAccount.Id
.com.google.common.collect.ImmutableSet
<Change.Id> byAccountId
(Account.Id accountId, boolean skipInvalidChanges) Retrieves a set ofChange.Id
s associated with the specified user account, optionally skipping invalid changes.com.google.common.collect.ImmutableList
<Account.Id> Retrieves a list ofAccount.Id
which starred aChange.Id
.boolean
isStarred
(Account.Id accountId, Change.Id virtualId) Checks if a specific change is starred by a given user.void
star
(Account.Id accountId, Change.Id virtualId) Star the given change for a singleAccount.Id
.void
unstar
(Account.Id accountId, Change.Id virtualId) Unstar the given change for a singleAccount.Id
.void
unstarAllForChangeDeletion
(Change.Id virtualId) Unstar the given change for all users.
-
Method Details
-
isStarred
Description copied from interface:StarredChangesReader
Checks if a specific change is starred by a given user.- Specified by:
isStarred
in interfaceStarredChangesReader
- Parameters:
accountId
- theAccount.Id
.virtualId
- theChange.Id
.- Returns:
true
if the change is starred by the user,false
otherwise.
-
star
Description copied from interface:StarredChangesWriter
Star the given change for a singleAccount.Id
.- Specified by:
star
in interfaceStarredChangesWriter
- Parameters:
accountId
- theAccount.Id
.virtualId
- theChange.Id
.
-
unstar
Description copied from interface:StarredChangesWriter
Unstar the given change for a singleAccount.Id
.- Specified by:
unstar
in interfaceStarredChangesWriter
- Parameters:
accountId
- theAccount.Id
.virtualId
- theChange.Id
.
-
areStarred
public Set<Change.Id> areStarred(org.eclipse.jgit.lib.Repository allUsersRepo, List<Change.Id> virtualIds, Account.Id caller) Description copied from interface:StarredChangesReader
Returns a subset ofChange.Id
s among the inputchangeIds
list that are starred by thecaller
user.- Specified by:
areStarred
in interfaceStarredChangesReader
- Parameters:
allUsersRepo
- 'All-Users' repository.virtualIds
- the list ofChange.Id
s to check.caller
- theAccount.Id
to check starred changes by a user.- Returns:
- a set of
Change.Id
s that are starred by the specified user.
-
unstarAllForChangeDeletion
Description copied from interface:StarredChangesWriter
Unstar the given change for all users.Intended for use only when we're about to delete a change. For that reason, the change is not reindexed.
- Specified by:
unstarAllForChangeDeletion
in interfaceStarredChangesWriter
- Parameters:
virtualId
- change ID.- Throws:
IOException
- if an error occurred.
-
byChange
Description copied from interface:StarredChangesReader
Retrieves a list ofAccount.Id
which starred aChange.Id
.- Specified by:
byChange
in interfaceStarredChangesReader
- Parameters:
virtualId
- theChange.Id
.- Returns:
- an immutable list of
Account.Id
s for the specified change.
-
byAccountId
Description copied from interface:StarredChangesReader
Retrieves a set ofchangeIds
starred byAccount.Id
.- Specified by:
byAccountId
in interfaceStarredChangesReader
- Parameters:
accountId
- theAccount.Id
.- Returns:
- an immutable set of
Change.Id
s associated with the specified user account.
-
byAccountId
public com.google.common.collect.ImmutableSet<Change.Id> byAccountId(Account.Id accountId, boolean skipInvalidChanges) Description copied from interface:StarredChangesReader
Retrieves a set ofChange.Id
s associated with the specified user account, optionally skipping invalid changes.- Specified by:
byAccountId
in interfaceStarredChangesReader
- Parameters:
accountId
- theAccount.Id
.skipInvalidChanges
-true
to skip invalid changes,false
otherwise.- Returns:
- an immutable set of
Change.Id
s associated with the specified user account.
-