Package com.google.gerrit.server.notedb
Class ChangeNotes
- java.lang.Object
-
- com.google.gerrit.server.notedb.AbstractChangeNotes<ChangeNotes>
-
- com.google.gerrit.server.notedb.ChangeNotes
-
public class ChangeNotes extends AbstractChangeNotes<ChangeNotes>
View of a singleChange
based on the log of its notes branch.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ChangeNotes.Factory
-
Nested classes/interfaces inherited from class com.google.gerrit.server.notedb.AbstractChangeNotes
AbstractChangeNotes.Args, AbstractChangeNotes.LoadHandle
-
-
Field Summary
Fields Modifier and Type Field Description static com.google.common.collect.Ordering<ChangeMessage>
MESSAGE_BY_TIME
-
Fields inherited from class com.google.gerrit.server.notedb.AbstractChangeNotes
args, autoRebuild, primaryStorage
-
-
Constructor Summary
Constructors Constructor Description ChangeNotes(AbstractChangeNotes.Args args, Change change)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsComment(Comment c)
boolean
containsCommentPublished(Comment c)
com.google.common.collect.ImmutableList<Account.Id>
getAllPastReviewers()
com.google.common.collect.ImmutableListMultimap<PatchSet.Id,PatchSetApproval>
getApprovals()
Change
getChange()
com.google.common.collect.ImmutableList<ChangeMessage>
getChangeMessages()
com.google.common.collect.ImmutableSet<Comment.Key>
getCommentKeys()
com.google.common.collect.ImmutableListMultimap<RevId,Comment>
getComments()
PatchSet
getCurrentPatchSet()
com.google.common.collect.ImmutableListMultimap<RevId,Comment>
getDraftComments(Account.Id author)
com.google.common.collect.ImmutableListMultimap<RevId,Comment>
getDraftComments(Account.Id author, org.eclipse.jgit.lib.Ref ref)
com.google.common.collect.ImmutableSet<String>
getHashtags()
org.eclipse.jgit.lib.ObjectId
getMetaId()
com.google.common.collect.ImmutableSet<Account.Id>
getPastAssignees()
com.google.common.collect.ImmutableSortedMap<PatchSet.Id,PatchSet>
getPatchSets()
ReviewerSet
getPendingReviewers()
ReviewerByEmailSet
getPendingReviewersByEmail()
Project.NameKey
getProjectName()
Timestamp
getReadOnlyUntil()
String
getRefName()
ReviewerSet
getReviewers()
ReviewerByEmailSet
getReviewersByEmail()
com.google.common.collect.ImmutableList<ReviewerStatusUpdate>
getReviewerUpdates()
RobotCommentNotes
getRobotCommentNotes()
com.google.common.collect.ImmutableListMultimap<RevId,RobotComment>
getRobotComments()
com.google.common.collect.ImmutableList<SubmitRecord>
getSubmitRecords()
protected void
loadDefaults()
Load default values for any instance variables when NoteDb is disabled.protected 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.static org.eclipse.jgit.errors.ConfigInvalidException
parseException(Change.Id changeId, String fmt, Object... args)
static Change
readOneReviewDbChange(ReviewDb db, Change.Id id)
protected org.eclipse.jgit.lib.ObjectId
readRef(org.eclipse.jgit.lib.Repository repo)
-
Methods inherited from class com.google.gerrit.server.notedb.AbstractChangeNotes
getChangeId, getRevision, load, loadRevision, openHandle, reload, self
-
-
-
-
Field Detail
-
MESSAGE_BY_TIME
public static final com.google.common.collect.Ordering<ChangeMessage> MESSAGE_BY_TIME
-
-
Constructor Detail
-
ChangeNotes
public ChangeNotes(AbstractChangeNotes.Args args, Change change)
-
-
Method Detail
-
parseException
public static org.eclipse.jgit.errors.ConfigInvalidException parseException(Change.Id changeId, String fmt, Object... args)
-
readOneReviewDbChange
public static Change readOneReviewDbChange(ReviewDb db, Change.Id id) throws com.google.gwtorm.server.OrmException
- Throws:
com.google.gwtorm.server.OrmException
-
getChange
public Change getChange()
-
getMetaId
public org.eclipse.jgit.lib.ObjectId getMetaId()
-
getPatchSets
public com.google.common.collect.ImmutableSortedMap<PatchSet.Id,PatchSet> getPatchSets()
-
getApprovals
public com.google.common.collect.ImmutableListMultimap<PatchSet.Id,PatchSetApproval> getApprovals()
-
getReviewers
public ReviewerSet getReviewers()
-
getReviewersByEmail
public ReviewerByEmailSet getReviewersByEmail()
- Returns:
- reviewers that do not currently have a Gerrit account and were added by email.
-
getPendingReviewers
public ReviewerSet getPendingReviewers()
- Returns:
- reviewers that were modified during this change's current WIP phase.
-
getPendingReviewersByEmail
public ReviewerByEmailSet getPendingReviewersByEmail()
- Returns:
- reviewers by email that were modified during this change's current WIP phase.
-
getReviewerUpdates
public com.google.common.collect.ImmutableList<ReviewerStatusUpdate> getReviewerUpdates()
-
getPastAssignees
public com.google.common.collect.ImmutableSet<Account.Id> getPastAssignees()
- Returns:
- an ImmutableSet of Account.Ids of all users that have been assigned to this change.
-
getHashtags
public com.google.common.collect.ImmutableSet<String> getHashtags()
- Returns:
- a ImmutableSet of all hashtags for this change sorted in alphabetical order.
-
getAllPastReviewers
public com.google.common.collect.ImmutableList<Account.Id> getAllPastReviewers()
- Returns:
- a list of all users who have ever been a reviewer on this change.
-
getSubmitRecords
public com.google.common.collect.ImmutableList<SubmitRecord> getSubmitRecords()
- Returns:
- submit records stored during the most recent submit; only for changes that were actually submitted.
-
getChangeMessages
public com.google.common.collect.ImmutableList<ChangeMessage> getChangeMessages()
- Returns:
- all change messages, in chronological order, oldest first.
-
getComments
public com.google.common.collect.ImmutableListMultimap<RevId,Comment> getComments()
- Returns:
- inline comments on each revision.
-
getCommentKeys
public com.google.common.collect.ImmutableSet<Comment.Key> getCommentKeys()
-
getDraftComments
public com.google.common.collect.ImmutableListMultimap<RevId,Comment> getDraftComments(Account.Id author) throws com.google.gwtorm.server.OrmException
- Throws:
com.google.gwtorm.server.OrmException
-
getDraftComments
public com.google.common.collect.ImmutableListMultimap<RevId,Comment> getDraftComments(Account.Id author, org.eclipse.jgit.lib.Ref ref) throws com.google.gwtorm.server.OrmException
- Throws:
com.google.gwtorm.server.OrmException
-
getRobotComments
public com.google.common.collect.ImmutableListMultimap<RevId,RobotComment> getRobotComments() throws com.google.gwtorm.server.OrmException
- Throws:
com.google.gwtorm.server.OrmException
-
getRobotCommentNotes
public RobotCommentNotes getRobotCommentNotes()
-
containsComment
public boolean containsComment(Comment c) throws com.google.gwtorm.server.OrmException
- Throws:
com.google.gwtorm.server.OrmException
-
containsCommentPublished
public boolean containsCommentPublished(Comment c)
-
getRefName
public String getRefName()
- Specified by:
getRefName
in classAbstractChangeNotes<ChangeNotes>
- Returns:
- name of the reference storing this configuration.
-
getCurrentPatchSet
public PatchSet getCurrentPatchSet()
-
getReadOnlyUntil
public Timestamp getReadOnlyUntil()
-
onLoad
protected void onLoad(AbstractChangeNotes.LoadHandle handle) throws NoSuchChangeException, IOException, org.eclipse.jgit.errors.ConfigInvalidException
Description copied from class:AbstractChangeNotes
Set up the metadata, parsing any state from the loaded revision.- Specified by:
onLoad
in classAbstractChangeNotes<ChangeNotes>
- Throws:
NoSuchChangeException
IOException
org.eclipse.jgit.errors.ConfigInvalidException
-
loadDefaults
protected void loadDefaults()
Description copied from class:AbstractChangeNotes
Load default values for any instance variables when NoteDb is disabled.- Specified by:
loadDefaults
in classAbstractChangeNotes<ChangeNotes>
-
getProjectName
public Project.NameKey getProjectName()
- Specified by:
getProjectName
in classAbstractChangeNotes<ChangeNotes>
- Returns:
- the NameKey for the project where the notes should be stored, which is not necessarily the same as the change's project.
-
readRef
protected org.eclipse.jgit.lib.ObjectId readRef(org.eclipse.jgit.lib.Repository repo) throws IOException
- Overrides:
readRef
in classAbstractChangeNotes<ChangeNotes>
- Throws:
IOException
-
openHandle
protected AbstractChangeNotes.LoadHandle openHandle(org.eclipse.jgit.lib.Repository repo) throws NoSuchChangeException, IOException
Description copied from class:AbstractChangeNotes
Open a handle for reading this entity from a repository.Implementations may override this method to provide auto-rebuilding behavior.
- Overrides:
openHandle
in classAbstractChangeNotes<ChangeNotes>
- Parameters:
repo
- open repository.- Returns:
- handle for reading the entity.
- Throws:
NoSuchChangeException
- change does not exist.IOException
- a repo-level error occurred.
-
-