• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EmailValidator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.commons.validator.EmailValidator的典型用法代码示例。如果您正苦于以下问题:Java EmailValidator类的具体用法?Java EmailValidator怎么用?Java EmailValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EmailValidator类属于org.apache.commons.validator包,在下文中一共展示了EmailValidator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: validateEmailApache

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
public static String validateEmailApache(String email){
	email = email.trim();
	EmailValidator eValidator = EmailValidator.getInstance();
	if(eValidator.isValid(email)){
		return email + " is a valid email address.";
	}else{
		return email + " is not a valid email address.";
	}
}
 
开发者ID:PacktPublishing,项目名称:Machine-Learning-End-to-Endguide-for-Java-developers,代码行数:10,代码来源:App.java


示例2: validate

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
/**
 * Validates the input
 * @param object the user to validate
 * @param errors the errors
 */
public void validate(Object object, Errors errors) {

    UserDTO user = (UserDTO) object;

    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "googleId", "field.required",
            "googleId must not be empty.");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "fullName", "field.required",
            "User Full Name must not be empty.");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "givenName", "field.required",
            "User Given Name must not be empty.");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "familyName", "field.required",
            "User Family Name must not be empty.");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "imageURL", "field.required",
            "User Image URL must not be empty.");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "email", "field.required",
            "User Email must not be empty");
    ValidationUtils.rejectIfEmpty(errors, "role", "field.required",
            "User Role must not be empty.");

    // doing specific input validaiton, so we need to make sure all of the fields are there
    if(!errors.hasErrors()) {
        if(user.getRole() < 0 || user.getRole() > 1) {
            errors.rejectValue("role", "field.invalid", "User Role must be 0 or 1");
        }

        if(!EmailValidator.getInstance().isValid(user.getEmail())) {
            errors.rejectValue("email", "field.invalid", "User Email must be a valid email address.");
        }

        if(!UrlValidator.getInstance().isValid(user.getImageURL())) {
            errors.rejectValue("imageURL", "field.invalid", "User Image URl must be a valid web address.");
        }
    }



}
 
开发者ID:jackcmeyer,项目名称:SmartSync,代码行数:43,代码来源:UserValidator.java


示例3: validate

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
@Override
public void validate(Object o, Errors errors) {
    UpdateUserDTO user = (UpdateUserDTO) o;

    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "userId", "field.required",
            "User Id must not be empty.");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "googleId", "field.required",
            "googleId must not be empty.");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "fullName", "field.required",
            "User Full Name must not be empty.");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "givenName", "field.required",
            "User Given Name must not be empty.");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "familyName", "field.required",
            "User Family Name must not be empty.");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "imageURL", "field.required",
            "User Image URL must not be empty.");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "email", "field.required",
            "User Email must not be empty");
    ValidationUtils.rejectIfEmpty(errors, "role", "field.required",
            "User Role must not be empty.");

    // doing specific input validaiton, so we need to make sure all of the fields are there
    if(!errors.hasErrors()) {
        if(user.getRole() < 0 || user.getRole() > 1) {
            errors.rejectValue("role", "field.invalid", "User Role must be 0 or 1");
        }

        if(!EmailValidator.getInstance().isValid(user.getEmail())) {
            errors.rejectValue("email", "field.invalid", "User Email must be a valid email address.");
        }

        if(!UrlValidator.getInstance().isValid(user.getImageURL())) {
            errors.rejectValue("imageURL", "field.invalid", "User Image URl must be a valid web address.");
        }
    }
}
 
开发者ID:jackcmeyer,项目名称:SmartSync,代码行数:37,代码来源:UpdateUserValidator.java


示例4: doValidate

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void doValidate(MailInForm form, Errors errors) {
    validateServerSettings(form, errors);
    if (MailInController.MODE_SINGLE.equals(form.getMode())) {
        if (!EmailValidator.getInstance().isValid(form.getSingleModeAddress())) {
            errors.rejectValue("singleModeAddress", "error.email.not.valid");
        }
    } else if (MailInController.MODE_MULTI.equals(form.getMode())) {
        if (StringUtils.isBlank(form.getMultiModeDomain())) {
            errors.rejectValue("multiModeDomain", "string.validation.empty");
        }
        if (!EmailValidator.getInstance().isValid(
                "a" + form.getMultiModeSuffix() + "@" + form.getMultiModeDomain())) {
            errors.rejectValue("multiModeDomain",
                    "client.system.communication.mail.in.mode.multi.error.match");
            errors.rejectValue("multiModeSuffix",
                    "client.system.communication.mail.in.mode.multi.error.match");
        }
    }
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:24,代码来源:MailInValidator.java


示例5: validate

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
public void validate(Object obj, Errors errors) {
    OrderInfoForm orderInfoForm = (OrderInfoForm) obj;

    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "emailAddress", "emailAddress.required");
    
    if (!errors.hasErrors()) {
        if (!EmailValidator.getInstance().isValid(orderInfoForm.getEmailAddress())) {
            errors.rejectValue("emailAddress", "emailAddress.invalid", null, null);
        }
    }
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:12,代码来源:OrderInfoFormValidator.java


示例6: validatePreferenceValues

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
/**
 * @see org.kuali.rice.kcb.deliverer.MessageDeliverer#validatePreferenceValues(java.util.HashMap)
 */
public void validatePreferenceValues(HashMap<String, String> prefs) throws ErrorList {
    boolean error = false;
    ErrorList errorList = new ErrorList();
    String[] validformats = {"text","html"};

    if (!prefs.containsKey(getName()+"."+EMAIL_ADDR_PREF_KEY)) {
        errorList.addError("Email Address is a required field.");
        error = true;
    } else {
        String addressValue = (String) prefs.get(getName()+"."+EMAIL_ADDR_PREF_KEY);
        EmailValidator validator = EmailValidator.getInstance();
        if (!validator.isValid(addressValue)) {
            errorList.addError("Email Address is required and must be properly formatted - \"[email protected]\".");
            error = true;
        }
    }

    // validate format
    if (!prefs.containsKey(getName()+"."+EMAIL_DELIV_FRMT_PREF_KEY)) {
        errorList.addError("Email Delivery Format is required.");
        error = true;
    } else {
        String formatValue = (String) prefs.get(getName()+"."+EMAIL_DELIV_FRMT_PREF_KEY);
        Set<String> formats = new HashSet<String>();
        for (int i=0; i < validformats.length ; i++) {
            formats.add(validformats[i]);
        }

        if (!formats.contains(formatValue)) {
            errorList.addError("Email Delivery Format is required and must be entered as \"text\" or \"html\".");
            error = true;
        }
    }

    if (error) throw errorList;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:40,代码来源:EmailMessageDeliverer.java


示例7: isValidEmail

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
/**
 * Is this a valid email the service will recognize
 * @param email
 * @return
 */
private boolean isValidEmail(String email) {

	// TODO: Use a generic Sakai utility class (when a suitable one exists)

	if (email == null || email.equals(""))
	{
		return false;
	}

	email = email.trim();
	//must contain @
	if (!email.contains( "@" ))
	{
		return false;
	}

	//an email can't contain spaces
	if (email.indexOf(" ") > 0)
	{
		return false;
	}

	//use commons-validator
	EmailValidator validator = EmailValidator.getInstance();
	return validator.isValid(email);
}
 
开发者ID:sakaicontrib,项目名称:turnitin,代码行数:32,代码来源:TurnitinReviewServiceImpl.java


示例8: generateFileNameFromEmail

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
public static String generateFileNameFromEmail(String userEmail) throws ValidationException{
	String fileName = null;
	if(userEmail != null && EmailValidator.getInstance().isValid(userEmail)){
 	// Get a random number of up to 7 digits   	
 	int sevenDigitRandom = new Double(Math.random() * 10000000).intValue();
 	
 	// Get the last 7 digits of the Java timestamp
 	String s = String.valueOf(System.currentTimeMillis());
 	String lastSevenOfTimeStamp = s.substring(s.length()-7, s.length());
 	
 	// Get the string before the @ sign in the user's email address
 	String userEmailBeforeAtSign = userEmail.substring(0, userEmail.indexOf('@'));
 	
 	// Put it all together
     fileName = userEmailBeforeAtSign + "_" + sevenDigitRandom + lastSevenOfTimeStamp;
	}
	else{
		throw new ValidationException("Invalid Email Address");
	}
    return fileName;
}
 
开发者ID:NCIP,项目名称:stats-application-commons,代码行数:22,代码来源:FileNameGenerator.java


示例9: convertSignupEmail

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
/**
 * Helper to convert a signup email notification into a Sakai EmailMessage, which can encapsulate attachments.
 * 
 * <p>Due to the way the email objects are created, ie one per email that needs to be sent, not one per user, we cannot store any
 * user specific attachments within the email objects themselves. So this method assembles an EmailMessage per user
 * 
 * @param email	- the signup email obj we will extract info from
 * @param recipient - list of user to receive the email
 * @return
 */
private EmailMessage convertSignupEmail(SignupEmailNotification email, User recipient) {
	
	EmailMessage message = new EmailMessage();
		
	//setup message
	message.setHeaders(email.getHeader());
	message.setBody(email.getMessage());
	
	// Pass a flag to the EmailService to indicate that we want the MIME multipart subtype set to alternative
	// so that an email client can present the message as a meeting invite
	message.setHeader("multipart-subtype", "alternative");
	
	//note that the headers are largely ignored so we need to repeat some things here that are actually in the headers
	//if these are eventaully converted to proper email templates, this should be alleviated
	message.setSubject(email.getSubject());
	
	log.debug("email.getFromAddress(): " + email.getFromAddress());
	
	message.setFrom(email.getFromAddress());
	message.setContentType("text/html; charset=UTF-8");
	
	if(!email.isModifyComment()){
		//skip ICS attachment file for user comment email
		for(Attachment a: collectAttachments(email, recipient)){
			message.addAttachment(a);
		}
	}
	
	//add recipient, only if valid email
	String emailAddress = recipient.getEmail();
	if(StringUtils.isNotBlank(emailAddress) && EmailValidator.getInstance().isValid(emailAddress)) {
		message.addRecipient(EmailAddress.RecipientType.TO, recipient.getDisplayName(), emailAddress);
	} else {
		log.debug("Invalid email for user: " + recipient.getDisplayId() + ". No email will be sent to this user");
		return null;
	}
	
	return message;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:50,代码来源:SignupEmailFacadeImpl.java


示例10: validate

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
@Override
public void validate(StartupForm target, List<String> errors, ConfigSource configSource) {
    // only validate without active admin
    if (userService.hasActiveMotechAdmin()) {
        return;
    }

    if (StringUtils.isBlank(target.getAdminLogin())) {
        errors.add(String.format(ERROR_REQUIRED, ADMIN_LOGIN));
    } else if (userService.hasUser(target.getAdminLogin())) {
        errors.add("server.error.user.exist");
    } else if (userService.hasEmail(target.getAdminEmail())) {
        errors.add("server.error.email.exist");
    }

    if (StringUtils.isBlank(target.getAdminPassword())) {
        errors.add(String.format(ERROR_REQUIRED, ADMIN_PASSWORD));
    } else if (StringUtils.isBlank(target.getAdminConfirmPassword())) {
        errors.add(String.format(ERROR_REQUIRED, ADMIN_CONFIRM_PASSWORD));
    } else if (!target.getAdminPassword().equals(target.getAdminConfirmPassword())) {
        errors.add("server.error.invalid.password");
    }

    if (!EmailValidator.getInstance().isValid(target.getAdminEmail())) {
        errors.add("server.error.invalid.email");
    }
}
 
开发者ID:motech,项目名称:motech,代码行数:28,代码来源:PersistedUserValidator.java


示例11: validateEmail

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
/**
 * Validate Email field data is acceptable
 * 
 * @param context FacesContext
 * @param component UIComponent
 * @param value Object
 * @throws ValidatorException
 */
public void validateEmail(FacesContext context, UIComponent component, Object value) throws ValidatorException
{
   EmailValidator emailValidator = EmailValidator.getInstance();
   if (!emailValidator.isValid((String) value))
   {
      String err =Application.getMessage(context, MSG_ERROR_MAIL_NOT_VALID);
      throw new ValidatorException(new FacesMessage(err));
   }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:18,代码来源:NewUserWizard.java


示例12: validate

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
@Override
public Violation<T> validate(T o, String propertyName) {
    EmailValidator v = EmailValidator.getInstance();
    String emailAddress = getProperty(o, propertyName);
    if(!v.isValid(emailAddress)){
        return new ConstraintViolation<T>(o, propertyName, ConstraintViolationType.NON_VALID_EMAIL_ADDRESS);
    }
    return null;
}
 
开发者ID:iface06,项目名称:btDiary,代码行数:10,代码来源:EmailAddressValidator.java


示例13: isValidEmailAddress

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
public static boolean isValidEmailAddress(String emailAddr){           
    EmailValidator eValidator = EmailValidator.getInstance();
    return eValidator.isValid(emailAddr);           
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:5,代码来源:EmailUtilsOld.java


示例14: handleSubmit

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.POST)
public String handleSubmit(
        HttpSession session,
        @RequestParam String email,
        Model model) {
	logger.info("handleSubmit");
    
    if (!EmailValidator.getInstance().isValid(email)) {
        // TODO: display error message
        return "content/contributor/add-email";
    }
    
    Contributor existingContributor = contributorDao.read(email);
    if (existingContributor != null) {
        // TODO: display error message
        return "content/contributor/add-email";
    }
    
    Contributor contributor = (Contributor) session.getAttribute("contributor");
    boolean isRedirectFromRegistrationPage = contributor.getEmail() == null;
    contributor.setEmail(email);
    contributorDao.create(contributor);
    
    session.setAttribute("contributor", contributor);
    
    SignOnEvent signOnEvent = new SignOnEvent();
    signOnEvent.setContributor(contributor);
    signOnEvent.setCalendar(Calendar.getInstance());
    signOnEventDao.create(signOnEvent);
    
    if (isRedirectFromRegistrationPage) {
        // Send welcome e-mail
        String to = contributor.getEmail();
        String from = "elimu.ai <[email protected]>";
        String subject = "Welcome to the community";
        String title = "Welcome!";
        String firstName = StringUtils.isBlank(contributor.getFirstName()) ? "" : contributor.getFirstName();
        String htmlText = "<p>Hi, " + firstName + "</p>";
        htmlText += "<p>Thank you very much for registering as a contributor to the elimu.ai community. We are glad to see you join us!</p>";
        htmlText += "<p>With your help, this is what we aim to achieve:</p>";
        htmlText += "<p><blockquote>\"The mission of the elimu.ai project is to build software that will enable children without access to school to learn how to read and write <i>on their own</i>.\"</blockquote></p>";
        htmlText += "<p><img src=\"http://elimu.ai/static/img/banner-en.jpg\" alt=\"\" style=\"width: 564px; max-width: 100%;\" /></p>";
        htmlText += "<h2>Chat</h2>";
        htmlText += "<p>At http://slack.elimu.ai you can chat with the other community members.</p>";
        htmlText += "<h2>Feedback</h2>";
        htmlText += "<p>If you have any questions or suggestions, please contact us by replying to this e-mail or messaging us in the Slack chat room.</p>";
        Mailer.sendHtml(to, null, from, subject, title, htmlText);
        
        if (EnvironmentContextLoaderListener.env == Environment.PROD) {
             // Post notification in Slack
             String name = "";
             if (StringUtils.isNotBlank(contributor.getFirstName())) {
                 name += "(";
                 name += contributor.getFirstName();
                 if (StringUtils.isNotBlank(contributor.getLastName())) {
                     name += " " + contributor.getLastName();
                 }
                 name += ")";
             }
             String text = URLEncoder.encode("A new contributor " + name + " just joined the community: ") + "http://elimu.ai/content/community/contributors";
             String iconUrl = contributor.getImageUrl();
             SlackApiHelper.postMessage(null, text, iconUrl, null);
         }
    }
	
    return "redirect:/content";
}
 
开发者ID:elimu-ai,项目名称:webapp,代码行数:68,代码来源:AddEmailController.java


示例15: ValidateUser

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
private String ValidateUser(User user){
    ResourceBundleMessageSource r=new ResourceBundleMessageSource();
    r.setBasename("messages_en");   

    user.setDob(new Date(user.getYear() - 1900, user.getMonth() - 1, user.getDay()));
    
    if(user.getNick().length()==0)
        return r.getMessage("judge.register.error.nick",null, new Locale("en"));
   
    if ((user.getNick().length()) > 15)
        return r.getMessage("judge.register.error.long25charact",null, new Locale("en"));
    
    if (user.getNick().length() < 3)
        return r.getMessage("judge.register.error.less3charact",null, new Locale("en"));
    
    if (user.getName().length() < 1) 
        return r.getMessage("errormsg.7",null, new Locale("en"));
    
    if (user.getName().length() > 30) 
        return r.getMessage("errormsg.6",null, new Locale("en"));
    
    if (!user.getName().matches("[a-zA-Z\\.\\-\\'\\s]+"))
        return r.getMessage("errormsg.8",null, new Locale("en"));        

    if (user.getLastname().length() < 1) 
        return r.getMessage("errormsg.10",null, new Locale("en"));

    if (user.getLastname().length() > 50) 
        return r.getMessage("errormsg.9",null, new Locale("en"));
    
    if (!user.getLastname().matches("[a-zA-Z\\.\\-\\'\\s]+"))
        return r.getMessage("errormsg.11",null, new Locale("en"));
    
    // si el correo ha sido cambiado y esta en uso por otra persona en el
    // COJ
    if(user.getEmail().length() == 0)
        return r.getMessage("errormsg.51",null, new Locale("en"));        
 
    if (!StringUtils.isEmpty(user.getEmail()) && userDAO.bool("email.changed", user.getEmail(), user.getUid()) && userDAO.emailExistUpdate(user.getEmail().trim(), user.getUsername())) 
        return r.getMessage("judge.register.error.emailexist",null, new Locale("en"));  
    

    EmailValidator emailValidator = EmailValidator.getInstance(); //ver como inyectar este objeto
    if (!emailValidator.isValid(user.getEmail())) 
        return r.getMessage("judge.register.error.bademail",null, new Locale("en")); 
 
    if (user.getCountry_id() == 0) 
        return r.getMessage("judge.register.error.country",null, new Locale("en")); 
    
    if (user.getInstitution_id() == 0) 
        return r.getMessage("judge.register.error.institution",null, new Locale("en"));        

    if (user.getLid() == 0) 
        return r.getMessage("judge.register.error.planguage",null, new Locale("en"));         

    if (user.getLocale() == 0) 
        return r.getMessage("judge.register.error.locale",null, new Locale("en"));        

    if(user.getName().length() == 0)
        return r.getMessage("judge.register.error.name",null, new Locale("en"));        

    if (user.getGender() == 0) 
        return r.getMessage("judge.register.error.gender",null, new Locale("en"));
          
    return "0";
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:67,代码来源:RestUserProfileController.java


示例16: doGetAuthenticationInfo

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
/**
 * 认证回调函数,登录时调用.
 */
protected AuthenticationInfo doGetAuthenticationInfo(
		AuthenticationToken authcToken) throws AuthenticationException {
	if (null == authcToken) {
		throw new AccountException("登录出错!");
	}
	UsernamePasswordCaptchaToken token = (UsernamePasswordCaptchaToken) authcToken;
	String name = token.getUsername();
	if (StringUtils.isEmpty(name)) {
		throw new AccountException("用户名为空!");
	}
	char[] password = token.getPassword();
	if (password == null || password.length == 0) {
		throw new AccountException("密码为空!");
	}
	// 增加判断验证码逻辑
	String captcha = token.getCaptcha();
	boolean useCaptcha = token.isUseCaptcha();
	if (useCaptcha) {
		String exitCode = (String) SecurityUtils.getSubject().getSession()
				.getAttribute(ValidateCodeServlet.VALIDATE_CODE);
		if (StringUtils.isEmpty(exitCode)) {
			throw new CaptchaInvalidException("图形验证码已经失效,请重新刷新页面!");
		}
		if (StringUtils.isEmpty(captcha)
				|| !captcha.equalsIgnoreCase(exitCode)) {
			throw new CaptchaException("图形验证码错误!");
		}
	}

	Parameter map = Parameter.newParameter();
	if (EmailValidator.getInstance().isValid(name)) {
		map.put("email", name);
	} else if (StringFormatter.isLegalPhone(name)) {
		map.put("phone", name);
	} else {
		map.put("nick", name);
	}
	final User user = userService.queryUser(map);
	if (null == user) {
		throw new UnknownAccountException("您还没有注册,请注册使用!");
	}
	// 审核通过
	if (user.getVerifyStatus() == VerifyStatusEnum.NORMAL.getValue()) {
		IdentityInfo identityInfo = userService.getIdentityInfo(user
				.getId());
		if (identityInfo != null) {
			user.setIdentity(true);
			user.setRealName(identityInfo.getRealName());
		}
	}
	return new SimpleAuthenticationInfo(new ShiroUser(user, password,
			captcha), user.getPassword(),
			ByteSource.Util.bytes(UserConstants.SALT), getName());
}
 
开发者ID:wanghuizi,项目名称:fengduo,代码行数:58,代码来源:ShiroDbRealm.java


示例17: processPvtMsgSettingsSave

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
public String processPvtMsgSettingsSave()
{
  log.debug("processPvtMsgSettingsSave()");
  
 
  String email= getForwardPvtMsgEmail();
  String activate=getActivatePvtMsg() ;
  String forward=getForwardPvtMsg() ;
  if (email != null && (!SET_AS_NO.equals(forward)) 
          && !EmailValidator.getInstance().isValid(email) ) {
    setValidEmail(false);
    setErrorMessage(getResourceBundleString(PROVIDE_VALID_EMAIL));
    setActivatePvtMsg(activate);
    return null;
  }
  else
  {
    Area area = prtMsgManager.getPrivateMessageArea();            
    
    Boolean formAreaEnabledValue = (SET_AS_YES.equals(activate)) ? Boolean.TRUE : Boolean.FALSE;
    area.setEnabled(formAreaEnabledValue);
    
    try {
        int formSendToEmail = Integer.parseInt(sendToEmail);
        area.setSendToEmail(formSendToEmail);
    } catch (NumberFormatException nfe) {
        // if this happens, there is likely something wrong in the UI that needs to be fixed
        log.warn("Non-numeric option for sending email to recipient email address on Message screen. This may indicate a UI problem.");
        setErrorMessage(getResourceBundleString("pvt_send_to_email_invalid"));
        return null;
    }
    
    
    Boolean formAutoForward = (SET_AS_YES.equals(forward)) ? Boolean.TRUE : Boolean.FALSE;            
    forum.setAutoForward(formAutoForward);
    if (Boolean.TRUE.equals(formAutoForward)){
      forum.setAutoForwardEmail(email);  
    }
    else{
      forum.setAutoForwardEmail(null);  
    }
    
    area.setHiddenGroups(new HashSet(hiddenGroups));
           
    prtMsgManager.saveAreaAndForumSettings(area, forum);

    if (isMessagesandForums()) {
  	  return MAIN_PG;
    }
    else {
  	  return MESSAGE_HOME_PG;
    }
  }
  
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:56,代码来源:PrivateMessagesTool.java


示例18: validatePointOfContactInput

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
protected List<String> validatePointOfContactInput(SimplePointOfContactBean simplePOC)
{		
	List<String> errors = new ArrayList<String>();

	if (simplePOC == null) {
		errors.add("Input point of contact object invalid"); //shouldn't happen
		return errors;
	}		

	SimpleOrganizationBean simpleOrg = simplePOC.getOrganization();
	if (simpleOrg != null) {
		String orgName = simpleOrg.getName();
		if (orgName == null || !InputValidationUtil.isTextFieldWhiteList(orgName))
			errors.add(PropertyUtil.getProperty("sample", "organization.name.invalid"));
	} else
		errors.add("Organization Name is a required field");

	SimpleAddressBean addrBean = simplePOC.getAddress();
	if (addrBean != null) {
		String val = addrBean.getLine1();
		if (val != null && val.length() > 0 && !InputValidationUtil.isTextFieldWhiteList(val))
			errors.add(PropertyUtil.getProperty("sample", "organization.address1.invalid"));

		val = addrBean.getLine2();
		if (val != null && val.length() > 0 && !InputValidationUtil.isTextFieldWhiteList(val))
			errors.add(PropertyUtil.getProperty("sample", "organization.address2.invalid"));
		val = addrBean.getCity();
		if (val != null && val.length() > 0 && !InputValidationUtil.isRelaxedAlphabetic(val))
			errors.add(PropertyUtil.getProperty("sample", "organization.city.invalid"));

		val = addrBean.getStateProvince();
		if (val != null && val.length() > 0 && !InputValidationUtil.isRelaxedAlphabetic(val))
			errors.add(PropertyUtil.getProperty("sample", "organization.state.invalid"));

		val = addrBean.getCountry();
		if (val != null && val.length() > 0 && !InputValidationUtil.isRelaxedAlphabetic(val))
			errors.add(PropertyUtil.getProperty("sample", "organization.country.invalid"));

		val = addrBean.getZip();
		if (val != null && val.length() > 0 && !InputValidationUtil.isZipValid(addrBean.getZip()))
			errors.add(PropertyUtil.getProperty("sample", "postalCode.invalid"));
	}

	String name = simplePOC.getFirstName();
	if (name != null && name.length() > 0 && !InputValidationUtil.isRelaxedAlphabetic(name))
		errors.add(PropertyUtil.getProperty("sample", "firstName.invalid"));

	name = simplePOC.getLastName();
	if (name != null && name.length() > 0 && !InputValidationUtil.isRelaxedAlphabetic(name))
		errors.add(PropertyUtil.getProperty("sample", "lastName.invalid"));

	name = simplePOC.getMiddleInitial();
	if (name != null && name.length() > 0 && !InputValidationUtil.isRelaxedAlphabetic(name))
		errors.add(PropertyUtil.getProperty("sample", "middleInitial.invalid"));

	String phone = simplePOC.getPhoneNumber();
	if ( phone.length() > 0 && !InputValidationUtil.isPhoneValid(phone))
		errors.add(PropertyUtil.getProperty("sample", "phone.invalid"));
	//			
	String email = simplePOC.getEmail();
	EmailValidator emailValidator = EmailValidator.getInstance();
	if (email != null && email.length() > 0 && !emailValidator.isValid(email))
		errors.add("Email is invalid");

	return errors;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:67,代码来源:SampleBO.java


示例19: isEmailValid

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
public static boolean isEmailValid(String email) {
	EmailValidator emailValidator = EmailValidator.getInstance();
	return (email == null || email.length() == 0) ? true : emailValidator.isValid(email);
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:5,代码来源:InputValidationUtil.java


示例20: setMailFrom

import org.apache.commons.validator.EmailValidator; //导入依赖的package包/类
public void setMailFrom(String mailFrom) {
	this.mailFrom = EmailValidator.getInstance().isValid(mailFrom) ? mailFrom : null;
}
 
开发者ID:NCIP,项目名称:stats-application-commons,代码行数:4,代码来源:MailProps.java



注:本文中的org.apache.commons.validator.EmailValidator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ComponentResources类代码示例发布时间:2022-05-21
下一篇:
Java ExecutionCallback类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap