Class AbstractChangeNotes<T>

java.lang.Object
com.google.gerrit.server.notedb.AbstractChangeNotes<T>
Direct Known Subclasses:
ChangeNotes, DraftCommentNotes, RobotCommentNotes

public abstract class AbstractChangeNotes<T> extends Object
View of contents at a single ref related to some change. *
  • Field Details

  • Constructor Details

  • Method Details

    • getChangeId

      public Change.Id getChangeId()
    • getRevision

      public org.eclipse.jgit.lib.ObjectId getRevision()
      Returns revision of the metadata that was loaded.
    • load

      public T load()
    • load

      public T load(org.eclipse.jgit.lib.Repository repo)
    • readRef

      protected org.eclipse.jgit.lib.ObjectId readRef(org.eclipse.jgit.lib.Repository repo) throws IOException
      Throws:
      IOException
    • openHandle

      protected AbstractChangeNotes.LoadHandle openHandle(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.lib.ObjectId id) throws NoSuchChangeException, IOException
      Open a handle for reading this entity from a repository.

      Implementations may override this method to provide auto-rebuilding behavior.

      Parameters:
      repo - open repository.
      id - SHA1 of the entity to read from the repository. The SHA1 is not sanity checked and is assumed to be valid. If null, lookup SHA1 from the /meta ref.
      Returns:
      handle for reading the entity.
      Throws:
      NoSuchChangeException - change does not exist.
      IOException - a repo-level error occurred.
    • reload

      public T reload()
    • loadRevision

      public org.eclipse.jgit.lib.ObjectId loadRevision()
    • loadDefaults

      protected abstract void loadDefaults()
      Load default values for any instance variables when NoteDb is disabled.
    • getProjectName

      public abstract Project.NameKey getProjectName()
      Returns the NameKey for the project where the notes should be stored, which is not necessarily the same as the change's project.
    • getRefName

      protected abstract String getRefName()
      Returns name of the reference storing this configuration.
    • onLoad

      protected abstract void onLoad(AbstractChangeNotes.LoadHandle handle) throws NoSuchChangeException, IOException, org.eclipse.jgit.errors.ConfigInvalidException
      Set up the metadata, parsing any state from the loaded revision.
      Throws:
      NoSuchChangeException
      IOException
      org.eclipse.jgit.errors.ConfigInvalidException
    • self

      protected final T self()