Package com.google.gerrit.server
Class ChangeMessagesUtil
- java.lang.Object
-
- com.google.gerrit.server.ChangeMessagesUtil
-
public class ChangeMessagesUtil extends Object
Utility functions to manipulate ChangeMessages.
-
-
Field Summary
Fields Modifier and Type Field Description static String
AUTOGENERATED_TAG_PREFIX
static String
TAG_ABANDON
static String
TAG_CHERRY_PICK_CHANGE
static String
TAG_DELETE_ASSIGNEE
static String
TAG_DELETE_REVIEWER
static String
TAG_DELETE_VOTE
static String
TAG_MERGED
static String
TAG_MOVE
static String
TAG_RESTORE
static String
TAG_REVERT
static String
TAG_SET_ASSIGNEE
static String
TAG_SET_DESCRIPTION
static String
TAG_SET_HASHTAGS
static String
TAG_SET_PRIVATE
static String
TAG_SET_READY
static String
TAG_SET_TOPIC
static String
TAG_SET_WIP
static String
TAG_UNSET_PRIVATE
static String
TAG_UPLOADED_PATCH_SET
static String
TAG_UPLOADED_WIP_PATCH_SET
-
Constructor Summary
Constructors Constructor Description ChangeMessagesUtil()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChangeMessage(ChangeUpdate update, ChangeMessage changeMessage)
List<ChangeMessage>
byChange(ChangeNotes notes)
static ChangeMessageInfo
createChangeMessageInfo(ChangeMessage message, AccountLoader accountLoader)
static boolean
isAutogenerated(String tag)
static ChangeMessage
newMessage(PatchSet.Id psId, CurrentUser user, Timestamp when, String body, String tag)
static ChangeMessage
newMessage(ChangeContext ctx, String body, String tag)
void
replaceChangeMessage(ChangeUpdate update, String targetMessageId, String newMessage)
Replace an existing change message with the provided new message.static String
uploadedPatchSetTag(boolean workInProgress)
-
-
-
Field Detail
-
AUTOGENERATED_TAG_PREFIX
public static final String AUTOGENERATED_TAG_PREFIX
- See Also:
- Constant Field Values
-
TAG_ABANDON
public static final String TAG_ABANDON
- See Also:
- Constant Field Values
-
TAG_CHERRY_PICK_CHANGE
public static final String TAG_CHERRY_PICK_CHANGE
- See Also:
- Constant Field Values
-
TAG_DELETE_ASSIGNEE
public static final String TAG_DELETE_ASSIGNEE
- See Also:
- Constant Field Values
-
TAG_DELETE_REVIEWER
public static final String TAG_DELETE_REVIEWER
- See Also:
- Constant Field Values
-
TAG_DELETE_VOTE
public static final String TAG_DELETE_VOTE
- See Also:
- Constant Field Values
-
TAG_MERGED
public static final String TAG_MERGED
- See Also:
- Constant Field Values
-
TAG_MOVE
public static final String TAG_MOVE
- See Also:
- Constant Field Values
-
TAG_RESTORE
public static final String TAG_RESTORE
- See Also:
- Constant Field Values
-
TAG_REVERT
public static final String TAG_REVERT
- See Also:
- Constant Field Values
-
TAG_SET_ASSIGNEE
public static final String TAG_SET_ASSIGNEE
- See Also:
- Constant Field Values
-
TAG_SET_DESCRIPTION
public static final String TAG_SET_DESCRIPTION
- See Also:
- Constant Field Values
-
TAG_SET_HASHTAGS
public static final String TAG_SET_HASHTAGS
- See Also:
- Constant Field Values
-
TAG_SET_PRIVATE
public static final String TAG_SET_PRIVATE
- See Also:
- Constant Field Values
-
TAG_SET_READY
public static final String TAG_SET_READY
- See Also:
- Constant Field Values
-
TAG_SET_TOPIC
public static final String TAG_SET_TOPIC
- See Also:
- Constant Field Values
-
TAG_SET_WIP
public static final String TAG_SET_WIP
- See Also:
- Constant Field Values
-
TAG_UNSET_PRIVATE
public static final String TAG_UNSET_PRIVATE
- See Also:
- Constant Field Values
-
TAG_UPLOADED_PATCH_SET
public static final String TAG_UPLOADED_PATCH_SET
- See Also:
- Constant Field Values
-
TAG_UPLOADED_WIP_PATCH_SET
public static final String TAG_UPLOADED_WIP_PATCH_SET
- See Also:
- Constant Field Values
-
-
Method Detail
-
newMessage
public static ChangeMessage newMessage(ChangeContext ctx, String body, String tag)
-
newMessage
public static ChangeMessage newMessage(PatchSet.Id psId, CurrentUser user, Timestamp when, String body, String tag)
-
uploadedPatchSetTag
public static String uploadedPatchSetTag(boolean workInProgress)
-
byChange
public List<ChangeMessage> byChange(ChangeNotes notes)
-
addChangeMessage
public void addChangeMessage(ChangeUpdate update, ChangeMessage changeMessage)
-
replaceChangeMessage
public void replaceChangeMessage(ChangeUpdate update, String targetMessageId, String newMessage)
Replace an existing change message with the provided new message.The ID of a change message is different between NoteDb and ReviewDb. In NoteDb, it's the commit SHA-1, but in ReviewDb it was generated randomly. Taking the target message as an index rather than an ID allowed us to delete the message from both NoteDb and ReviewDb.
- Parameters:
update
- change update.targetMessageId
- the id of the target change message.newMessage
- the new message which is going to replace the old.
-
isAutogenerated
public static boolean isAutogenerated(String tag)
- Parameters:
tag
- value of a tag, or null.- Returns:
- whether the tag starts with the autogenerated prefix.
-
createChangeMessageInfo
public static ChangeMessageInfo createChangeMessageInfo(ChangeMessage message, AccountLoader accountLoader)
-
-