Merge branch 'stable-2.16'

* stable-2.16:
  Upgrade bazlets to latest stable-2.16 to build with 2.16.8 API

Change-Id: I9c20afe98093823f0dcec35564ff52dee97d2a9d
diff --git a/WORKSPACE b/WORKSPACE
index 3e18469..9681c83 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
 load("//:bazlets.bzl", "load_bazlets")
 
 load_bazlets(
-    commit = "a5525ae2c43e61cf113dacc03691cb2bcf44fb12",
+    commit = "8808e401a9c68a02ae541c36a36dd672a171b7e7",
     #local_path = "/home/<user>/projects/bazlets",
 )
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java
index 99c140e..ffeaed4 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java
@@ -21,7 +21,6 @@
 import com.google.gerrit.extensions.common.SshKeyInfo;
 import com.google.gerrit.extensions.restapi.AuthException;
 import com.google.gerrit.reviewdb.client.Account;
-import com.google.gerrit.reviewdb.client.Account.Id;
 import com.google.gerrit.server.IdentifiedUser;
 import com.google.gerrit.server.account.AccountCache;
 import com.google.gerrit.server.account.AccountResolver;
@@ -89,7 +88,7 @@
 
   @Override
   public void run() throws UnloggedFailure, Exception {
-    Account account;
+    AccountState account;
 
     if (name.isEmpty()) {
       throw new UnloggedFailure(
@@ -97,7 +96,7 @@
           "You need to tell me who to find:  LastName,\\\\ Firstname, email@address.com, account id or an user name.  "
               + "Be sure to double-escape spaces, for example: \"show-account Last,\\\\ First\"");
     }
-    Set<Id> idList = accountResolver.findAll(name);
+    Set<Account.Id> idList = accountResolver.resolve(name).asIdSet();
     if (idList.isEmpty()) {
       throw new UnloggedFailure(
           1,
@@ -116,26 +115,26 @@
             + "\"");
     stdout.println();
 
-    for (Id id : idList) {
-      account = accountResolver.find(id.toString());
+    for (Account.Id id : idList) {
+      account = accountResolver.resolve(id.toString()).asUnique();
       if (account == null) {
         throw new UnloggedFailure("Account " + id.toString() + " does not exist.");
       }
-      stdout.println("Full name:         " + account.getFullName());
+      stdout.println("Full name:         " + account.getAccount().getFullName());
       stdout.println("Account Id:        " + id.toString());
-      stdout.println("Preferred Email:   " + account.getPreferredEmail());
+      stdout.println("Preferred Email:   " + account.getAccount().getPreferredEmail());
       Optional<AccountState> accountState = accountCache.get(id);
       if (accountState.isPresent()) {
         stdout.println("User Name:         " + accountState.get().getUserName().get());
       }
-      stdout.println("Active:            " + account.isActive());
-      stdout.println("Registered on:     " + account.getRegisteredOn());
+      stdout.println("Active:            " + account.getAccount().isActive());
+      stdout.println("Registered on:     " + account.getAccount().getRegisteredOn());
 
       stdout.println("");
       stdout.println("External Ids:");
       stdout.println(String.format("%-50s %s", "Email Address:", "External Id:"));
       try {
-        for (ExternalId externalId : externalIds.byAccount(account.getId())) {
+        for (ExternalId externalId : externalIds.byAccount(account.getAccount().getId())) {
           stdout.println(
               String.format(
                   "%-50s %s",
diff --git a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccessCommand.java b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccessCommand.java
index 4c88634..367ed4b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccessCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccessCommand.java
@@ -45,11 +45,14 @@
   private boolean wide;
 
   @Inject
-  ShowRepoAccessCommand(MetaDataUpdate.Server metaDataUpdateFactory) {
+  ShowRepoAccessCommand(
+      MetaDataUpdate.Server metaDataUpdateFactory, ProjectConfig.Factory projectConfigFactory) {
     this.metaDataUpdateFactory = metaDataUpdateFactory;
+    this.projectConfigFactory = projectConfigFactory;
   }
 
   private final MetaDataUpdate.Server metaDataUpdateFactory;
+  private final ProjectConfig.Factory projectConfigFactory;
 
   private int columns = 80;
   private int permissionGroupWidth;
@@ -71,7 +74,7 @@
     ProjectConfig config;
     try {
       MetaDataUpdate md = metaDataUpdateFactory.create(nameKey);
-      config = ProjectConfig.read(md);
+      config = projectConfigFactory.read(md);
       for (AccessSection accessSection : config.getAccessSections()) {
 
         stdout.print((String.format(sectionNameFormatter, accessSection.getName().toString())));
diff --git a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccountAccessCommand.java b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccountAccessCommand.java
index 2f542bf..4ed3b8c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccountAccessCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccountAccessCommand.java
@@ -22,11 +22,11 @@
 import com.google.gerrit.extensions.annotations.RequiresCapability;
 import com.google.gerrit.extensions.common.GroupInfo;
 import com.google.gerrit.reviewdb.client.Account;
-import com.google.gerrit.reviewdb.client.Account.Id;
 import com.google.gerrit.reviewdb.client.Project;
 import com.google.gerrit.server.IdentifiedUser;
 import com.google.gerrit.server.account.AccountResolver;
 import com.google.gerrit.server.account.AccountResource;
+import com.google.gerrit.server.account.AccountState;
 import com.google.gerrit.server.git.meta.MetaDataUpdate;
 import com.google.gerrit.server.project.ProjectConfig;
 import com.google.gerrit.server.restapi.account.GetGroups;
@@ -65,23 +65,26 @@
       MetaDataUpdate.Server metaDataUpdateFactory,
       Provider<GetGroups> accountGetGroups,
       AccountResolver accountResolver,
-      IdentifiedUser.GenericFactory userFactory) {
+      IdentifiedUser.GenericFactory userFactory,
+      ProjectConfig.Factory projectConfigFactory) {
     this.metaDataUpdateFactory = metaDataUpdateFactory;
     this.accountGetGroups = accountGetGroups;
     this.accountResolver = accountResolver;
     this.userFactory = userFactory;
+    this.projectConfigFactory = projectConfigFactory;
   }
 
   private final MetaDataUpdate.Server metaDataUpdateFactory;
   private final AccountResolver accountResolver;
   private final Provider<GetGroups> accountGetGroups;
   private final IdentifiedUser.GenericFactory userFactory;
+  private final ProjectConfig.Factory projectConfigFactory;
   private int columns = 80;
   private int permissionGroupWidth;
 
   @Override
   public void run() throws UnloggedFailure, Failure, Exception {
-    Account account;
+    AccountState account;
     String sectionNameFormatter = "  %-25s\n";
     String ruleNameFormatter = "    %-15s\n ";
     String permissionNameFormatter = "      %5s %9s %s\n";
@@ -99,7 +102,7 @@
           "You need to tell me who to find:  LastName,\\\\ Firstname, email@address.com, account id or an user name.  "
               + "Be sure to double-escape spaces, for example: \"show-repo-account-access All-Projects --user Last,\\\\ First\"");
     }
-    Set<Id> idList = accountResolver.findAll(name);
+    Set<Account.Id> idList = accountResolver.resolve(name).asIdSet();
     if (idList.isEmpty()) {
       throw new UnloggedFailure(
           1,
@@ -114,14 +117,14 @@
     try {
       MetaDataUpdate md = metaDataUpdateFactory.create(nameKey);
       ProjectConfig config;
-      config = ProjectConfig.read(md);
+      config = projectConfigFactory.read(md);
 
       permissionGroupWidth = wide ? Integer.MAX_VALUE : columns - 9 - 5 - 9;
 
-      for (Id id : idList) {
+      for (Account.Id id : idList) {
         userHasPermissionsInProject = false;
-        account = accountResolver.find(id.toString());
-        stdout.println("Full name:         " + account.getFullName());
+        account = accountResolver.resolve(id.toString()).asUnique();
+        stdout.println("Full name:         " + account.getAccount().getFullName());
         // Need to know what groups the user is in. This is not a great
         // solution, but it does work.
         List<GroupInfo> groupInfos =