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 Details

    • isStarred

      public boolean isStarred(Account.Id accountId, Change.Id changeId)
      Description copied from interface: StarredChangesReader
      Checks if a specific change is starred by a given user.
      Specified by:
      isStarred in interface StarredChangesReader
      Parameters:
      accountId - the Account.Id.
      changeId - the Change.Id.
      Returns:
      true if the change is starred by the user, false otherwise.
    • star

      public void star(Account.Id accountId, Change.Id changeId)
      Description copied from interface: StarredChangesWriter
      Star the given change for a single Account.Id.
      Specified by:
      star in interface StarredChangesWriter
      Parameters:
      accountId - the Account.Id.
      changeId - the Change.Id.
    • unstar

      public void unstar(Account.Id accountId, Change.Id changeId)
      Description copied from interface: StarredChangesWriter
      Unstar the given change for a single Account.Id.
      Specified by:
      unstar in interface StarredChangesWriter
      Parameters:
      accountId - the Account.Id.
      changeId - the Change.Id.
    • areStarred

      public Set<Change.Id> areStarred(org.eclipse.jgit.lib.Repository allUsersRepo, List<Change.Id> changeIds, Account.Id caller)
      Description copied from interface: StarredChangesReader
      Returns a subset of Change.Ids among the input changeIds list that are starred by the caller user.
      Specified by:
      areStarred in interface StarredChangesReader
      Parameters:
      allUsersRepo - 'All-Users' repository.
      changeIds - the list of Change.Ids to check.
      caller - the Account.Id to check starred changes by a user.
      Returns:
      a set of Change.Ids that are starred by the specified user.
    • unstarAllForChangeDeletion

      public void unstarAllForChangeDeletion(Change.Id changeId) throws IOException
      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 interface StarredChangesWriter
      Parameters:
      changeId - change ID.
      Throws:
      IOException - if an error occurred.
    • byChange

      public com.google.common.collect.ImmutableList<Account.Id> byChange(Change.Id changeId)
      Description copied from interface: StarredChangesReader
      Retrieves a list of Account.Id which starred a Change.Id.
      Specified by:
      byChange in interface StarredChangesReader
      Parameters:
      changeId - the Change.Id.
      Returns:
      an immutable list of Account.Ids for the specified change.
    • byAccountId

      public com.google.common.collect.ImmutableSet<Change.Id> byAccountId(Account.Id accountId)
      Description copied from interface: StarredChangesReader
      Retrieves a set of changeIds starred by Account.Id.
      Specified by:
      byAccountId in interface StarredChangesReader
      Parameters:
      accountId - the Account.Id.
      Returns:
      an immutable set of Change.Ids 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 of Change.Ids associated with the specified user account, optionally skipping invalid changes.
      Specified by:
      byAccountId in interface StarredChangesReader
      Parameters:
      accountId - the Account.Id.
      skipInvalidChanges - true to skip invalid changes, false otherwise.
      Returns:
      an immutable set of Change.Ids associated with the specified user account.