Class Groups
java.lang.Object
com.google.gerrit.server.group.db.Groups
A database accessor for read calls related to groups.
All calls which read group related details from 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.
Most callers should not need to read groups directly from the database; they should use the
GroupCache
instead.
If not explicitly stated, all methods of this class refer to internal groups.
-
Constructor Summary
ConstructorsConstructorDescriptionGroups
(GitRepositoryManager repoManager, AllUsersName allUsersName, AuditLogReader auditLogReader) -
Method Summary
Modifier and TypeMethodDescriptionReturnsGroupReference
s for all internal groups.getExternalGroups
(com.google.common.collect.ImmutableList<org.eclipse.jgit.lib.Ref> internalGroupsRefs) Returns all known external groups.getGroup
(AccountGroup.UUID groupUuid) Returns theInternalGroup
for the specified UUID if it exists.getGroup
(AccountGroup.UUID groupUuid, org.eclipse.jgit.lib.ObjectId groupRefObjectId) Returns theInternalGroup
for the specified UUID and groupRefObjectIdgetMembersAudit
(org.eclipse.jgit.lib.Repository allUsersRepo, AccountGroup.UUID groupUuid) Returns the membership audit records for a given group.getSubgroupsAudit
(org.eclipse.jgit.lib.Repository repo, AccountGroup.UUID groupUuid) Returns the subgroup audit records for a given group.
-
Constructor Details
-
Groups
@Inject public Groups(GitRepositoryManager repoManager, AllUsersName allUsersName, AuditLogReader auditLogReader)
-
-
Method Details
-
getGroup
public Optional<InternalGroup> getGroup(AccountGroup.UUID groupUuid) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException Returns theInternalGroup
for the specified UUID if it exists.- Parameters:
groupUuid
- the UUID of the group- Returns:
- the found
InternalGroup
if it exists, or else an emptyOptional
- Throws:
IOException
- if the group couldn't be retrieved from NoteDborg.eclipse.jgit.errors.ConfigInvalidException
- if the group couldn't be retrieved from NoteDb
-
getGroup
public Optional<InternalGroup> getGroup(AccountGroup.UUID groupUuid, org.eclipse.jgit.lib.ObjectId groupRefObjectId) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException Returns theInternalGroup
for the specified UUID and groupRefObjectId- Parameters:
groupUuid
- the UUID of the groupgroupRefObjectId
- the ref revision of this group- Returns:
- the found
InternalGroup
if it exists, or else an emptyOptional
- Throws:
IOException
- if the group couldn't be retrieved from NoteDborg.eclipse.jgit.errors.ConfigInvalidException
- if the group couldn't be retrieved from NoteDb
-
getAllGroupReferences
public Stream<GroupReference> getAllGroupReferences() throws IOException, org.eclipse.jgit.errors.ConfigInvalidExceptionReturnsGroupReference
s for all internal groups.- Returns:
- a stream of the
GroupReference
s of all internal groups - Throws:
IOException
- if an error occurs while reading from NoteDborg.eclipse.jgit.errors.ConfigInvalidException
- if the data in NoteDb is in an incorrect format
-
getExternalGroups
public Stream<AccountGroup.UUID> getExternalGroups(com.google.common.collect.ImmutableList<org.eclipse.jgit.lib.Ref> internalGroupsRefs) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException Returns all known external groups. External groups are 'known' when they are specified as a subgroup of an internal group.- Parameters:
internalGroupsRefs
- contains a list of all groups refs that we should inspect- Returns:
- a stream of the UUIDs of the known external groups
- Throws:
IOException
- if an error occurs while reading from NoteDborg.eclipse.jgit.errors.ConfigInvalidException
- if the data in NoteDb is in an incorrect format
-
getMembersAudit
public List<AccountGroupMemberAudit> getMembersAudit(org.eclipse.jgit.lib.Repository allUsersRepo, AccountGroup.UUID groupUuid) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException Returns the membership audit records for a given group.- Parameters:
allUsersRepo
- All-Users repository.groupUuid
- the UUID of the group- Returns:
- the audit records, in arbitrary order; empty if the group does not exist
- Throws:
IOException
- if an error occurs while reading from NoteDborg.eclipse.jgit.errors.ConfigInvalidException
- if the group couldn't be retrieved from NoteDb
-
getSubgroupsAudit
public List<AccountGroupByIdAudit> getSubgroupsAudit(org.eclipse.jgit.lib.Repository repo, AccountGroup.UUID groupUuid) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException Returns the subgroup audit records for a given group.- Parameters:
repo
- All-Users repository.groupUuid
- the UUID of the group- Returns:
- the audit records, in arbitrary order; empty if the group does not exist
- Throws:
IOException
- if an error occurs while reading from NoteDborg.eclipse.jgit.errors.ConfigInvalidException
- if the group couldn't be retrieved from NoteDb
-