Package com.google.gerrit.server.edit
Class ChangeEditUtil
java.lang.Object
com.google.gerrit.server.edit.ChangeEditUtil
Utility functions to manipulate change edits.
This class contains methods to retrieve, publish and delete edits. For changing edits see
ChangeEditModifier
.
-
Method Summary
Modifier and TypeMethodDescriptionbyChange
(ChangeNotes notes) Retrieve edit for a given change.byChange
(ChangeNotes notes, CurrentUser user) Retrieve edit for a change and the given user.void
delete
(ChangeEdit edit) Delete change edit.void
publish
(BatchUpdate.Factory updateFactory, ChangeNotes notes, CurrentUser user, ChangeEdit edit, NotifyResolver.Result notify) Promote change edit to patch set, by squashing the edit into its parent.
-
Method Details
-
byChange
Retrieve edit for a given change.At most one change edit can exist per user and change.
- Parameters:
notes
- change notes of change to retrieve change edits for.- Returns:
- edit for this change for this user, if present.
- Throws:
AuthException
- if this is not a logged-in user.IOException
- if an error occurs.
-
byChange
public Optional<ChangeEdit> byChange(ChangeNotes notes, CurrentUser user) throws AuthException, IOException Retrieve edit for a change and the given user.At most one change edit can exist per user and change.
- Parameters:
notes
- change notes of change to retrieve change edits for.user
- user to retrieve edits as.- Returns:
- edit for this change for this user, if present.
- Throws:
AuthException
- if this is not a logged-in user.IOException
- if an error occurs.
-
publish
public void publish(BatchUpdate.Factory updateFactory, ChangeNotes notes, CurrentUser user, ChangeEdit edit, NotifyResolver.Result notify) throws IOException, RestApiException, UpdateException Promote change edit to patch set, by squashing the edit into its parent.- Parameters:
updateFactory
- factory for creating updates.notes
- theChangeNotes
of the change to which the change edit belongsuser
- the current useredit
- change edit to publishnotify
- Notify handling that defines to whom email notifications should be sent after the change edit is published.- Throws:
IOException
RestApiException
UpdateException
-
delete
Delete change edit.- Parameters:
edit
- change edit to delete- Throws:
IOException
-