Build with 2.16-SNAPSHOT API and adjust to API changes
Change-Id: I1a892c7917503095b34d63f759a6ba05668b05e8
diff --git a/WORKSPACE b/WORKSPACE
index 796c3b3..ea765ed 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,24 +3,24 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "0a528d17394aa49f08f61622ef74b47c36621e71",
+ commit = "8c91ef43828699c7ed33976897991a427dcfe04b",
# local_path = "/home/<user>/projects/bazlets",
)
#Snapshot Plugin API
-#load(
-# "@com_googlesource_gerrit_bazlets//:gerrit_api_maven_local.bzl",
-# "gerrit_api_maven_local",
-#)
-
-#Load snapshot Plugin API
-#gerrit_api_maven_local()
-
-# Release Plugin API
load(
- "@com_googlesource_gerrit_bazlets//:gerrit_api.bzl",
- "gerrit_api",
+ "@com_googlesource_gerrit_bazlets//:gerrit_api_maven_local.bzl",
+ "gerrit_api_maven_local",
)
+#Load snapshot Plugin API
+gerrit_api_maven_local()
+
+# Release Plugin API
+#load(
+# "@com_googlesource_gerrit_bazlets//:gerrit_api.bzl",
+# "gerrit_api",
+#)
+
# Load release Plugin API
-gerrit_api()
+#gerrit_api()
diff --git a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ListUsersCommand.java b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ListUsersCommand.java
index 96b9c77..78ac5ab 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ListUsersCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ListUsersCommand.java
@@ -71,7 +71,9 @@
.append(account.getId().toString())
.append(" |")
.append(
- Strings.isNullOrEmpty(account.getUserName()) ? "" : " " + account.getUserName())
+ Strings.isNullOrEmpty(accountState.getUserName().get())
+ ? ""
+ : " " + accountState.getUserName().get())
.append(" |")
.append(
Strings.isNullOrEmpty(account.getFullName()) ? "" : " " + account.getFullName())
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 6dfb9db..bcd722a 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java
@@ -25,11 +25,12 @@
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.GetGroups;
-import com.google.gerrit.server.account.GetSshKeys;
+import com.google.gerrit.server.account.AccountState;
import com.google.gerrit.server.account.externalids.ExternalId;
import com.google.gerrit.server.account.externalids.ExternalIds;
import com.google.gerrit.server.permissions.PermissionBackendException;
+import com.google.gerrit.server.restapi.account.GetGroups;
+import com.google.gerrit.server.restapi.account.GetSshKeys;
import com.google.gerrit.sshd.CommandMetaData;
import com.google.gerrit.sshd.SshCommand;
import com.google.inject.Inject;
@@ -67,6 +68,7 @@
private final IdentifiedUser.GenericFactory userFactory;
private final Provider<GetSshKeys> getSshKeys;
private final ExternalIds externalIds;
+ private final AccountState accountState;
@Inject
ShowAccountCommand(
@@ -74,12 +76,14 @@
Provider<GetGroups> accountGetGroups,
IdentifiedUser.GenericFactory userFactory,
Provider<GetSshKeys> getSshKeys,
- ExternalIds externalIds) {
+ ExternalIds externalIds,
+ AccountState accountState) {
this.accountResolver = accountResolver;
this.accountGetGroups = accountGetGroups;
this.userFactory = userFactory;
this.getSshKeys = getSshKeys;
this.externalIds = externalIds;
+ this.accountState = accountState;
}
@Override
@@ -119,7 +123,7 @@
stdout.println("Full name: " + account.getFullName());
stdout.println("Account Id: " + id.toString());
stdout.println("Preferred Email: " + account.getPreferredEmail());
- stdout.println("User Name: " + account.getUserName());
+ stdout.println("User Name: " + accountState.getUserName().get());
stdout.println("Active: " + account.isActive());
stdout.println("Registered on: " + account.getRegisteredOn());
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 60ef2d4..eed2ae8 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccountAccessCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccountAccessCommand.java
@@ -27,9 +27,9 @@
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.GetGroups;
import com.google.gerrit.server.git.MetaDataUpdate;
import com.google.gerrit.server.git.ProjectConfig;
+import com.google.gerrit.server.restapi.account.GetGroups;
import com.google.gerrit.sshd.CommandMetaData;
import com.google.gerrit.sshd.SshCommand;
import com.google.inject.Inject;