当前位置: 首页>>代码示例>>Java>>正文


Java PutName类代码示例

本文整理汇总了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);
  }
}
 
开发者ID:GerritCodeReview,项目名称:plugins_github,代码行数:27,代码来源:AccountController.java

示例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;
}
 
开发者ID:GerritCodeReview,项目名称:plugins_github,代码行数:16,代码来源:AccountController.java


注:本文中的com.google.gerrit.server.account.PutName类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。