List of usage examples for org.springframework.validation ValidationUtils rejectIfEmptyOrWhitespace
public static void rejectIfEmptyOrWhitespace(Errors errors, String field, String errorCode, @Nullable Object[] errorArgs)
From source file:com.ch018.library.validator.ChangePasswordValid.java
@Override public void validate(Object o, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "required.password", "this filed is required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "confirmPassword", "required.confirmPassword", "this filed is required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "newPassword", "required.newPassword", "this filed is required"); Password pass = (Password) o;/*from ww w .jav a2s . co m*/ if (!pass.getNewPassword().equals(pass.getConfirmPassword())) errors.rejectValue("newPassword", "notmatch"); if (pass.getNewPassword().length() < 4) { errors.rejectValue("newPassword", "toshort"); } }
From source file:validator.LoginValidator.java
@Override public void validate(Object o, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "userName", "required.userName", "Username can not be empty"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "required.password", "Password can not be empty"); }
From source file:com.gianburga.servicios.bean.validator.TecnicoValidator.java
@Override public void validate(Object o, Errors errors) { Tecnico tecnico = (Tecnico) o;//from w w w . j a v a 2 s .c om ValidationUtils.rejectIfEmptyOrWhitespace(errors, "nombre", "error.tecnico.nombre", "Campo de nombre incorrecto"); ValidationUtils.rejectIfEmpty(errors, "fechaNacimiento", "error.tecnico.fechaNacimiento", "Escriba una fecha de nacimiento"); }
From source file:org.dspace.app.webui.cris.validator.ResearcherPageValidator.java
public void validate(Object arg0, Errors arg1) { ResearcherPage researcher = (ResearcherPage) arg0; ValidationUtils.rejectIfEmptyOrWhitespace(arg1, "staffNo", "error.staffNo.mandatory", "StaffNo is mandatory"); ValidationUtils.rejectIfEmptyOrWhitespace(arg1, "fullName", "error.fullName.mandatory", "FullName is mandatory"); String staffNo = researcher.getSourceID(); if (staffNo != null) { ResearcherPage temp = applicationService.getResearcherPageByStaffNo(staffNo); if (temp != null) { if (!researcher.getId().equals(temp.getId())) { arg1.reject("staffNo", "Staff No is already in use by another researcher"); }//from w w w . ja v a 2 s. co m } } }
From source file:org.eclipse.virgo.samples.formtags.par.web.validation.UserValidator.java
public void validate(Object obj, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "firstName", "required", "Field is required."); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "lastName", "required", "Field is required."); }
From source file:com.google.ie.common.validation.UserValidator.java
@Override public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "key", "required", "Field is null or empty"); }
From source file:com.stormpath.tooter.validator.ResetPasswordValidator.java
@Override public void validate(Object o, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "email", "reset.password.required.email", "Field email is required"); }
From source file:com.stormpath.tooter.validator.LoginValidator.java
@Override public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "userName", "login.required.userName", "Field name is required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "login.required.password", "Field password is required"); }
From source file:com.stormpath.tooter.validator.TootValidator.java
@Override public void validate(Object o, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "tootMessage", "tooter.required", "Field toot is required"); Toot toot = (Toot) o;//from ww w.j a v a 2s . c om if (toot.getTootMessage() != null && toot.getTootMessage().length() > 160) { errors.rejectValue("tootMessage", "tooter.too.many.chars"); } }
From source file:com.stormpath.tooter.validator.ProfileValidator.java
@Override public void validate(Object o, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "firstName", "profile.required.firstName", "Field first name is required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "lastName", "profile.required.lastName", "Field last name is required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "email", "profile.required.email", "Field email is required"); }