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 classAbstractChangeNotes.Argsstatic classAbstractChangeNotes.LoadHandle
-
Field Summary
Fields Modifier and Type Field Description protected AbstractChangeNotes.Argsargs
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractChangeNotes(AbstractChangeNotes.Args args, Change.Id changeId)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Change.IdgetChangeId()abstract Project.NameKeygetProjectName()protected abstract StringgetRefName()org.eclipse.jgit.lib.ObjectIdgetRevision()Tload()protected abstract voidloadDefaults()Load default values for any instance variables when NoteDb is disabled.org.eclipse.jgit.lib.ObjectIdloadRevision()protected abstract voidonLoad(AbstractChangeNotes.LoadHandle handle)Set up the metadata, parsing any state from the loaded revision.protected AbstractChangeNotes.LoadHandleopenHandle(org.eclipse.jgit.lib.Repository repo)Open a handle for reading this entity from a repository.protected AbstractChangeNotes.LoadHandleopenHandle(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.lib.ObjectId id)protected org.eclipse.jgit.lib.ObjectIdreadRef(org.eclipse.jgit.lib.Repository repo)Treload()protected Tself()
-
-
-
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:
NoSuchChangeExceptionIOExceptionorg.eclipse.jgit.errors.ConfigInvalidException
-
self
protected final T self()
-
-