use of com.google.gerrit.extensions.restapi.RestApiException in project gerrit by GerritCodeReview.
the class AccountApiImpl method get.
@Override
public com.google.gerrit.extensions.common.AccountInfo get() throws RestApiException {
AccountLoader accountLoader = accountLoaderFactory.create(true);
try {
AccountInfo ai = accountLoader.get(account.getUser().getAccountId());
accountLoader.fill();
return ai;
} catch (Exception e) {
throw asRestApiException("Cannot parse change", e);
}
}
use of com.google.gerrit.extensions.restapi.RestApiException in project gerrit by GerritCodeReview.
the class AccountApiImpl method unstarChange.
@Override
public void unstarChange(String changeId) throws RestApiException {
try {
ChangeResource rsrc = changes.parse(TopLevelResource.INSTANCE, IdString.fromUrl(changeId));
AccountResource.StarredChange starredChange = new AccountResource.StarredChange(account.getUser(), rsrc);
starredChangesDelete.apply(starredChange, new StarredChanges.EmptyInput());
} catch (Exception e) {
throw asRestApiException("Cannot unstar change", e);
}
}
use of com.google.gerrit.extensions.restapi.RestApiException in project gerrit by GerritCodeReview.
the class AccountApiImpl method starChange.
@Override
public void starChange(String changeId) throws RestApiException {
try {
ChangeResource rsrc = changes.parse(TopLevelResource.INSTANCE, IdString.fromUrl(changeId));
starredChangesCreate.setChange(rsrc);
starredChangesCreate.apply(account, new StarredChanges.EmptyInput());
} catch (Exception e) {
throw asRestApiException("Cannot star change", 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);
} catch (Exception e) {
throw asRestApiException("Cannot retrieve suggested accounts", e);
}
}
use of com.google.gerrit.extensions.restapi.RestApiException in project gerrit by GerritCodeReview.
the class RevisionApiImpl method getMergeList.
@Override
public MergeListRequest getMergeList() throws RestApiException {
return new MergeListRequest() {
@Override
public List<CommitInfo> get() throws RestApiException {
try {
GetMergeList gml = getMergeList.get();
gml.setUninterestingParent(getUninterestingParent());
gml.setAddLinks(getAddLinks());
return gml.apply(revision).value();
} catch (Exception e) {
throw asRestApiException("Cannot get merge list", e);
}
}
};
}
Aggregations