Move workflow function access to CategoryFunction class

This permits us to later move the workflow code into the server side,
moving it off the client.  We're not likely to ever support running
the project's workflow rules on the client in JavaScript.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-07-27 15:35:55 -07:00
parent 96954f8f08
commit 379c2ed026
5 changed files with 22 additions and 14 deletions

View File

@@ -25,6 +25,7 @@ import com.google.gerrit.client.reviewdb.PatchSet;
import com.google.gerrit.client.reviewdb.ReviewDb;
import com.google.gerrit.client.rpc.Common;
import com.google.gerrit.client.rpc.NoSuchEntityException;
import com.google.gerrit.client.workflow.CategoryFunction;
import com.google.gerrit.client.workflow.FunctionState;
import com.google.gerrit.git.MergeQueue;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -90,9 +91,10 @@ public class ChangeManageServiceImpl extends BaseServiceImplementation
final FunctionState fs = new FunctionState(change, allApprovals);
for (ApprovalType c : Common.getGerritConfig().getApprovalTypes()) {
c.getCategory().getFunction().run(c, fs);
CategoryFunction.forCategory(c.getCategory()).run(c, fs);
}
if (!actionType.getCategory().getFunction().isValid(me, actionType, fs)) {
if (!CategoryFunction.forCategory(actionType.getCategory()).isValid(me,
actionType, fs)) {
throw new Failure(new IllegalStateException(actionType.getCategory()
.getName()
+ " not permitted"));