Add full name to account index and query by full name in AccountResolver

Add a new field for the full name to the account index that allows
exact lookups by full name. In AccountResolver do lookups by full name
via the account index, if an account index exists.

This is a preparation for moving the account properties from ReviewDb
into git.

Change-Id: I1dc2eae98280b70354b48f6333d23b89acc8501a
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2016-07-13 15:35:15 +02:00
parent e615d01809
commit 38b73e2358
5 changed files with 35 additions and 8 deletions

View File

@@ -84,6 +84,15 @@ public class AccountField {
}
};
public static final FieldDef<AccountState, String> FULL_NAME =
new FieldDef.Single<AccountState, String>("full_name", FieldType.EXACT,
false) {
@Override
public String get(AccountState input, FillArgs args) {
return input.getAccount().getFullName();
}
};
public static final FieldDef<AccountState, String> ACTIVE =
new FieldDef.Single<AccountState, String>(
"inactive", FieldType.EXACT, false) {

View File

@@ -33,6 +33,9 @@ public class AccountSchemaDefinitions extends SchemaDefinitions<AccountState> {
static final Schema<AccountState> V2 =
schema(V1, AccountField.WATCHED_PROJECT);
static final Schema<AccountState> V3 =
schema(V2, AccountField.FULL_NAME);
public static final AccountSchemaDefinitions INSTANCE =
new AccountSchemaDefinitions();