use of com.google.gerrit.extensions.restapi.RestApiException in project gerrit by GerritCodeReview.
the class DashboardApiImpl method setDefault.
@Override
public void setDefault() throws RestApiException {
SetDashboardInput input = new SetDashboardInput();
input.id = id;
try {
set.apply(DashboardResource.projectDefault(project.getProjectState(), project.getUser()), input);
} catch (Exception e) {
String msg = String.format("Cannot %s default dashboard", id != null ? "set" : "remove");
throw asRestApiException(msg, e);
}
}
use of com.google.gerrit.extensions.restapi.RestApiException in project gerrit by GerritCodeReview.
the class ProjectApiImpl method head.
@Override
public void head(String head) throws RestApiException {
HeadInput input = new HeadInput();
input.ref = head;
try {
setHead.apply(checkExists(), input);
} catch (Exception e) {
throw asRestApiException("Cannot set HEAD", e);
}
}
use of com.google.gerrit.extensions.restapi.RestApiException in project gerrit by GerritCodeReview.
the class ProjectApiImpl method index.
@Override
public void index(boolean indexChildren) throws RestApiException {
try {
IndexProjectInput input = new IndexProjectInput();
input.indexChildren = indexChildren;
index.apply(checkExists(), input);
} catch (Exception e) {
throw asRestApiException("Cannot index project", e);
}
}
use of com.google.gerrit.extensions.restapi.RestApiException in project gerrit by GerritCodeReview.
the class LabelApiImpl method create.
@Override
public LabelApi create(LabelDefinitionInput input) throws RestApiException {
try {
createLabel.apply(project, IdString.fromDecoded(label), input);
// recreate project resource because project state was updated by creating the new label and
// needs to be reloaded
project = new ProjectResource(projectCache.get(project.getNameKey()).orElseThrow(illegalState(project.getNameKey())), project.getUser());
return this;
} catch (Exception e) {
throw asRestApiException("Cannot create branch", e);
}
}
use of com.google.gerrit.extensions.restapi.RestApiException in project gerrit by GerritCodeReview.
the class AccountsImpl method suggestAccounts.
private List<AccountInfo> suggestAccounts(SuggestAccountsRequest r) throws RestApiException {
try {
QueryAccounts myQueryAccounts = queryAccountsProvider.get();
myQueryAccounts.setSuggest(true);
myQueryAccounts.setQuery(r.getQuery());
myQueryAccounts.setLimit(r.getLimit());
return myQueryAccounts.apply(TopLevelResource.INSTANCE).value();
} catch (Exception e) {
throw asRestApiException("Cannot retrieve suggested accounts", e);
}
}
Aggregations