Class GroupsUpdate


  • public class GroupsUpdate
    extends Object
    A database accessor for write calls related to groups.

    All calls which write group related details to the database are gathered here. Other classes should always use this class instead of accessing the database directly. There are a few exceptions though: schema classes, wrapper classes, and classes executed during init. The latter ones should use GroupsOnInit instead.

    If not explicitly stated, all methods of this class refer to internal groups.

    • Method Detail

      • createGroup

        public InternalGroup createGroup​(InternalGroupCreation groupCreation,
                                         InternalGroupUpdate groupUpdate)
                                  throws com.google.gerrit.exceptions.DuplicateKeyException,
                                         IOException,
                                         org.eclipse.jgit.errors.ConfigInvalidException
        Creates the specified group for the specified members (accounts).
        Parameters:
        groupCreation - an InternalGroupCreation which specifies all mandatory properties of the group
        groupUpdate - an InternalGroupUpdate which specifies optional properties of the group. If this InternalGroupUpdate updates a property which was already specified by the InternalGroupCreation, the value of this InternalGroupUpdate wins.
        Returns:
        the created InternalGroup
        Throws:
        com.google.gerrit.exceptions.DuplicateKeyException - if a group with the chosen name already exists
        IOException - if indexing fails, or an error occurs while reading/writing from/to NoteDb
        org.eclipse.jgit.errors.ConfigInvalidException
      • updateGroup

        public void updateGroup​(AccountGroup.UUID groupUuid,
                                InternalGroupUpdate groupUpdate)
                         throws com.google.gerrit.exceptions.DuplicateKeyException,
                                IOException,
                                com.google.gerrit.exceptions.NoSuchGroupException,
                                org.eclipse.jgit.errors.ConfigInvalidException
        Updates the specified group.
        Parameters:
        groupUuid - the UUID of the group to update
        groupUpdate - an InternalGroupUpdate which indicates the desired updates on the group
        Throws:
        com.google.gerrit.exceptions.DuplicateKeyException - if the new name of the group is used by another group
        IOException - if indexing fails, or an error occurs while reading/writing from/to NoteDb
        com.google.gerrit.exceptions.NoSuchGroupException - if the specified group doesn't exist
        org.eclipse.jgit.errors.ConfigInvalidException
      • createGroupInNoteDb

        public InternalGroup createGroupInNoteDb​(InternalGroupCreation groupCreation,
                                                 InternalGroupUpdate groupUpdate)
                                          throws IOException,
                                                 org.eclipse.jgit.errors.ConfigInvalidException,
                                                 com.google.gerrit.exceptions.DuplicateKeyException
        Throws:
        IOException
        org.eclipse.jgit.errors.ConfigInvalidException
        com.google.gerrit.exceptions.DuplicateKeyException
      • updateGroupInNoteDb

        public com.google.gerrit.server.group.db.GroupsUpdate.UpdateResult updateGroupInNoteDb​(AccountGroup.UUID groupUuid,
                                                                                               InternalGroupUpdate groupUpdate)
                                                                                        throws IOException,
                                                                                               org.eclipse.jgit.errors.ConfigInvalidException,
                                                                                               com.google.gerrit.exceptions.DuplicateKeyException,
                                                                                               com.google.gerrit.exceptions.NoSuchGroupException
        Throws:
        IOException
        org.eclipse.jgit.errors.ConfigInvalidException
        com.google.gerrit.exceptions.DuplicateKeyException
        com.google.gerrit.exceptions.NoSuchGroupException