com.google.gerrit.extensions.restapi.RestApiException Java Examples

The following examples show how to use com.google.gerrit.extensions.restapi.RestApiException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GerritFileDiffBuilderWrapper.java    From sputnik with Apache License 2.0 5 votes vote down vote up
@Nonnull
public List<FileDiff> buildFileDiffs() {
    log.info("Query all file diffs to only include comments on modified lines");

    try {
        RevisionApi revision = gerritFacade.getRevision();
        List<FileDiff> fileDiffs = revision.files().keySet().stream()
                .map(fileName -> this.buildFileDiff(gerritFileDiffBuilder, revision, fileName))
                .collect(Collectors.toList());
        log.info("Query all file diffs finished");
        return fileDiffs;
    } catch (RestApiException e) {
        throw new GerritException("Error when retrieve modified lines", e);
    }
}
 
Example #2
Source File: ProjectApiRestClient.java    From gerrit-rest-java-client with Apache License 2.0 5 votes vote down vote up
@Override
public ListRefsRequest<TagInfo> tags() {
    return new ListRefsRequest<TagInfo>() {
        @Override
        public List<TagInfo> get() throws RestApiException {
            return ProjectApiRestClient.this.getTagInfos(this);
        }
    };
}
 
Example #3
Source File: FileApiRestClient.java    From gerrit-rest-java-client with Apache License 2.0 5 votes vote down vote up
private DiffInfo diff(DiffRequest diffRequest, int parent) throws RestApiException {
    String query = "";

    if (!Strings.isNullOrEmpty(diffRequest.getBase())) {
        query = UrlUtils.appendToUrlQuery(query, "base=" + diffRequest.getBase());
    }
    if (diffRequest.getContext() != null) {
        query = UrlUtils.appendToUrlQuery(query, "context=" + diffRequest.getContext());
    }
    if (diffRequest.getIntraline() != null) {
        query = UrlUtils.appendToUrlQuery(query, "intraline=" + diffRequest.getIntraline());
    }
    if (diffRequest.getWhitespace() != null) {
        query = UrlUtils.appendToUrlQuery(query, "whitespace=" + diffRequest.getWhitespace());
    }
    if (parent > 0) {
        query = UrlUtils.appendToUrlQuery(query, "parent=" + parent);
    }

    String url = getRequestPath() +  "/diff";
    if (!Strings.isNullOrEmpty(query)) {
        url += '?' + query;
    }

    JsonElement jsonElement = gerritRestClient.getRequest(url);
    return diffInfoParser.parseDiffInfo(jsonElement);
}
 
Example #4
Source File: AccountsRestClient.java    From gerrit-rest-java-client with Apache License 2.0 5 votes vote down vote up
/**
 * Added in Gerrit 2.11.
 */
@Override
public SuggestAccountsRequest suggestAccounts() throws RestApiException {
    return new SuggestAccountsRequest() {
        @Override
        public List<AccountInfo> get() throws RestApiException {
            return AccountsRestClient.this.suggestAccounts(this);
        }
    };
}
 
Example #5
Source File: EmailApi.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public EmailInfo get() throws RestApiException {
  throw new NotImplementedException();
}
 
Example #6
Source File: Plugins.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public PluginApi install(String name, InstallPluginInput input) throws RestApiException {
  throw new NotImplementedException();
}
 
Example #7
Source File: GerritRestClient.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public JsonElement putRequest(String path, String requestBody) throws RestApiException {
    return requestJson(path, requestBody, HttpVerb.PUT);
}
 
Example #8
Source File: ChangeApi.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public Set<String> getHashtags() throws RestApiException {
  throw new NotImplementedException();
}
 
Example #9
Source File: FileApi.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public BinaryResult content() throws RestApiException {
  throw new NotImplementedException();
}
 
Example #10
Source File: DraftApiRestClient.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public void delete() throws RestApiException {
    gerritRestClient.deleteRequest(getUrl());
}
 
Example #11
Source File: DraftApi.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public void delete() throws RestApiException {
  throw new NotImplementedException();
}
 
Example #12
Source File: RevisionApiRestClient.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
private TreeMap<String, List<CommentInfo>> comments(String type) throws RestApiException {
    String request = getRequestPath() + '/' + type + '/';
    JsonElement jsonElement = gerritRestClient.getRequest(request);
    return commentsParser.parseCommentInfos(jsonElement);
}
 
Example #13
Source File: DraftApi.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public CommentInfo update(DraftInput in) throws RestApiException {
  throw new NotImplementedException();
}
 
Example #14
Source File: RevisionApiRestClient.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public SubmitType submitType() throws RestApiException {
    String request = getRequestPath() + "/submit_type";
    JsonElement jsonElement = gerritRestClient.getRequest(request);
    return gerritRestClient.getGson().fromJson(jsonElement, new TypeToken<SubmitType>() {}.getType());
}
 
Example #15
Source File: Groups.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
/** Create a new group with the given name and default options. */
GroupApi create(String name) throws RestApiException;
 
Example #16
Source File: ProjectApi.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public ProjectAccessInfo access(ProjectAccessInput p) throws RestApiException {
  throw new NotImplementedException();
}
 
Example #17
Source File: ChangeApiRestClient.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public  Map<String, List<RobotCommentInfo>> robotComments() throws RestApiException {
    String request = getRequestPath() + "/robotcomments";
    JsonElement jsonElement = gerritRestClient.getRequest(request);
    return commentsParser.parseRobotCommentInfos(jsonElement);
}
 
Example #18
Source File: ChangeEditApi.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public void modifyFile(String filePath, RawInput newContent) throws RestApiException {
  throw new NotImplementedException();
}
 
Example #19
Source File: ChangeApi.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public void setReadyForReview(String message) throws RestApiException {
  throw new NotImplementedException();
}
 
Example #20
Source File: ChangeApi.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
/** Check if this change is a pure revert of claimedOriginal (SHA1 in 40 digit hex). */
PureRevertInfo pureRevert(String claimedOriginal) throws RestApiException;
 
Example #21
Source File: ReviewerApi.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public void deleteVote(String label) throws RestApiException {
  throw new NotImplementedException();
}
 
Example #22
Source File: DashboardApi.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public DashboardInfo get() throws RestApiException {
  throw new NotImplementedException();
}
 
Example #23
Source File: RevisionApi.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Deprecated
void delete() throws RestApiException;
 
Example #24
Source File: ChangeApi.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
/** Create a new patch set with a new commit message. */
void setMessage(CommitMessageInput in) throws RestApiException;
 
Example #25
Source File: FileApi.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
/** Diff against the revision's parent version of the file. */
DiffInfo diff() throws RestApiException;
 
Example #26
Source File: ChangeApiRestClient.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public SuggestedReviewersRequest suggestReviewers(String query) throws RestApiException {
    return suggestReviewers().withQuery(query).withLimit(-1); // a limit must be added because of a Gerrit bug; see: https://gerrit-review.googlesource.com/#/c/60242/
}
 
Example #27
Source File: ProjectApiRestClient.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public ProjectApi create(ProjectInput in) throws RestApiException {
    String body = gerritRestClient.getGson().toJson(in);
    gerritRestClient.putRequest(projectsUrl(), body);
    return this;
}
 
Example #28
Source File: ChangeApi.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public AccountInfo setAssignee(AssigneeInput input) throws RestApiException {
  throw new NotImplementedException();
}
 
Example #29
Source File: ChangeApi.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public ChangeInfo check() throws RestApiException {
  throw new NotImplementedException();
}
 
Example #30
Source File: Accounts.java    From gerrit-rest-java-client with Apache License 2.0 4 votes vote down vote up
@Override
public AccountApi self() throws RestApiException {
  throw new NotImplementedException();
}