use of com.google.gerrit.extensions.common.AccountInfo in project gerrit by GerritCodeReview.
the class GetPastAssignees method apply.
@Override
public Response<List<AccountInfo>> apply(ChangeResource rsrc) throws OrmException {
Set<Account.Id> pastAssignees = rsrc.getControl().getNotes().load().getPastAssignees();
if (pastAssignees == null) {
return Response.ok(Collections.emptyList());
}
AccountLoader accountLoader = accountLoaderFactory.create(true);
List<AccountInfo> infos = pastAssignees.stream().map(accountLoader::get).collect(toList());
accountLoader.fill();
return Response.ok(infos);
}
use of com.google.gerrit.extensions.common.AccountInfo in project gerrit by GerritCodeReview.
the class AddMembers method toAccountInfoList.
private List<AccountInfo> toAccountInfoList(Set<Account.Id> accountIds) throws OrmException {
List<AccountInfo> result = new ArrayList<>();
AccountLoader loader = infoFactory.create(true);
for (Account.Id accId : accountIds) {
result.add(loader.get(accId));
}
loader.fill();
return result;
}
use of com.google.gerrit.extensions.common.AccountInfo in project gerrit by GerritCodeReview.
the class GetMember method apply.
@Override
public AccountInfo apply(MemberResource rsrc) throws OrmException {
AccountLoader loader = infoFactory.create(true);
AccountInfo info = loader.get(rsrc.getMember().getAccountId());
loader.fill();
return info;
}
use of com.google.gerrit.extensions.common.AccountInfo in project gerrit by GerritCodeReview.
the class AbstractQueryAccountsTest method isActive.
@Test
public void isActive() throws Exception {
String domain = name("test.com");
AccountInfo user1 = newAccountWithEmail("user1", "user1@" + domain);
AccountInfo user2 = newAccountWithEmail("user2", "user2@" + domain);
AccountInfo user3 = newAccount("user3", "user3@" + domain, false);
AccountInfo user4 = newAccount("user4", "user4@" + domain, false);
// by default only active accounts are returned
assertQuery(domain, user1, user2);
assertQuery("name:" + domain, user1, user2);
assertQuery("is:active name:" + domain, user1, user2);
assertQuery("is:inactive name:" + domain, user3, user4);
}
use of com.google.gerrit.extensions.common.AccountInfo in project gerrit by GerritCodeReview.
the class AbstractQueryAccountsTest method byWatchedProject.
@Test
public void byWatchedProject() throws Exception {
Project.NameKey p = createProject(name("p"));
Project.NameKey p2 = createProject(name("p2"));
AccountInfo user1 = newAccountWithFullName("jdoe", "John Doe");
AccountInfo user2 = newAccountWithFullName("jroe", "Jane Roe");
AccountInfo user3 = newAccountWithFullName("user3", "Mr Selfish");
assertThat(internalAccountQuery.byWatchedProject(p)).isEmpty();
watch(user1, p, null);
assertAccounts(internalAccountQuery.byWatchedProject(p), user1);
watch(user2, p, "keyword");
assertAccounts(internalAccountQuery.byWatchedProject(p), user1, user2);
watch(user3, p2, "keyword");
watch(user3, allProjects, "keyword");
assertAccounts(internalAccountQuery.byWatchedProject(p), user1, user2);
assertAccounts(internalAccountQuery.byWatchedProject(p2), user3);
assertAccounts(internalAccountQuery.byWatchedProject(allProjects), user3);
}
Aggregations