Class ChangeNoteUtil


  • public class ChangeNoteUtil
    extends Object
    • Field Detail

      • FOOTER_ATTENTION

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_ATTENTION
      • FOOTER_ASSIGNEE

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_ASSIGNEE
      • FOOTER_BRANCH

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_BRANCH
      • FOOTER_CHANGE_ID

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_CHANGE_ID
      • FOOTER_COMMIT

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_COMMIT
      • FOOTER_CURRENT

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_CURRENT
      • FOOTER_GROUPS

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_GROUPS
      • FOOTER_HASHTAGS

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_HASHTAGS
      • FOOTER_LABEL

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_LABEL
      • FOOTER_COPIED_LABEL

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_COPIED_LABEL
      • FOOTER_PATCH_SET

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_PATCH_SET
      • FOOTER_PATCH_SET_DESCRIPTION

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_PATCH_SET_DESCRIPTION
      • FOOTER_PRIVATE

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_PRIVATE
      • FOOTER_REAL_USER

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_REAL_USER
      • FOOTER_STATUS

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_STATUS
      • FOOTER_SUBJECT

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_SUBJECT
      • FOOTER_SUBMISSION_ID

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_SUBMISSION_ID
      • FOOTER_SUBMITTED_WITH

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_SUBMITTED_WITH
      • FOOTER_TOPIC

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_TOPIC
      • FOOTER_TAG

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_TAG
      • FOOTER_WORK_IN_PROGRESS

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_WORK_IN_PROGRESS
      • FOOTER_REVERT_OF

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_REVERT_OF
      • FOOTER_CHERRY_PICK_OF

        public static final org.eclipse.jgit.revwalk.FooterKey FOOTER_CHERRY_PICK_OF
    • Constructor Detail

      • ChangeNoteUtil

        @Inject
        public ChangeNoteUtil​(ChangeNoteJson changeNoteJson,
                              String serverId)
    • Method Detail

      • formatAccountIdentString

        public static String formatAccountIdentString​(Account.Id account,
                                                      String accountIdAsEmail)
      • newAccountIdIdent

        public org.eclipse.jgit.lib.PersonIdent newAccountIdIdent​(Account.Id accountId,
                                                                  Instant when,
                                                                  org.eclipse.jgit.lib.PersonIdent serverIdent)
        Returns a PersonIdent that contains the account ID, but not the user's name or email address.
      • getAccountIdAsUsername

        public static String getAccountIdAsUsername​(Account.Id accountId)
        Returns the string "Gerrit User " + accountId, to pseudonymize user names.
      • getAccountIdAsEmailAddress

        public String getAccountIdAsEmailAddress​(Account.Id accountId)
      • parseApproval

        public static ChangeNoteUtil.ParsedPatchSetApproval parseApproval​(String footerLine)
                                                                   throws org.eclipse.jgit.errors.ConfigInvalidException
        Parses ChangeNoteUtil.ParsedPatchSetApproval from FOOTER_LABEL line.

        Valid added approval footer examples:

        • Label:
        • Label:
        • Label:
        • Label:

        Valid removed approval footer examples:

        • -
        • -

        is optional, since the approval might have been granted before PatchSetApproval.UUID was introduced.

        is only persisted in cases, when the account, that granted the vote does not match the account, that issued ChangeUpdate (created this NoteDB commit).

        Throws:
        org.eclipse.jgit.errors.ConfigInvalidException
      • parseCopiedApproval

        public static ChangeNoteUtil.ParsedPatchSetApproval parseCopiedApproval​(String labelLine)
                                                                         throws org.eclipse.jgit.errors.ConfigInvalidException
        Parses copied ChangeNoteUtil.ParsedPatchSetApproval from FOOTER_COPIED_LABEL line.

        Footer example: Copied-Label:

        • ":<"TAG>"" is optional.
        • is also optional, if it was not set.
        • is optional, since the approval might have been granted before PatchSetApproval.UUID was introduced.
        • The label, vote, and the Gerrit account are mandatory (unlike FOOTER_LABEL where Gerrit Account is also optional since by default it's the committer).

        Footer example for removal: Copied-Label: -

        • is also optional, if it was not set.
        Throws:
        org.eclipse.jgit.errors.ConfigInvalidException