List of usage examples for org.springframework.validation ValidationUtils rejectIfEmptyOrWhitespace
public static void rejectIfEmptyOrWhitespace(Errors errors, String field, String errorCode)
From source file:de.berlios.jhelpdesk.web.tools.TicketCategoryValidator.java
public void validate(Object category, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "categoryName", "errors.category.categoryName"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "categoryDesc", "errors.category.categoryDesc"); }
From source file:de.berlios.jhelpdesk.web.tools.ArticleCategoryValidator.java
public void validate(Object command, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "categoryName", "errors.kbase.categoryName"); }
From source file:fi.koku.kks.model.Version.java
@Override public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "NotEmpty.creation.name"); }
From source file:org.tsm.concharto.web.flagevent.FlagEventFormValidator.java
public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "reason", "empty.flagEventForm.reason"); ValidationHelper.rejectIfTooLong(errors, "comment", Flag.SZ_COMMENT, "tooLong"); }
From source file:csns.web.validator.NewsValidator.java
@Override public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "topic.firstPost.subject", "error.field.required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "topic.firstPost.content", "error.field.required"); }
From source file:csns.web.validator.ForumValidator.java
@Override public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "error.field.required"); }
From source file:csns.web.validator.BlockValidator.java
@Override public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "error.field.required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "type", "error.field.required"); }
From source file:csns.web.validator.ProjectValidator.java
@Override public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "title", "error.field.required"); }
From source file:org.openmrs.logic.rule.definition.RuleDefinitionValidator.java
public void validate(Object obj, Errors errors) { RuleDefinition rule = (RuleDefinition) obj; ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "error.null"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "language", "error.null"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "ruleContent", "error.null"); if (StringUtils.isNotBlank(rule.getLanguage()) && StringUtils.isNotBlank(rule.getRuleContent())) { RuleDefinitionService service = Context.getService(RuleDefinitionService.class); LanguageHandler handler = service.getLanguageHandler(rule.getLanguage()); Date originalDateChanged = rule.getDateChanged(); try {// w w w . j a v a2 s .co m rule.setDateChanged(new Date()); Rule r = handler.compile(rule); if (r == null) throw new LogicException("Unknown error compiling rule"); } catch (Exception ex) { while (ex.getCause() != null && ex.getCause() != ex && ex.getCause() instanceof Exception) ex = (Exception) ex.getCause(); errors.rejectValue("ruleContent", ex.getMessage()); } finally { rule.setDateChanged(originalDateChanged); } } }
From source file:csns.web.validator.RubricValidator.java
@Override public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "error.field.required"); int scale = ((Rubric) target).getScale(); if (scale < 2 || scale > 6) errors.rejectValue("scale", "error.rubric.scale.invalid"); }