Class GroupsUpdate

java.lang.Object
com.google.gerrit.server.group.db.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 com.google.gerrit.pgm.init.GroupsOnInit instead.

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

  • Method Details

    • createGroup

      public InternalGroup createGroup(InternalGroupCreation groupCreation, GroupDelta groupDelta) 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
      groupDelta - a GroupDelta which specifies optional properties of the group. If this GroupDelta updates a property which was already specified by the InternalGroupCreation, the value of this GroupDelta 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, GroupDelta groupDelta) 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
      groupDelta - a GroupDelta 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, GroupDelta groupDelta) 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, GroupDelta groupDelta) 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