本文整理汇总了Java中com.google.gerrit.extensions.restapi.RestApiException类的典型用法代码示例。如果您正苦于以下问题:Java RestApiException类的具体用法?Java RestApiException怎么用?Java RestApiException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RestApiException类属于com.google.gerrit.extensions.restapi包,在下文中一共展示了RestApiException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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);
}
}
示例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()));
}
示例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;
}
示例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);
}
}
示例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);
}
};
}
示例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);
}
}
示例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);
}
示例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();
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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());
}
}