LCOV - code coverage report
Current view: top level - server/audit - ExtendedHttpAuditEvent.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 7 7 100.0 %
Date: 2022-11-19 15:00:39 Functions: 1 1 100.0 %

          Line data    Source code
       1             : // Copyright (C) 2015 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.audit;
      16             : 
      17             : import static java.util.Objects.requireNonNull;
      18             : 
      19             : import com.google.common.collect.ListMultimap;
      20             : import com.google.gerrit.extensions.restapi.RestResource;
      21             : import com.google.gerrit.extensions.restapi.RestView;
      22             : import com.google.gerrit.server.CurrentUser;
      23             : import javax.servlet.http.HttpServletRequest;
      24             : 
      25             : /** Extended audit event. Adds request, resource and view data to HttpAuditEvent. */
      26             : public class ExtendedHttpAuditEvent extends HttpAuditEvent {
      27             :   public final HttpServletRequest httpRequest;
      28             :   public final RestResource resource;
      29             :   public final RestView<? extends RestResource> view;
      30             : 
      31             :   /**
      32             :    * Creates a new audit event with results
      33             :    *
      34             :    * @param sessionId session id the event belongs to
      35             :    * @param who principal that has generated the event
      36             :    * @param httpRequest the HttpServletRequest
      37             :    * @param when time-stamp of when the event started
      38             :    * @param params parameters of the event
      39             :    * @param input input
      40             :    * @param status HTTP status
      41             :    * @param result result of the event
      42             :    * @param resource REST resource data
      43             :    * @param view view rendering object
      44             :    */
      45             :   public ExtendedHttpAuditEvent(
      46             :       String sessionId,
      47             :       CurrentUser who,
      48             :       HttpServletRequest httpRequest,
      49             :       long when,
      50             :       ListMultimap<String, ?> params,
      51             :       Object input,
      52             :       int status,
      53             :       Object result,
      54             :       RestResource resource,
      55             :       RestView<RestResource> view) {
      56          28 :     super(
      57             :         sessionId,
      58             :         who,
      59          28 :         httpRequest.getRequestURI(),
      60             :         when,
      61             :         params,
      62          28 :         httpRequest.getMethod(),
      63             :         input,
      64             :         status,
      65             :         result);
      66          28 :     this.httpRequest = requireNonNull(httpRequest);
      67          28 :     this.resource = resource;
      68          28 :     this.view = view;
      69          28 :   }
      70             : }

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