Search in sources :

Example 1 with PredicateResult

use of com.google.gerrit.entities.SubmitRequirementExpressionResult.PredicateResult in project gerrit by GerritCodeReview.

the class SubmitRequirementsEvaluatorImpl method evaluateExpression.

@Override
public SubmitRequirementExpressionResult evaluateExpression(SubmitRequirementExpression expression, ChangeData changeData) {
    try {
        Predicate<ChangeData> predicate = queryBuilder.get().parse(expression.expressionString());
        PredicateResult predicateResult = evaluatePredicateTree(predicate, changeData);
        return SubmitRequirementExpressionResult.create(expression, predicateResult);
    } catch (QueryParseException | SubmitRequirementEvaluationException e) {
        return SubmitRequirementExpressionResult.error(expression, e.getMessage());
    }
}
Also used : PredicateResult(com.google.gerrit.entities.SubmitRequirementExpressionResult.PredicateResult) ChangeData(com.google.gerrit.server.query.change.ChangeData) QueryParseException(com.google.gerrit.index.query.QueryParseException)

Aggregations

PredicateResult (com.google.gerrit.entities.SubmitRequirementExpressionResult.PredicateResult)1 QueryParseException (com.google.gerrit.index.query.QueryParseException)1 ChangeData (com.google.gerrit.server.query.change.ChangeData)1