public class ChangeMessagesUtil extends Object
These methods either query for and update ChangeMessages in the NoteDb or ReviewDb, depending on the state of the NotesMigration.
Modifier and Type | Field and 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 and Description |
---|
ChangeMessagesUtil(NotesMigration migration) |
Modifier and Type | Method and Description |
---|---|
void |
addChangeMessage(ReviewDb db,
ChangeUpdate update,
ChangeMessage changeMessage) |
List<ChangeMessage> |
byChange(ReviewDb db,
ChangeNotes notes) |
static ChangeMessageInfo |
createChangeMessageInfo(ChangeMessage message,
AccountLoader accountLoader) |
static boolean |
isAutogenerated(String tag) |
static ChangeMessage |
newMessage(ChangeContext ctx,
String body,
String tag) |
static ChangeMessage |
newMessage(PatchSet.Id psId,
CurrentUser user,
Timestamp when,
String body,
String tag) |
void |
replaceChangeMessage(ReviewDb db,
ChangeUpdate update,
int targetMessageIdx,
String newMessage)
Replace an existing change message with the provided new message.
|
static String |
uploadedPatchSetTag(boolean workInProgress) |
public static final String AUTOGENERATED_TAG_PREFIX
public static final String TAG_ABANDON
public static final String TAG_CHERRY_PICK_CHANGE
public static final String TAG_DELETE_ASSIGNEE
public static final String TAG_DELETE_REVIEWER
public static final String TAG_DELETE_VOTE
public static final String TAG_MERGED
public static final String TAG_MOVE
public static final String TAG_RESTORE
public static final String TAG_REVERT
public static final String TAG_SET_ASSIGNEE
public static final String TAG_SET_DESCRIPTION
public static final String TAG_SET_HASHTAGS
public static final String TAG_SET_PRIVATE
public static final String TAG_SET_READY
public static final String TAG_SET_TOPIC
public static final String TAG_SET_WIP
public static final String TAG_UNSET_PRIVATE
public static final String TAG_UPLOADED_PATCH_SET
public static final String TAG_UPLOADED_WIP_PATCH_SET
@Inject public ChangeMessagesUtil(NotesMigration migration)
public static ChangeMessage newMessage(ChangeContext ctx, String body, String tag)
public static ChangeMessage newMessage(PatchSet.Id psId, CurrentUser user, Timestamp when, String body, String tag)
public static String uploadedPatchSetTag(boolean workInProgress)
public List<ChangeMessage> byChange(ReviewDb db, ChangeNotes notes) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public void addChangeMessage(ReviewDb db, ChangeUpdate update, ChangeMessage changeMessage) throws com.google.gwtorm.server.OrmException
com.google.gwtorm.server.OrmException
public void replaceChangeMessage(ReviewDb db, ChangeUpdate update, int targetMessageIdx, String newMessage) throws com.google.gwtorm.server.OrmException
The ID of a change message is different between NoteDb and ReviewDb. In NoteDb, it's the commit SHA-1, but in ReviewDb it's generated randomly. To make sure the change message can be deleted from both NoteDb and ReviewDb, the index of the change message must be used rather than its ID.
db
- the ReviewDb
instance to update.update
- change update.targetMessageIdx
- the index of the target change message.newMessage
- the new message which is going to replace the old.com.google.gwtorm.server.OrmException
public static boolean isAutogenerated(String tag)
tag
- value of a tag, or null.public static ChangeMessageInfo createChangeMessageInfo(ChangeMessage message, AccountLoader accountLoader)