Merge "Allow group includes to be by UUID instead of group ID"

This commit is contained in:
Shawn Pearce
2013-01-10 13:01:20 -08:00
committed by Gerrit Code Review
24 changed files with 329 additions and 192 deletions

View File

@@ -17,7 +17,7 @@ package com.google.gerrit.common.data;
import com.google.gerrit.common.audit.Audit;
import com.google.gerrit.common.auth.SignInRequired;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.reviewdb.client.AccountGroupInclude;
import com.google.gerrit.reviewdb.client.AccountGroupIncludeByUuid;
import com.google.gerrit.reviewdb.client.AccountGroupMember;
import com.google.gwtjsonrpc.common.AsyncCallback;
import com.google.gwtjsonrpc.common.RemoteJsonService;
@@ -70,8 +70,8 @@ public interface GroupAdminService extends RemoteJsonService {
@Audit
@SignInRequired
void addGroupInclude(AccountGroup.Id groupId, String groupName,
AsyncCallback<GroupDetail> callback);
void addGroupInclude(AccountGroup.Id groupId, AccountGroup.UUID incGroupUUID,
String incGroupName, AsyncCallback<GroupDetail> callback);
@Audit
@SignInRequired
@@ -81,5 +81,5 @@ public interface GroupAdminService extends RemoteJsonService {
@Audit
@SignInRequired
void deleteGroupIncludes(AccountGroup.Id groupId,
Set<AccountGroupInclude.Key> keys, AsyncCallback<VoidResult> callback);
Set<AccountGroupIncludeByUuid.Key> keys, AsyncCallback<VoidResult> callback);
}

View File

@@ -15,7 +15,7 @@
package com.google.gerrit.common.data;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.reviewdb.client.AccountGroupInclude;
import com.google.gerrit.reviewdb.client.AccountGroupIncludeByUuid;
import com.google.gerrit.reviewdb.client.AccountGroupMember;
import java.util.List;
@@ -25,7 +25,7 @@ public class GroupDetail {
public GroupInfoCache groups;
public AccountGroup group;
public List<AccountGroupMember> members;
public List<AccountGroupInclude> includes;
public List<AccountGroupIncludeByUuid> includes;
public GroupReference ownerGroup;
public boolean canModify;
@@ -48,7 +48,7 @@ public class GroupDetail {
members = m;
}
public void setIncludes(List<AccountGroupInclude> i) {
public void setIncludes(List<AccountGroupIncludeByUuid> i) {
includes = i;
}

View File

@@ -18,7 +18,7 @@ import com.google.gerrit.reviewdb.client.AccountGroup;
/** Summary information about an {@link AccountGroup}, for simple tabular displays. */
public class GroupInfo {
protected AccountGroup.Id id;
protected AccountGroup.UUID uuid;
protected String name;
protected String description;
@@ -32,8 +32,8 @@ public class GroupInfo {
* lookup has failed and a stale group id has been discovered in the data
* store.
*/
public GroupInfo(final AccountGroup.Id id) {
this.id = id;
public GroupInfo(final AccountGroup.UUID uuid) {
this.uuid = uuid;
}
/**
@@ -42,14 +42,14 @@ public class GroupInfo {
* @param a the data store record holding the specific group details.
*/
public GroupInfo(final AccountGroup a) {
id = a.getId();
uuid = a.getGroupUUID();
name = a.getName();
description = a.getDescription();
}
/** @return the unique local id of the group */
public AccountGroup.Id getId() {
return id;
public AccountGroup.UUID getId() {
return uuid;
}
/** @return the name of the group; null if not supplied */

View File

@@ -33,13 +33,13 @@ public class GroupInfoCache {
return EMPTY;
}
protected Map<AccountGroup.Id, GroupInfo> groups;
protected Map<AccountGroup.UUID, GroupInfo> groups;
protected GroupInfoCache() {
}
public GroupInfoCache(final Iterable<GroupInfo> list) {
groups = new HashMap<AccountGroup.Id, GroupInfo>();
groups = new HashMap<AccountGroup.UUID, GroupInfo>();
for (final GroupInfo gi : list) {
groups.put(gi.getId(), gi);
}
@@ -58,15 +58,15 @@ public class GroupInfoCache {
* @param id the id desired.
* @return info block for the group.
*/
public GroupInfo get(final AccountGroup.Id id) {
if (id == null) {
public GroupInfo get(final AccountGroup.UUID uuid) {
if (uuid == null) {
return null;
}
GroupInfo r = groups.get(id);
GroupInfo r = groups.get(uuid);
if (r == null) {
r = new GroupInfo(id);
groups.put(id, r);
r = new GroupInfo(uuid);
groups.put(uuid, r);
}
return r;
}