summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMika Hamalainen <mika.hamalainen@accenture.com>2011-09-19 11:13:20 +0300
committerMika Hämäläinen <mika.hamalainen@accenture.com>2011-09-20 09:34:25 +0200
commitf36316996f05a3e41b355e2dbb26ecca97da1220 (patch)
tree77016c8ee56e4d251306cc1eb1dd8d6dbd03c16d
parent37e1f85c22f6fa4886a62cfa04112f88240de9da (diff)
Removed staging approval category
Removed staging approval category. Staging is handled like submit, and no approval category is used for tracking submit or staging in 2.x version. Change-Id: I90f943a99c4bb689128502e019a141b10c05ef90 Reviewed-by: Mika Hämäläinen <mika.hamalainen@accenture.com>
-rw-r--r--gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaCreator.java15
-rw-r--r--gerrit-server/src/main/java/com/google/gerrit/server/workflow/StagingFunction.java51
-rw-r--r--gerrit-server/src/test/java/com/google/gerrit/server/schema/SchemaCreatorTest.java1
3 files changed, 0 insertions, 67 deletions
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaCreator.java b/gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaCreator.java
index 764558a684..9b6812fe5d 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaCreator.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaCreator.java
@@ -32,7 +32,6 @@ import com.google.gerrit.server.config.SitePath;
import com.google.gerrit.server.config.SitePaths;
import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.git.MetaDataUpdate;
-import com.google.gerrit.server.workflow.StagingFunction;
import com.google.gerrit.server.git.NoReplication;
import com.google.gerrit.server.git.ProjectConfig;
import com.google.gwtjsonrpc.server.SignedToken;
@@ -117,7 +116,6 @@ public class SchemaCreator {
// TODO This should never be null when initializing a site.
initWildCardProject();
}
- initStagingCategory(db);
final SqlDialect d = jdbc.getDialect();
if (d instanceof DialectH2) {
@@ -306,19 +304,6 @@ public class SchemaCreator {
c.approvalCategoryValues().insert(vals);
}
- private void initStagingCategory(final ReviewDb c) throws OrmException {
- final ApprovalCategory cat;
- final ArrayList<ApprovalCategoryValue> vals;
-
- cat = new ApprovalCategory(ApprovalCategory.STAGING, "Staging");
- cat.setPosition((short) -1);
- cat.setFunctionName(StagingFunction.NAME);
- vals = new ArrayList<ApprovalCategoryValue>();
- vals.add(value(cat, 1, "Staging"));
- c.approvalCategories().insert(Collections.singleton(cat));
- c.approvalCategoryValues().insert(vals);
- }
-
private static ApprovalCategoryValue value(final ApprovalCategory cat,
final int value, final String name) {
return new ApprovalCategoryValue(new ApprovalCategoryValue.Id(cat.getId(),
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/workflow/StagingFunction.java b/gerrit-server/src/main/java/com/google/gerrit/server/workflow/StagingFunction.java
deleted file mode 100644
index cd0b700f39..0000000000
--- a/gerrit-server/src/main/java/com/google/gerrit/server/workflow/StagingFunction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (C) 2011 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.common.data.Permission;
-import com.google.gerrit.reviewdb.Change;
-import com.google.gerrit.server.CurrentUser;
-
-/**
- * Staging category function. Checks that the user has staging access and
- * that the change has status NEW.
- *
- */
-public class StagingFunction extends CategoryFunction {
- public static String NAME = "Staging";
-
- @Override
- public void run(final ApprovalType at, final FunctionState state) {
- state.valid(at, valid(state));
- }
-
- @Override
- public boolean isValid(final CurrentUser user, final ApprovalType at,
- final FunctionState state) {
- return !state.controlFor(user).getRange(Permission.forLabel(NAME)).isEmpty();
- }
-
- private static boolean valid(final FunctionState state) {
- if (state.getChange().getStatus() != Change.Status.NEW) {
- return false;
- }
- for (final ApprovalType t : state.getApprovalTypes()) {
- if (!state.isValid(t)) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/schema/SchemaCreatorTest.java b/gerrit-server/src/test/java/com/google/gerrit/server/schema/SchemaCreatorTest.java
index 3a8f301266..1d70d4efb6 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/server/schema/SchemaCreatorTest.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/server/schema/SchemaCreatorTest.java
@@ -19,7 +19,6 @@ import com.google.gerrit.reviewdb.ApprovalCategory;
import com.google.gerrit.reviewdb.ApprovalCategoryValue;
import com.google.gerrit.reviewdb.ReviewDb;
import com.google.gerrit.reviewdb.SystemConfig;
-import com.google.gerrit.server.workflow.StagingFunction;
import com.google.gerrit.testutil.InMemoryDatabase;
import com.google.gwtorm.client.OrmException;
import com.google.gwtorm.jdbc.JdbcSchema;