summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrik Sjölin <ulrik.sjolin@sonyericsson.com>2010-10-24 08:57:46 -0700
committerShawn O. Pearce <sop@google.com>2010-10-29 15:05:05 -0700
commit9d5008a05eba0a52196a7e190d5bbe36a746e16b (patch)
tree7aadec8f0c5d39e7dd603df1109af72fe361b3b0
parentd5dbf2a41a1f6585d41fdc403e01da5b33fd5df2 (diff)
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
-rw-r--r--gerrit-server/src/main/java/com/google/gerrit/server/workflow/CategoryFunction.java1
-rw-r--r--gerrit-server/src/main/java/com/google/gerrit/server/workflow/NoBlock.java34
2 files changed, 35 insertions, 0 deletions
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/workflow/CategoryFunction.java b/gerrit-server/src/main/java/com/google/gerrit/server/workflow/CategoryFunction.java
index dd29f0478e..6700393251 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/workflow/CategoryFunction.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/workflow/CategoryFunction.java
@@ -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());
}
/**
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/workflow/NoBlock.java b/gerrit-server/src/main/java/com/google/gerrit/server/workflow/NoBlock.java
new file mode 100644
index 0000000000..a08981703a
--- /dev/null
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/workflow/NoBlock.java
@@ -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;
+ }
+}