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:
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user