LCOV - code coverage report
Current view: top level - server/restapi/change - GetDetail.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 12 16 75.0 %
Date: 2022-11-19 15:00:39 Functions: 4 6 66.7 %

          Line data    Source code
       1             : // Copyright (C) 2013 The Android Open Source Project
       2             : //
       3             : // Licensed under the Apache License, Version 2.0 (the "License");
       4             : // you may not use this file except in compliance with the License.
       5             : // You may obtain a copy of the License at
       6             : //
       7             : // http://www.apache.org/licenses/LICENSE-2.0
       8             : //
       9             : // Unless required by applicable law or agreed to in writing, software
      10             : // distributed under the License is distributed on an "AS IS" BASIS,
      11             : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12             : // See the License for the specific language governing permissions and
      13             : // limitations under the License.
      14             : 
      15             : package com.google.gerrit.server.restapi.change;
      16             : 
      17             : import com.google.gerrit.extensions.client.ListChangesOption;
      18             : import com.google.gerrit.extensions.common.ChangeInfo;
      19             : import com.google.gerrit.extensions.restapi.BadRequestException;
      20             : import com.google.gerrit.extensions.restapi.Response;
      21             : import com.google.gerrit.extensions.restapi.RestApiException;
      22             : import com.google.gerrit.extensions.restapi.RestReadView;
      23             : import com.google.gerrit.server.DynamicOptions;
      24             : import com.google.gerrit.server.DynamicOptions.DynamicBean;
      25             : import com.google.gerrit.server.change.ChangeResource;
      26             : import com.google.inject.Inject;
      27             : import org.kohsuke.args4j.Option;
      28             : 
      29             : public class GetDetail implements RestReadView<ChangeResource>, DynamicOptions.BeanReceiver {
      30             :   private final GetChange delegate;
      31             : 
      32             :   @Option(name = "-o", usage = "Output options")
      33             :   void addOption(ListChangesOption o) {
      34           0 :     delegate.addOption(o);
      35           0 :   }
      36             : 
      37             :   @Option(name = "-O", usage = "Output option flags, in hex")
      38             :   void setOptionFlagsHex(String hex) throws BadRequestException {
      39           0 :     delegate.setOptionFlagsHex(hex);
      40           0 :   }
      41             : 
      42             :   @Inject
      43          57 :   GetDetail(GetChange delegate) {
      44          57 :     this.delegate = delegate;
      45          57 :     delegate.addOption(ListChangesOption.LABELS);
      46          57 :     delegate.addOption(ListChangesOption.DETAILED_LABELS);
      47          57 :     delegate.addOption(ListChangesOption.DETAILED_ACCOUNTS);
      48          57 :     delegate.addOption(ListChangesOption.MESSAGES);
      49          57 :     delegate.addOption(ListChangesOption.REVIEWER_UPDATES);
      50          57 :   }
      51             : 
      52             :   @Override
      53             :   public void setDynamicBean(String plugin, DynamicBean dynamicBean) {
      54           1 :     delegate.setDynamicBean(plugin, dynamicBean);
      55           1 :   }
      56             : 
      57             :   @Override
      58             :   public Class<? extends DynamicOptions.BeanReceiver> getExportedBeanReceiver() {
      59           3 :     return delegate.getExportedBeanReceiver();
      60             :   }
      61             : 
      62             :   @Override
      63             :   public Response<ChangeInfo> apply(ChangeResource rsrc) throws RestApiException {
      64           3 :     return delegate.apply(rsrc);
      65             :   }
      66             : }

Generated by: LCOV version 1.16+git.20220603.dfeb750