Line data Source code
1 : // Copyright (C) 2020 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.entities.PatchSet; 18 : import com.google.gerrit.extensions.annotations.ExtensionPoint; 19 : import com.google.gerrit.server.IdentifiedUser; 20 : import com.google.gerrit.server.notedb.ChangeNotes; 21 : import java.util.Map; 22 : import java.util.Optional; 23 : 24 : /** Extension point that is invoked on post review. */ 25 : @ExtensionPoint 26 : public interface OnPostReview { 27 : /** 28 : * Allows implementors to return a message that should be included into the change message that is 29 : * posted on post review. 30 : * 31 : * @param user the user that posts the review 32 : * @param changeNotes the change on which post review is performed 33 : * @param patchSet the patch set on which post review is performed 34 : * @param oldApprovals old approvals that changed as result of post review 35 : * @param approvals all current approvals 36 : * @return message that should be included into the change message that is posted on post review, 37 : * {@link Optional#empty()} if the change message should not be extended 38 : */ 39 : default Optional<String> getChangeMessageAddOn( 40 : IdentifiedUser user, 41 : ChangeNotes changeNotes, 42 : PatchSet patchSet, 43 : Map<String, Short> oldApprovals, 44 : Map<String, Short> approvals) { 45 0 : return Optional.empty(); 46 : } 47 : }