本文整理汇总了Java中com.google.gerrit.server.account.PutName类的典型用法代码示例。如果您正苦于以下问题:Java PutName类的具体用法?Java PutName怎么用?Java PutName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PutName类属于com.google.gerrit.server.account包,在下文中一共展示了PutName类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAccountIdentity
import com.google.gerrit.server.account.PutName; //导入依赖的package包/类
private void setAccountIdentity(IdentifiedUser user, HttpServletRequest req)
throws ServletException, ConfigInvalidException {
String fullName = req.getParameter("fullname");
String email = req.getParameter("email");
try {
Id accountId = user.getAccountId();
AuthResult result = accountManager.link(accountId, AuthRequest.forEmail(email));
log.debug("Account {} linked to email {}: result = {}", accountId, email, result);
putPreferred.apply(new AccountResource.Email(user, email), null);
PutName.Input nameInput = new PutName.Input();
nameInput.name = fullName;
putName.apply(user, nameInput);
log.debug(
"Account {} updated with preferredEmail = {} and fullName = {}",
accountId,
email,
fullName);
accountCache.evict(accountId);
log.debug("Account cache evicted for {}", accountId);
} catch (Exception e) {
throw new ServletException(
"Cannot associate email '" + email + "' to current user '" + user + "'", e);
}
}
示例2: AccountController
import com.google.gerrit.server.account.PutName; //导入依赖的package包/类
@Inject
public AccountController(
final AddSshKey restAddSshKey,
final GetSshKeys restGetSshKeys,
final AccountManager accountManager,
final AccountCache accountCache,
final PutPreferred putPreferred,
final PutName putName) {
this.restAddSshKey = restAddSshKey;
this.restGetSshKeys = restGetSshKeys;
this.accountManager = accountManager;
this.accountCache = accountCache;
this.putPreferred = putPreferred;
this.putName = putName;
}