SubmitRuleEvaluator: rename canSubmit() to evaluate()
Change-Id: I9573d6db0e6064dfa645f211e0e16e8f3a45cbf4
This commit is contained in:
@@ -434,7 +434,7 @@ public class ChangeJson {
|
||||
cd.setSubmitRecords(new SubmitRuleEvaluator(cd).setPatchSet(ps)
|
||||
.setFastEvalLabels(true)
|
||||
.setAllowDraft(true)
|
||||
.canSubmit());
|
||||
.evaluate());
|
||||
return cd.getSubmitRecords();
|
||||
}
|
||||
|
||||
|
@@ -113,7 +113,7 @@ public class ReviewerJson {
|
||||
.setPatchSet(ps)
|
||||
.setFastEvalLabels(true)
|
||||
.setAllowDraft(true)
|
||||
.canSubmit()) {
|
||||
.evaluate()) {
|
||||
if (rec.labels == null) {
|
||||
continue;
|
||||
}
|
||||
|
@@ -543,7 +543,7 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
|
||||
throws ResourceConflictException, OrmException {
|
||||
List<SubmitRecord> results = new SubmitRuleEvaluator(cd)
|
||||
.setPatchSet(patchSet)
|
||||
.canSubmit();
|
||||
.evaluate();
|
||||
Optional<SubmitRecord> ok = findOkRecord(results);
|
||||
if (ok.isPresent()) {
|
||||
// Rules supplied a valid solution.
|
||||
@@ -552,7 +552,7 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
|
||||
return results;
|
||||
} else if (results.isEmpty()) {
|
||||
throw new IllegalStateException(String.format(
|
||||
"ChangeControl.canSubmit returned empty list for %s in %s",
|
||||
"SubmitRuleEvaluator.evaluate returned empty list for %s in %s",
|
||||
patchSet.getId(),
|
||||
cd.change().getProject().get()));
|
||||
}
|
||||
|
@@ -85,7 +85,7 @@ public class TestSubmitRule implements RestModifyView<RevisionResource, Input> {
|
||||
.setLogErrors(false)
|
||||
.setSkipSubmitFilters(input.filters == Filters.SKIP)
|
||||
.setRule(input.rule)
|
||||
.canSubmit();
|
||||
.evaluate();
|
||||
List<Record> out = Lists.newArrayListWithCapacity(records.size());
|
||||
AccountLoader accounts = accountInfoFactory.create(true);
|
||||
for (SubmitRecord r : records) {
|
||||
|
@@ -118,7 +118,7 @@ public class SubmitRuleEvaluator {
|
||||
|
||||
/**
|
||||
* @param ps patch set of the change to evaluate. If not set, the current
|
||||
* patch set will be loaded from {@link #canSubmit()} or {@link
|
||||
* patch set will be loaded from {@link #evaluate()} or {@link
|
||||
* #getSubmitType}.
|
||||
* @return this
|
||||
*/
|
||||
@@ -140,7 +140,7 @@ public class SubmitRuleEvaluator {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param allow whether to allow {@link #canSubmit()} on closed changes.
|
||||
* @param allow whether to allow {@link #evaluate()} on closed changes.
|
||||
* @return this
|
||||
*/
|
||||
public SubmitRuleEvaluator setAllowClosed(boolean allow) {
|
||||
@@ -149,7 +149,7 @@ public class SubmitRuleEvaluator {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param allow whether to allow {@link #canSubmit()} on closed changes.
|
||||
* @param allow whether to allow {@link #evaluate()} on draft changes.
|
||||
* @return this
|
||||
*/
|
||||
public SubmitRuleEvaluator setAllowDraft(boolean allow) {
|
||||
@@ -195,7 +195,7 @@ public class SubmitRuleEvaluator {
|
||||
* @return List of {@link SubmitRecord} objects returned from the evaluated
|
||||
* rules, including any errors.
|
||||
*/
|
||||
public List<SubmitRecord> canSubmit() {
|
||||
public List<SubmitRecord> evaluate() {
|
||||
try {
|
||||
initPatchSet();
|
||||
} catch (OrmException e) {
|
||||
|
@@ -200,7 +200,7 @@ public class OutputStreamQuery {
|
||||
eventFactory.addSubmitRecords(c, new SubmitRuleEvaluator(d)
|
||||
.setAllowClosed(true)
|
||||
.setAllowDraft(true)
|
||||
.canSubmit());
|
||||
.evaluate());
|
||||
}
|
||||
|
||||
if (includeCommitMessage) {
|
||||
|
Reference in New Issue
Block a user