public void validarDadosNovoUsuario(User user) throws BusinessException { user.setEmail(user.getEmail().toLowerCase()); user.setLogin(user.getLogin().toLowerCase()); if (StringUtils.isEmpty(user.getName())) { throw new BusinessException("Nome obrigatório."); } if (StringUtils.isEmpty(user.getLogin())) { throw new BusinessException("Login obrigatório."); } if (StringUtils.isEmpty(user.getPassword())) { throw new BusinessException("Senha obrigatória."); } if (!EmailValidator.getInstance().isValid(user.getEmail())) { throw new BusinessException("Email '" + user.getEmail() + "' inválido."); } if (this.findByLogin(user.getLogin()) != null) { throw new BusinessException("Login '" + user.getLogin() + "' indisponível."); } if (this.findByEmail(user.getEmail()) != null) { throw new BusinessException("Email '" + user.getEmail() + "' já cadastrado."); } }