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 inherited from class com.google.gerrit.server.notedb.AbstractChangeNotes
args
-
-
Constructor Summary
Constructors Constructor Description ChangeNotes(AbstractChangeNotes.Args args, Change change, boolean shouldExist, RefCache refs)
ChangeNotes(AbstractChangeNotes.Args args, Change change, boolean shouldExist, RefCache refs, org.eclipse.jgit.lib.ObjectId metaSha1)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsComment(HumanComment c)
boolean
containsCommentPublished(Comment c)
com.google.common.collect.ImmutableList<Account.Id>
getAllPastReviewers()
Returns a list of all users who have ever been a reviewer on this change.PatchSetApprovals
getApprovals()
Gets the approvals of all patch sets.com.google.common.collect.ImmutableList<AssigneeStatusUpdate>
getAssigneeUpdates()
Returns an ImmutableList of AssigneeStatusUpdate of all the updates to the assignee field to this change.com.google.common.collect.ImmutableSet<AttentionSetUpdate>
getAttentionSet()
Returns the most recent update (i.e.com.google.common.collect.ImmutableList<AttentionSetUpdate>
getAttentionSetUpdates()
Returns all updates for the attention set.Change
getChange()
com.google.common.collect.ImmutableList<ChangeMessage>
getChangeMessages()
Returns all change messages, in chronological order, oldest first.com.google.common.collect.ImmutableSet<Comment.Key>
getCommentKeys()
PatchSet
getCurrentPatchSet()
com.google.common.collect.ImmutableListMultimap<org.eclipse.jgit.lib.ObjectId,HumanComment>
getDraftComments(Account.Id author)
com.google.common.collect.ImmutableListMultimap<org.eclipse.jgit.lib.ObjectId,HumanComment>
getDraftComments(Account.Id author, org.eclipse.jgit.lib.Ref ref)
com.google.common.collect.ImmutableSet<String>
getHashtags()
Returns an ImmutableSet of all hashtags for this change sorted in alphabetical order.com.google.common.collect.ImmutableListMultimap<org.eclipse.jgit.lib.ObjectId,HumanComment>
getHumanComments()
Returns inline comments on each revision.Optional<Instant>
getMergedOn()
ReturnsOptional
value of time when the change was merged.org.eclipse.jgit.lib.ObjectId
getMetaId()
com.google.common.collect.ImmutableSet<Account.Id>
getPastAssignees()
Returns an ImmutableSet of Account.Ids of all users that have been assigned to this change.com.google.common.collect.ImmutableSortedMap<PatchSet.Id,PatchSet>
getPatchSets()
ReviewerSet
getPendingReviewers()
Returns reviewers that were modified during this change's current WIP phase.ReviewerByEmailSet
getPendingReviewersByEmail()
Returns reviewers by email that were modified during this change's current WIP phase.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.String
getRefName()
Returns name of the reference storing this configuration.ReviewerSet
getReviewers()
ReviewerByEmailSet
getReviewersByEmail()
Returns reviewers that do not currently have a Gerrit account and were added by email.com.google.common.collect.ImmutableList<ReviewerStatusUpdate>
getReviewerUpdates()
RobotCommentNotes
getRobotCommentNotes()
com.google.common.collect.ImmutableListMultimap<org.eclipse.jgit.lib.ObjectId,RobotComment>
getRobotComments()
com.google.common.collect.ImmutableList<SubmitRecord>
getSubmitRecords()
Returns submit records stored during the most recent submit; only for changes that were actually submitted.com.google.common.collect.ImmutableList<SubmitRequirementResult>
getSubmitRequirementsResult()
Returns the evaluated submit requirements for the change.int
getUpdateCount()
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.static org.eclipse.jgit.errors.ConfigInvalidException
parseException(Change.Id changeId, String fmt, Object... args)
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, load, loadRevision, openHandle, reload, self
-
-
-
-
Constructor Detail
-
ChangeNotes
public ChangeNotes(AbstractChangeNotes.Args args, Change change, boolean shouldExist, RefCache refs, org.eclipse.jgit.lib.ObjectId metaSha1)
-
ChangeNotes
public ChangeNotes(AbstractChangeNotes.Args args, Change change, boolean shouldExist, RefCache refs)
-
-
Method Detail
-
parseException
@FormatMethod public static org.eclipse.jgit.errors.ConfigInvalidException parseException(Change.Id changeId, String fmt, Object... args)
-
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 PatchSetApprovals getApprovals()
Gets the approvals of all patch sets.
-
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()
-
getAttentionSet
public com.google.common.collect.ImmutableSet<AttentionSetUpdate> getAttentionSet()
Returns the most recent update (i.e. status) per user.
-
getAttentionSetUpdates
public com.google.common.collect.ImmutableList<AttentionSetUpdate> getAttentionSetUpdates()
Returns all updates for the attention set.
-
getSubmitRequirementsResult
public com.google.common.collect.ImmutableList<SubmitRequirementResult> getSubmitRequirementsResult()
Returns the evaluated submit requirements for the change. We only intend to store submit requirements in NoteDb for closed changes. For closed changes, the results represent the state of evaluating submit requirements for this change when it was merged or abandoned.- Throws:
UnsupportedOperationException
- if submit requirements are requested for an open change.
-
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. The order of the set is the order in which they were assigned.
-
getAssigneeUpdates
public com.google.common.collect.ImmutableList<AssigneeStatusUpdate> getAssigneeUpdates()
Returns an ImmutableList of AssigneeStatusUpdate of all the updates to the assignee field to this change. The order of the list is from most recent updates to least recent.
-
getHashtags
public com.google.common.collect.ImmutableSet<String> getHashtags()
Returns an 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.
-
getHumanComments
public com.google.common.collect.ImmutableListMultimap<org.eclipse.jgit.lib.ObjectId,HumanComment> getHumanComments()
Returns inline comments on each revision.
-
getCommentKeys
public com.google.common.collect.ImmutableSet<Comment.Key> getCommentKeys()
-
getUpdateCount
public int getUpdateCount()
-
getMergedOn
public Optional<Instant> getMergedOn()
ReturnsOptional
value of time when the change was merged.
-
getDraftComments
public com.google.common.collect.ImmutableListMultimap<org.eclipse.jgit.lib.ObjectId,HumanComment> getDraftComments(Account.Id author)
-
getDraftComments
public com.google.common.collect.ImmutableListMultimap<org.eclipse.jgit.lib.ObjectId,HumanComment> getDraftComments(Account.Id author, org.eclipse.jgit.lib.Ref ref)
-
getRobotComments
public com.google.common.collect.ImmutableListMultimap<org.eclipse.jgit.lib.ObjectId,RobotComment> getRobotComments()
-
getRobotCommentNotes
public RobotCommentNotes getRobotCommentNotes()
-
containsComment
public boolean containsComment(HumanComment c)
-
containsCommentPublished
public boolean containsCommentPublished(Comment c)
-
getRefName
public String getRefName()
Description copied from class:AbstractChangeNotes
Returns name of the reference storing this configuration.- Specified by:
getRefName
in classAbstractChangeNotes<ChangeNotes>
-
getCurrentPatchSet
public PatchSet getCurrentPatchSet()
-
onLoad
protected void onLoad(AbstractChangeNotes.LoadHandle handle) throws NoSuchChangeException, IOException
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
-
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()
Description copied from class:AbstractChangeNotes
Returns the NameKey for the project where the notes should be stored, which is not necessarily the same as the change's project.- Specified by:
getProjectName
in classAbstractChangeNotes<ChangeNotes>
-
readRef
protected org.eclipse.jgit.lib.ObjectId readRef(org.eclipse.jgit.lib.Repository repo) throws IOException
- Overrides:
readRef
in classAbstractChangeNotes<ChangeNotes>
- Throws:
IOException
-
-