Replace use of AccountGroup by an interface for various classes

Previously, GroupDescription.Internal served only as a marker for
internal groups and simply delegated to AccountGroup. By converting
GroupDescription.Internal to a real interface, we gain a lot of
flexibility. For instance, we are free to use another class to
represent internal groups (which will be necessary for the migration
of groups to NoteDb).

Change-Id: If7397898d8508184a2ccdc7c371ed60ada7d6f3e
This commit is contained in:
Alice Kober-Sotzek
2017-08-16 17:41:38 +02:00
parent 6da54a4009
commit 3a68432798
28 changed files with 154 additions and 146 deletions

View File

@@ -18,7 +18,7 @@ import static com.google.gerrit.server.account.externalids.ExternalId.SCHEME_MAI
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.GlobalCapability;
import com.google.gerrit.common.data.GroupDescriptions;
import com.google.gerrit.common.data.GroupDescription;
import com.google.gerrit.common.errors.InvalidSshKeyException;
import com.google.gerrit.common.errors.NoSuchGroupException;
import com.google.gerrit.extensions.annotations.RequiresCapability;
@@ -211,8 +211,8 @@ public class CreateAccount implements RestModifyView<TopLevelResource, AccountIn
Set<AccountGroup.UUID> groupUuids = new HashSet<>();
if (groups != null) {
for (String g : groups) {
AccountGroup group = GroupDescriptions.toAccountGroup(groupsCollection.parseInternal(g));
groupUuids.add(group.getGroupUUID());
GroupDescription.Internal internalGroup = groupsCollection.parseInternal(g);
groupUuids.add(internalGroup.getGroupUUID());
}
}
return groupUuids;