public class Groups
extends java.lang.Object
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 and Description |
---|
Groups(GitRepositoryManager repoManager,
AllUsersName allUsersName,
AuditLogReader auditLogReader) |
Modifier and Type | Method and Description |
---|---|
java.util.stream.Stream<GroupReference> |
getAllGroupReferences()
Returns
GroupReference s for all internal groups. |
java.util.stream.Stream<AccountGroup.UUID> |
getExternalGroups()
Returns all known external groups.
|
java.util.Optional<InternalGroup> |
getGroup(AccountGroup.UUID groupUuid)
Returns the
InternalGroup for the specified UUID if it exists. |
java.util.List<AccountGroupMemberAudit> |
getMembersAudit(org.eclipse.jgit.lib.Repository allUsersRepo,
AccountGroup.UUID groupUuid)
Returns the membership audit records for a given group.
|
java.util.List<AccountGroupByIdAud> |
getSubgroupsAudit(org.eclipse.jgit.lib.Repository repo,
AccountGroup.UUID groupUuid)
Returns the subgroup audit records for a given group.
|
@Inject public Groups(GitRepositoryManager repoManager, AllUsersName allUsersName, AuditLogReader auditLogReader)
public java.util.Optional<InternalGroup> getGroup(AccountGroup.UUID groupUuid) throws java.io.IOException, org.eclipse.jgit.errors.ConfigInvalidException
InternalGroup
for the specified UUID if it exists.groupUuid
- the UUID of the groupInternalGroup
if it exists, or else an empty Optional
java.io.IOException
- if the group couldn't be retrieved from NoteDborg.eclipse.jgit.errors.ConfigInvalidException
- if the group couldn't be retrieved from NoteDbpublic java.util.stream.Stream<GroupReference> getAllGroupReferences() throws java.io.IOException, org.eclipse.jgit.errors.ConfigInvalidException
GroupReference
s for all internal groups.GroupReference
s of all internal groupsjava.io.IOException
- if an error occurs while reading from NoteDborg.eclipse.jgit.errors.ConfigInvalidException
- if the data in NoteDb is in an incorrect formatpublic java.util.stream.Stream<AccountGroup.UUID> getExternalGroups() throws java.io.IOException, org.eclipse.jgit.errors.ConfigInvalidException
java.io.IOException
- if an error occurs while reading from NoteDborg.eclipse.jgit.errors.ConfigInvalidException
- if the data in NoteDb is in an incorrect formatpublic java.util.List<AccountGroupMemberAudit> getMembersAudit(org.eclipse.jgit.lib.Repository allUsersRepo, AccountGroup.UUID groupUuid) throws java.io.IOException, org.eclipse.jgit.errors.ConfigInvalidException
allUsersRepo
- All-Users repository.groupUuid
- the UUID of the groupjava.io.IOException
- if an error occurs while reading from NoteDborg.eclipse.jgit.errors.ConfigInvalidException
- if the group couldn't be retrieved from NoteDbpublic java.util.List<AccountGroupByIdAud> getSubgroupsAudit(org.eclipse.jgit.lib.Repository repo, AccountGroup.UUID groupUuid) throws java.io.IOException, org.eclipse.jgit.errors.ConfigInvalidException
repo
- All-Users repository.groupUuid
- the UUID of the groupjava.io.IOException
- if an error occurs while reading from NoteDborg.eclipse.jgit.errors.ConfigInvalidException
- if the group couldn't be retrieved from NoteDb