当前位置: 首页>>代码示例>>Java>>正文


Java ErrorList.addError方法代码示例

本文整理汇总了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;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:SMSMessageDeliverer.java

示例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;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:AOLInstantMessageDeliverer.java

示例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;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:40,代码来源:EmailMessageDeliverer.java

示例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;
}
 
开发者ID:kuali,项目名称:rice,代码行数:40,代码来源:EmailMessageDeliverer.java


注:本文中的org.kuali.rice.kcb.exception.ErrorList.addError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。