Class ChangeEditUtil


  • public class ChangeEditUtil
    extends Object
    Utility functions to manipulate change edits.

    This class contains methods to retrieve, publish and delete edits. For changing edits see ChangeEditModifier.

    • Method Detail

      • byChange

        public Optional<ChangeEdit> byChange​(ChangeNotes notes)
                                      throws AuthException,
                                             IOException
        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,
                            NotifyHandling notify,
                            com.google.common.collect.ListMultimap<RecipientType,​Account.Id> accountsToNotify)
                     throws IOException,
                            com.google.gwtorm.server.OrmException,
                            RestApiException,
                            UpdateException
        Promote change edit to patch set, by squashing the edit into its parent.
        Parameters:
        updateFactory - factory for creating updates.
        notes - the ChangeNotes of the change to which the change edit belongs
        user - the current user
        edit - change edit to publish
        notify - Notify handling that defines to whom email notifications should be sent after the change edit is published.
        accountsToNotify - Accounts that should be notified after the change edit is published.
        Throws:
        IOException
        com.google.gwtorm.server.OrmException
        UpdateException
        RestApiException
      • delete

        public void delete​(ChangeEdit edit)
                    throws IOException,
                           com.google.gwtorm.server.OrmException
        Delete change edit.
        Parameters:
        edit - change edit to delete
        Throws:
        IOException
        com.google.gwtorm.server.OrmException