Package com.google.gerrit.server.project
Class SubmitRuleEvaluator
- java.lang.Object
-
- com.google.gerrit.server.project.SubmitRuleEvaluator
-
public class SubmitRuleEvaluator extends Object
Evaluates a submit-like Prolog rule found in the rules.pl file of the current project and filters the results through rules found in the parent projects, all the way up to All-Projects.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SubmitRuleEvaluator.Factory
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static List<SubmitRecord>
createRuleError(String err)
static List<SubmitRecord>
defaultRuleError()
static SubmitTypeRecord
defaultTypeError()
List<SubmitRecord>
evaluate()
Evaluate the submit rules.SubmitRuleOptions
getOptions()
long
getReductionsConsumed()
com.googlecode.prolog_cafe.lang.Term
getSubmitRule()
String
getSubmitRuleName()
SubmitTypeRecord
getSubmitType()
Evaluate the submit type rules to get the submit type.SubmitRuleEvaluator
setAllowClosed(boolean allow)
SubmitRuleEvaluator
setFastEvalLabels(boolean fast)
SubmitRuleEvaluator
setLogErrors(boolean log)
SubmitRuleEvaluator
setOptions(SubmitRuleOptions opts)
SubmitRuleEvaluator
setPatchSet(PatchSet ps)
SubmitRuleEvaluator
setRule(String rule)
SubmitRuleEvaluator
setSkipSubmitFilters(boolean skip)
-
-
-
Method Detail
-
defaultRuleError
public static List<SubmitRecord> defaultRuleError()
-
createRuleError
public static List<SubmitRecord> createRuleError(String err)
-
defaultTypeError
public static SubmitTypeRecord defaultTypeError()
-
getOptions
public SubmitRuleOptions getOptions()
- Returns:
- immutable snapshot of options configured so far. If neither
getSubmitRule()
norgetSubmitType()
have been called yet, state within this instance is still mutable, so may change before evaluation. The instance's options are frozen at evaluation time.
-
setOptions
public SubmitRuleEvaluator setOptions(SubmitRuleOptions opts)
-
setPatchSet
public SubmitRuleEvaluator setPatchSet(PatchSet ps)
- Parameters:
ps
- patch set of the change to evaluate. If not set, the current patch set will be loaded fromevaluate()
orgetSubmitType()
.- Returns:
- this
-
setFastEvalLabels
public SubmitRuleEvaluator setFastEvalLabels(boolean fast)
- Parameters:
fast
- if true assume reviewers are permitted to use label values currently stored on the change. Fast mode bypasses some reviewer permission checks.- Returns:
- this
-
setAllowClosed
public SubmitRuleEvaluator setAllowClosed(boolean allow)
- Parameters:
allow
- whether to allowevaluate()
on closed changes.- Returns:
- this
-
setSkipSubmitFilters
public SubmitRuleEvaluator setSkipSubmitFilters(boolean skip)
- Parameters:
skip
- if true, submit filter will not be applied.- Returns:
- this
-
setRule
public SubmitRuleEvaluator setRule(String rule)
- Parameters:
rule
- custom rule to use, or null to use refs/meta/config:rules.pl.- Returns:
- this
-
setLogErrors
public SubmitRuleEvaluator setLogErrors(boolean log)
- Parameters:
log
- whether to log error messages in addition to returning error records. If true, error record messages will be less descriptive.
-
getReductionsConsumed
public long getReductionsConsumed()
- Returns:
- Prolog reductions consumed during evaluation.
-
evaluate
public List<SubmitRecord> evaluate()
Evaluate the submit rules.- Returns:
- List of
SubmitRecord
objects returned from the evaluated rules, including any errors.
-
getSubmitType
public SubmitTypeRecord getSubmitType()
Evaluate the submit type rules to get the submit type.- Returns:
- record from the evaluated rules.
-
getSubmitRule
public com.googlecode.prolog_cafe.lang.Term getSubmitRule()
-
getSubmitRuleName
public String getSubmitRuleName()
-
-