New non-blocking function category "NoBlock"

Introducing a new trivial non-blocking function category. For some
process workflows this type of check can prove useful, a practical
example can be that you do not want to give an automatic test tool a
direct blocking capacity but rather leave it up to a human reviewer
to block the change.

Change-Id: I8379095df54f353de2950a84f3ca09a93f5acbed
This commit is contained in:
Ulrik Sjölin
2010-10-24 08:57:46 -07:00
committed by Shawn O. Pearce
parent d5dbf2a41a
commit 9d5008a05e
2 changed files with 35 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ public abstract class CategoryFunction {
all.put(MaxWithBlock.NAME, new MaxWithBlock());
all.put(MaxNoBlock.NAME, new MaxNoBlock());
all.put(NoOpFunction.NAME, new NoOpFunction());
all.put(NoBlock.NAME, new NoBlock());
}
/**

View File

@@ -0,0 +1,34 @@
// Copyright (C) 2010 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.workflow;
import com.google.gerrit.common.data.ApprovalType;
import com.google.gerrit.server.CurrentUser;
/** A function that does nothing. */
public class NoBlock extends CategoryFunction {
public static String NAME = "NoBlock";
@Override
public void run(final ApprovalType at, final FunctionState state) {
state.valid(at, true);
}
@Override
public boolean isValid(final CurrentUser user, final ApprovalType at,
final FunctionState state) {
return true;
}
}