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
public abstract class AbstractChangeNotes<T> extends Object
View of contents at a single ref related to some change. *
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractChangeNotes.Args
static class
AbstractChangeNotes.LoadHandle
-
Field Summary
Fields Modifier and Type Field Description protected AbstractChangeNotes.Args
args
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractChangeNotes(AbstractChangeNotes.Args args, Change.Id changeId)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Change.Id
getChangeId()
abstract Project.NameKey
getProjectName()
protected abstract String
getRefName()
org.eclipse.jgit.lib.ObjectId
getRevision()
T
load()
protected abstract void
loadDefaults()
Load default values for any instance variables when NoteDb is disabled.org.eclipse.jgit.lib.ObjectId
loadRevision()
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)
Open a handle for reading this entity from a repository.protected AbstractChangeNotes.LoadHandle
openHandle(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.lib.ObjectId id)
protected org.eclipse.jgit.lib.ObjectId
readRef(org.eclipse.jgit.lib.Repository repo)
T
reload()
protected T
self()
-
-
-
Field Detail
-
args
protected final AbstractChangeNotes.Args args
-
-
Constructor Detail
-
AbstractChangeNotes
protected AbstractChangeNotes(AbstractChangeNotes.Args args, Change.Id changeId)
-
-
Method Detail
-
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()
-
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) 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.- Returns:
- handle for reading the entity.
- Throws:
NoSuchChangeException
- change does not exist.IOException
- a repo-level error occurred.
-
openHandle
protected AbstractChangeNotes.LoadHandle openHandle(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.lib.ObjectId id)
-
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()
-
-