• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RestApiException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.gerrit.extensions.restapi.RestApiException的典型用法代码示例。如果您正苦于以下问题:Java RestApiException类的具体用法?Java RestApiException怎么用?Java RestApiException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RestApiException类属于com.google.gerrit.extensions.restapi包,在下文中一共展示了RestApiException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: apply

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
@Override
public ConsistencyCheckInfo apply(ConfigResource resource, ConsistencyCheckInput input)
    throws RestApiException, IOException, OrmException, PermissionBackendException {
  permissionBackend.user(user).check(GlobalPermission.ACCESS_DATABASE);

  if (input == null || (input.checkAccounts == null && input.checkAccountExternalIds == null)) {
    throw new BadRequestException("input required");
  }

  ConsistencyCheckInfo consistencyCheckInfo = new ConsistencyCheckInfo();
  if (input.checkAccounts != null) {
    consistencyCheckInfo.checkAccountsResult =
        new CheckAccountsResultInfo(accountsConsistencyChecker.check());
  }
  if (input.checkAccountExternalIds != null) {
    consistencyCheckInfo.checkAccountExternalIdsResult =
        new CheckAccountExternalIdsResultInfo(externalIdsConsistencyChecker.check());
  }

  return consistencyCheckInfo;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:22,代码来源:CheckConsistency.java


示例2: getOpenChanges

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
private HashSet<Integer> getOpenChanges(Changes.QueryRequest changeQuery)
    throws RestApiException {
  HashSet<Integer> openChanges = new HashSet<>();

  for (ChangeInfo change : changeQuery.get()) {
    openChanges.add(new Integer(change._number));
  }

  return openChanges;
}
 
开发者ID:GerritForge,项目名称:gerrit-plugin,代码行数:11,代码来源:AbstractGerritSCMSource.java


示例3: accessChange

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
@Override
public ChangeInfo accessChange(ProjectAccessInput p) throws RestApiException {
  try {
    return createAccessChange.apply(checkExists(), p).value();
  } catch (Exception e) {
    throw asRestApiException("Cannot put access right change", e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:ProjectApiImpl.java


示例4: self

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
@Override
public AccountApi self() throws RestApiException {
  if (!self.get().isIdentifiedUser()) {
    throw new AuthException("Authentication required");
  }
  return api.create(new AccountResource(self.get().asIdentifiedUser()));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:8,代码来源:AccountsImpl.java


示例5: get

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
public List<PluginInfo> get() throws RestApiException {
  Map<String, PluginInfo> map = getAsMap();
  List<PluginInfo> result = new ArrayList<>(map.size());
  for (Map.Entry<String, PluginInfo> e : map.entrySet()) {
    result.add(e.getValue());
  }
  return result;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:Plugins.java


示例6: child

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
@Override
public ChildProjectApi child(String name) throws RestApiException {
  try {
    return childApi.create(children.parse(checkExists(), IdString.fromDecoded(name)));
  } catch (Exception e) {
    throw asRestApiException("Cannot parse child project", e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:ProjectApiImpl.java


示例7: query

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
@Override
public QueryRequest query() throws RestApiException {
  return new QueryRequest() {
    @Override
    public List<AccountInfo> get() throws RestApiException {
      return AccountsImpl.this.query(this);
    }
  };
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:10,代码来源:AccountsImpl.java


示例8: delete

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
@Override
public CommentInfo delete(DeleteCommentInput input) throws RestApiException {
  try {
    return deleteComment.apply(comment, input);
  } catch (Exception e) {
    throw asRestApiException("Cannot delete comment", e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:CommentApiImpl.java


示例9: apply

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
@Override
public List<ProjectWatchInfo> apply(AccountResource rsrc, List<ProjectWatchInfo> input)
    throws OrmException, RestApiException, IOException, ConfigInvalidException,
        PermissionBackendException {
  if (self.get() != rsrc.getUser()) {
    permissionBackend.user(self).check(GlobalPermission.ADMINISTRATE_SERVER);
  }

  Account.Id accountId = rsrc.getUser().getAccountId();
  watchConfig.upsertProjectWatches(accountId, asMap(input));
  accountCache.evict(accountId);
  return getWatchedProjects.apply(rsrc);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:14,代码来源:PostWatchedProjects.java


示例10: applyImpl

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
@Override
protected Response<?> applyImpl(
    BatchUpdate.Factory updateFactory, VoteResource rsrc, DeleteVoteInput input)
    throws RestApiException, UpdateException, IOException {
  if (input == null) {
    input = new DeleteVoteInput();
  }
  if (input.label != null && !rsrc.getLabel().equals(input.label)) {
    throw new BadRequestException("label must match URL");
  }
  if (input.notify == null) {
    input.notify = NotifyHandling.ALL;
  }
  ReviewerResource r = rsrc.getReviewer();
  Change change = r.getChange();

  if (r.getRevisionResource() != null && !r.getRevisionResource().isCurrent()) {
    throw new MethodNotAllowedException("Cannot delete vote on non-current patch set");
  }

  try (BatchUpdate bu =
      updateFactory.create(
          db.get(), change.getProject(), r.getChangeResource().getUser(), TimeUtil.nowTs())) {
    bu.addOp(
        change.getId(),
        new Op(
            projectCache.checkedGet(r.getChange().getProject()),
            r.getReviewerUser().getAccount(),
            rsrc.getLabel(),
            input));
    bu.execute();
  }

  return Response.none();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:36,代码来源:DeleteVote.java


示例11: robotComments

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
@Override
public Map<String, List<RobotCommentInfo>> robotComments() throws RestApiException {
  try {
    return listRobotComments.apply(revision);
  } catch (Exception e) {
    throw asRestApiException("Cannot retrieve robot comments", e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:RevisionApiImpl.java


示例12: check

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
@Override
public ChangeInfo check(FixInput fix) throws RestApiException {
  try {
    // TODO(dborowitz): Convert to RetryingRestModifyView. Needs to plumb BatchUpdate.Factory into
    // ConsistencyChecker.
    return check.apply(change, fix).value();
  } catch (Exception e) {
    throw asRestApiException("Cannot check change", e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:11,代码来源:ChangeApiImpl.java


示例13: files

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Map<String, FileInfo> files() throws RestApiException {
  try {
    return (Map<String, FileInfo>) listFiles.apply(revision).value();
  } catch (Exception e) {
    throw asRestApiException("Cannot retrieve files", e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:10,代码来源:RevisionApiImpl.java


示例14: createDraft

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
@Override
public DraftApi createDraft(DraftInput in) throws RestApiException {
  try {
    String id = createDraft.apply(revision, in).value().id;
    // Reread change to pick up new notes refs.
    return changes
        .id(revision.getChange().getId().get())
        .revision(revision.getPatchSet().getId().get())
        .draft(id);
  } catch (Exception e) {
    throw asRestApiException("Cannot create draft", e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:14,代码来源:RevisionApiImpl.java


示例15: verifyOne

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
private void verifyOne(PatchSet patchSet) throws UnloggedFailure {
  VerifyInput verify = new VerifyInput();
  verify.verifications = jobResult;
  try {
    applyVerification(patchSet, verify);
  } catch (RestApiException | NoSuchChangeException | OrmException
      | IOException e) {
    throw PatchSetParser.error(e.getMessage());
  }
}
 
开发者ID:davido,项目名称:gerrit-ci-plugin,代码行数:11,代码来源:VerifyCommand.java


示例16: listGpgKeys

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
@Override
public Map<String, GpgKeyInfo> listGpgKeys(AccountResource account)
    throws RestApiException, GpgException {
  try {
    return gpgKeys.get().list().apply(account);
  } catch (OrmException | PGPException | IOException e) {
    throw new GpgException(e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:10,代码来源:GpgApiAdapterImpl.java


示例17: putGpgKeys

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
@Override
public Map<String, GpgKeyInfo> putGpgKeys(
    AccountResource account, List<String> add, List<String> delete)
    throws RestApiException, GpgException {
  GpgKeysInput in = new GpgKeysInput();
  in.add = add;
  in.delete = delete;
  try {
    return postGpgKeys.get().apply(account, in);
  } catch (PGPException | OrmException | IOException | ConfigInvalidException e) {
    throw new GpgException(e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:14,代码来源:GpgApiAdapterImpl.java


示例18: list

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
private SortedMap<String, ProjectInfo> list(ListRequest request)
    throws RestApiException, PermissionBackendException {
  ListProjects lp = listProvider.get();
  lp.setShowDescription(request.getDescription());
  lp.setLimit(request.getLimit());
  lp.setStart(request.getStart());
  lp.setMatchPrefix(request.getPrefix());

  lp.setMatchSubstring(request.getSubstring());
  lp.setMatchRegex(request.getRegex());
  lp.setShowTree(request.getShowTree());
  for (String branch : request.getBranches()) {
    lp.addShowBranch(branch);
  }

  FilterType type;
  switch (request.getFilterType()) {
    case ALL:
      type = FilterType.ALL;
      break;
    case CODE:
      type = FilterType.CODE;
      break;
    case PARENT_CANDIDATES:
      type = FilterType.PARENT_CANDIDATES;
      break;
    case PERMISSIONS:
      type = FilterType.PERMISSIONS;
      break;
    default:
      throw new BadRequestException("Unknown filter type: " + request.getFilterType());
  }
  lp.setFilterType(type);

  return lp.apply();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:37,代码来源:ProjectsImpl.java


示例19: review

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
@Override
public ReviewResult review(ReviewInput in) throws RestApiException {
  try {
    return review.apply(revision, in).value();
  } catch (Exception e) {
    throw asRestApiException("Cannot post review", e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:RevisionApiImpl.java


示例20: submittedTogether

import com.google.gerrit.extensions.restapi.RestApiException; //导入依赖的package包/类
@Override
public List<ChangeInfo> submittedTogether() throws RestApiException {
  SubmittedTogetherInfo info =
      submittedTogether(
          EnumSet.noneOf(ListChangesOption.class), EnumSet.noneOf(SubmittedTogetherOption.class));
  return info.changes;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:8,代码来源:ChangeApiImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PentahoSessionHolder类代码示例发布时间:2022-05-22
下一篇:
Java Color类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap