本文整理汇总了Java中org.kuali.rice.kcb.exception.ErrorList.addError方法的典型用法代码示例。如果您正苦于以下问题:Java ErrorList.addError方法的具体用法?Java ErrorList.addError怎么用?Java ErrorList.addError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.kcb.exception.ErrorList
的用法示例。
在下文中一共展示了ErrorList.addError方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validatePreferenceValues
import org.kuali.rice.kcb.exception.ErrorList; //导入方法依赖的package包/类
/**
* @see org.kuali.rice.kcb.deliverer.MessageDeliverer#validatePreferenceValues(java.util.HashMap)
*/
public void validatePreferenceValues(HashMap prefs) throws ErrorList {
boolean error = false;
ErrorList errorList = new ErrorList();
if (!prefs.containsKey(getName()+"."+MOBILE_NUMBER)) {
errorList.addError("Mobile Phone Number is a required field.");
error = true;
} else {
String mobileNumber = (String) prefs.get(getName()+"."+MOBILE_NUMBER);
if(StringUtils.isBlank(mobileNumber)) {
errorList.addError("Mobile Phone Number is a required.");
error = true;
}
}
if (error) throw errorList;
}
示例2: validatePreferenceValues
import org.kuali.rice.kcb.exception.ErrorList; //导入方法依赖的package包/类
/**
* @see org.kuali.rice.kcb.deliverer.MessageDeliverer#validatePreferenceValues(java.util.HashMap)
*/
public void validatePreferenceValues(HashMap prefs) throws ErrorList {
boolean error = false;
ErrorList errorList = new ErrorList();
if (!prefs.containsKey(getName()+"."+SCREEN_NAME)) {
errorList.addError("AIM Screen Name is a required field.");
error = true;
} else {
String screenName = (String) prefs.get(getName()+"."+SCREEN_NAME);
if(StringUtils.isBlank(screenName)) {
errorList.addError("AIM Screen Name is a required.");
error = true;
}
}
if (error) throw errorList;
}
示例3: validatePreferenceValues
import org.kuali.rice.kcb.exception.ErrorList; //导入方法依赖的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]du\".");
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;
}
示例4: validatePreferenceValues
import org.kuali.rice.kcb.exception.ErrorList; //导入方法依赖的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;
}