Replace account.AccountInfo with extensions.common.AccountInfo

These have identical public fields; the only difference is that
AccountInfo.Loader was using the transient _id field store the ID
before filling in values. We can instead reuse the Integer _accountId
field for this purpose. This may incur an additional boxing or so per
account per request, but that cost should be negligible given how
many allocations we do per request already.

AccountInfoMapper is no longer required, so remove that entirely.

We are now enforcing that AccountInfos passed to the loader have an
_accountId. Since by default the old account.AccountInfo worked
without an _accountId, add this as a separate FillOption and clear it
if that option is not set. To verify this, check the owner fields in
ChangeIT#get.

Change-Id: Ied01750485cc728e91e585a31f3db8863bae7e40
This commit is contained in:
Dave Borowitz
2014-11-25 14:41:05 -05:00
parent 5df54ae192
commit 54ba43a51d
34 changed files with 259 additions and 272 deletions

View File

@@ -18,8 +18,9 @@ import static com.google.gerrit.sshd.CommandMetaData.Mode.MASTER_OR_SLAVE;
import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import com.google.gerrit.extensions.common.AccountInfo;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.server.account.AccountInfo;
import com.google.gerrit.server.account.AccountLoader;
import com.google.gerrit.server.account.GroupCache;
import com.google.gerrit.server.account.GroupDetailFactory.Factory;
import com.google.gerrit.server.group.ListMembers;
@@ -62,7 +63,7 @@ public class ListMembersCommand extends SshCommand {
@Inject
protected ListMembersCommandImpl(GroupCache groupCache,
Factory groupDetailFactory,
AccountInfo.Loader.Factory accountLoaderFactory) {
AccountLoader.Factory accountLoaderFactory) {
super(groupCache, groupDetailFactory, accountLoaderFactory);
this.groupCache = groupCache;
}
@@ -89,7 +90,7 @@ public class ListMembersCommand extends SshCommand {
continue;
}
formatter.addColumn(member._id.toString());
formatter.addColumn(Integer.toString(member._accountId));
formatter.addColumn(MoreObjects.firstNonNull(
member.username, "n/a"));
formatter.addColumn(MoreObjects.firstNonNull(