<commit_before>/*
 * Copyright (c) 2015 CIT, VŠB-TU Ostrava
 * 
 */
package cz.vsb.resbill.util;

import org.springframework.ui.ModelMap;
import org.springframework.validation.BeanPropertyBindingResult;
import org.springframework.validation.BindingResult;


/**
 * @author Ing. <NAME> <<EMAIL>>
 *
 */
public class WebUtils {
	/**
	 * 
	 * @param model
	 * @param objectName
	 * @param msgKey
	 */
	public static void addGlobalError(ModelMap model, String objectName, String msgKey) {
		BindingResult bindingResult = (BindingResult) model.get(BindingResult.MODEL_KEY_PREFIX + "dailyImport");
		if (bindingResult == null) {
			bindingResult = new BeanPropertyBindingResult(model.get(objectName), "dailyImport");
			model.put(BindingResult.MODEL_KEY_PREFIX + "dailyImport", bindingResult);
		}
		bindingResult.reject(msgKey);
	}
}<commit_msg>MISC-65: ResBill: vytvoření systému pro datové centrum<commit_after>/*
 * Copyright (c) 2015 CIT, VŠB-TU Ostrava
 * 
 */
package cz.vsb.resbill.util;

import org.springframework.ui.ModelMap;
import org.springframework.validation.BeanPropertyBindingResult;
import org.springframework.validation.BindingResult;

/**
 * @author Ing. <NAME> <<EMAIL>>
 *
 */
public class WebUtils {

	/**
	 * Prida globalni chybu
	 * 
	 * @param model mapa modelovych objektu
	 * @param object Name jmeno objektu, u nejz doslo k chybe. Klic musi byt dopredu zavedeny v modelu
	 * @param msgKey Klic zpravy z properties souboru
	 */
	public static void addGlobalError(ModelMap model, String objectName, String msgKey) {
		BindingResult bindingResult = (BindingResult) model.get(BindingResult.MODEL_KEY_PREFIX + objectName);
		if (bindingResult == null) {
			bindingResult = new BeanPropertyBindingResult(model.get(objectName), objectName);
			model.put(BindingResult.MODEL_KEY_PREFIX + objectName, bindingResult);
		}
		bindingResult.reject(msgKey);
	}
}
{'fraction_non_alphanumeric': 0.1111111111111111, 'fraction_numerical': 0.005341880341880342, 'mean_word_length': 4.889937106918239, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5040778', 'n_tokens_mistral': 634, 'n_tokens_neox': 585, 'n_words': 138}