Package com.google.gerrit.server.notedb
Class AbstractChangeNotes<T>
java.lang.Object
com.google.gerrit.server.notedb.AbstractChangeNotes<T>
- Direct Known Subclasses:
ChangeNotes
,DraftCommentNotes
,RobotCommentNotes
View of contents at a single ref related to some change. *
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
AnAutoCloseable
for parsing a single commit into ChangeNotesCommits. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractChangeNotes
(AbstractChangeNotes.Args args, Change.Id changeId) protected
AbstractChangeNotes
(AbstractChangeNotes.Args args, Change.Id changeId, org.eclipse.jgit.lib.ObjectId metaSha1) -
Method Summary
Modifier and TypeMethodDescriptionabstract Project.NameKey
Returns the NameKey for the project where the notes should be stored, which is not necessarily the same as the change's project.protected abstract String
Returns name of the reference storing this configuration.org.eclipse.jgit.lib.ObjectId
Returns revision of the metadata that was loaded.load()
load
(org.eclipse.jgit.lib.Repository repo) protected abstract void
Load default values for any instance variables when NoteDb is disabled.org.eclipse.jgit.lib.ObjectId
protected abstract void
onLoad
(AbstractChangeNotes.LoadHandle handle) Set up the metadata, parsing any state from the loaded revision.protected AbstractChangeNotes.LoadHandle
openHandle
(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.lib.ObjectId id) Open a handle for reading this entity from a repository.protected org.eclipse.jgit.lib.ObjectId
readRef
(org.eclipse.jgit.lib.Repository repo) reload()
protected final T
self()
-
Field Details
-
args
-
-
Constructor Details
-
AbstractChangeNotes
protected AbstractChangeNotes(AbstractChangeNotes.Args args, Change.Id changeId, org.eclipse.jgit.lib.ObjectId metaSha1) -
AbstractChangeNotes
-
-
Method Details
-
getChangeId
-
getRevision
public org.eclipse.jgit.lib.ObjectId getRevision()Returns revision of the metadata that was loaded. -
load
-
load
-
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
-
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
Returns the NameKey for the project where the notes should be stored, which is not necessarily the same as the change's project. -
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
-