<commit_before>package com.sequenceiq.provisioning.controller.validation;

import java.util.List;
import java.util.Map;

import javax.validation.ConstraintValidatorContext;

import org.springframework.stereotype.Component;

@Component
public class ParametersRegexValidator extends AbstractParameterValidator {

    @Override
    public boolean validate(Map<String, String> parameters, ConstraintValidatorContext context, List<TemplateParam> paramsList) {
        boolean valid = true;
        for (TemplateParam param : paramsList) {
            if (param.getRegex().isPresent()) {
                if (parameters.containsKey(param.getName())) {
                    if (!parameters.get(param.getName()).matches(param.getRegex().get())){
                        addParameterConstraintViolation(context, param.getName(), String.format("%s is not valid for regex: %s.",
                                param.getName(), param.getRegex().get()));
                        valid = false;
                    }
                }
            }
        }
        return valid;<commit_msg>cs fix<commit_after>package com.sequenceiq.provisioning.controller.validation;

import java.util.List;
import java.util.Map;

import javax.validation.ConstraintValidatorContext;

import org.springframework.stereotype.Component;

@Component
public class ParametersRegexValidator extends AbstractParameterValidator {

    @Override
    public boolean validate(Map<String, String> parameters, ConstraintValidatorContext context, List<TemplateParam> paramsList) {
        boolean valid = true;
        for (TemplateParam param : paramsList) {
            if (param.getRegex().isPresent()) {
                if (parameters.containsKey(param.getName())) {
                    if (!parameters.get(param.getName()).matches(param.getRegex().get())) {
                        addParameterConstraintViolation(context, param.getName(), String.format("%s is not valid for regex: %s.",
                                param.getName(), param.getRegex().get()));
                        valid = false;
                    }
                }
            }
        }
        return valid;
{'fraction_non_alphanumeric': 0.1042830540037244, 'fraction_numerical': 0.0, 'mean_word_length': 2.405705229793978, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6207644', 'n_tokens_mistral': 506, 'n_tokens_neox': 490, 'n_words': 108}