Search in sources :

Example 1 with GetMetaDiff

use of com.google.gerrit.server.restapi.change.GetMetaDiff in project gerrit by GerritCodeReview.

the class ChangeApiImpl method metaDiff.

@Override
public ChangeInfoDifference metaDiff(@Nullable String oldMetaRevId, @Nullable String newMetaRevId, EnumSet<ListChangesOption> options, ImmutableListMultimap<String, String> pluginOptions) throws RestApiException {
    try (DynamicOptions dynamicOptions = new DynamicOptions(injector, dynamicBeans)) {
        GetMetaDiff metaDiff = getMetaDiffProvider.get();
        metaDiff.setOldMetaRevId(oldMetaRevId);
        metaDiff.setNewMetaRevId(newMetaRevId);
        options.forEach(metaDiff::addOption);
        dynamicOptionParser.parseDynamicOptions(metaDiff, pluginOptions, dynamicOptions);
        return metaDiff.apply(change).value();
    } catch (Exception e) {
        throw asRestApiException("Cannot retrieve metaDiff", e);
    }
}
Also used : DynamicOptions(com.google.gerrit.server.DynamicOptions) GetMetaDiff(com.google.gerrit.server.restapi.change.GetMetaDiff) ApiUtil.asRestApiException(com.google.gerrit.server.api.ApiUtil.asRestApiException) BadRequestException(com.google.gerrit.extensions.restapi.BadRequestException) IllegalLabelException(com.google.gerrit.server.StarredChangesUtil.IllegalLabelException) RestApiException(com.google.gerrit.extensions.restapi.RestApiException) StorageException(com.google.gerrit.exceptions.StorageException) CmdLineException(org.kohsuke.args4j.CmdLineException)

Aggregations

StorageException (com.google.gerrit.exceptions.StorageException)1 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)1 RestApiException (com.google.gerrit.extensions.restapi.RestApiException)1 DynamicOptions (com.google.gerrit.server.DynamicOptions)1 IllegalLabelException (com.google.gerrit.server.StarredChangesUtil.IllegalLabelException)1 ApiUtil.asRestApiException (com.google.gerrit.server.api.ApiUtil.asRestApiException)1 GetMetaDiff (com.google.gerrit.server.restapi.change.GetMetaDiff)1 CmdLineException (org.kohsuke.args4j.CmdLineException)1