private int verifyRuleResults ( Collection < ? extends Result < ? extends ExecutableRule > > results , Severity warnOnSeverity , Severity failOnSeverity , String type , String header , boolean logResult ) { int violations = 0 ; for ( Result < ? > result : results ) { if ( Result . Status . FAILURE . equals ( result . getStatus ( ) ) ) { ExecutableRule rule = result . getRule ( ) ; String severityInfo = rule . getSeverity ( ) . getInfo ( result . getSeverity ( ) ) ; List < String > resultRows = getResultRows ( result , logResult ) ; // violation severity level check boolean warn = warnOnSeverity != null && result . getSeverity ( ) . getLevel ( ) <= warnOnSeverity . getLevel ( ) ; boolean fail = failOnSeverity != null && result . getSeverity ( ) . getLevel ( ) <= failOnSeverity . getLevel ( ) ; LoggingStrategy loggingStrategy ; if ( fail ) { violations ++ ; loggingStrategy = errorLogger ; } else if ( warn ) { loggingStrategy = warnLogger ; } else { loggingStrategy = debugLogger ; } log ( loggingStrategy , rule , resultRows , severityInfo , type , header ) ; } } return violations ; }
Verifies the given results and logs messages .