Example usage for java.util MissingResourceException printStackTrace

List of usage examples for java.util MissingResourceException printStackTrace

Introduction

In this page you can find the example usage for java.util MissingResourceException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.cap.selfService.myAccount.ui.bean.AddressBookBackingBean.java

public String validatePartyPhone() {

    String status = "sucess";
    FacesContext context = FacesContext.getCurrentInstance();
    FacesMessage message = new FacesMessage();
    Pattern p1 = Pattern.compile(expr1);
    Pattern p2 = Pattern.compile(expr2);

    Matcher m1 = p1.matcher((String) getPhonePartyIpTx().getValue());
    Matcher m2 = p2.matcher((String) getPhonePartyIpTx().getValue());

    try {/*from   ww w .ja v a2 s.co  m*/

        if (getCountryPartySelOneCho() != null && (getCountryPartySelOneCho().getValue().equals("US")
                || getCountryPartySelOneCho().getValue().equals("CA"))) {

            if (!m1.find() && !m2.find()) {
                message.setDetail(resourceBundle.getString("PHONE_FORMAT"));
                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                context.addMessage(getPhonePartyIpTx().getClientId(context), message);
                status = "failure";
            }
        }
    } catch (MissingResourceException e) {
        sLog.debug(e.getMessage(), e);
        e.printStackTrace();
    }
    return status;
}

From source file:org.cap.selfService.myAccount.ui.bean.AddressBookBackingBean.java

public String validateNewInstPhone() {

    String status = "sucess";
    FacesMessage message = new FacesMessage();
    FacesContext context = FacesContext.getCurrentInstance();

    Pattern p1 = Pattern.compile(expr1);
    Pattern p2 = Pattern.compile(expr2);

    Matcher m1 = p1.matcher((String) getPhoneBusNewInstIpTx().getValue());
    Matcher m2 = p2.matcher((String) getPhoneBusNewInstIpTx().getValue());

    try {//from   w  ww.  j  a  v  a 2s . c  o m
        if (getCountryBusNewInstSelOneCho() != null && (getCountryBusNewInstSelOneCho().getValue().equals("US")
                || getCountryBusNewInstSelOneCho().getValue().equals("CA"))) {
            if (!m1.find() && !m2.find()) {
                message.setDetail(resourceBundle.getString("PHONE_FORMAT"));
                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                context.addMessage(getPhoneBusNewInstIpTx().getClientId(context), message);
                status = "failure";
            }
        }

    } catch (MissingResourceException e) {
        //sLog.debug(e.getMessage(),e);
        e.printStackTrace();
    }
    return status;
}

From source file:org.cap.selfService.myAccount.ui.bean.AddressBookBackingBean.java

public String validateHomePhone() {

    String status = "sucess";
    FacesMessage message = new FacesMessage();
    FacesContext context = FacesContext.getCurrentInstance();
    Pattern p1 = Pattern.compile(expr1);
    Pattern p2 = Pattern.compile(expr2);

    Matcher m1 = p1.matcher((String) getPhoneHomeIpTx().getValue());
    Matcher m2 = p2.matcher((String) getPhoneHomeIpTx().getValue());

    try {/*from www . j a  va2s  .  co m*/
        if (getCountryHomeSelOneCho() != null && (getCountryHomeSelOneCho().getValue().equals("US")
                || getCountryHomeSelOneCho().getValue().equals("CA"))) {
            if (!m1.find() && !m2.find()) {
                message.setDetail(resourceBundle.getString("PHONE_FORMAT"));
                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                context.addMessage(getPhoneHomeIpTx().getClientId(context), message);
                status = "failure";
            }
        }

    } catch (MissingResourceException e) {
        // sLog.debug(e.getMessage(),e);
        e.printStackTrace();
    }
    return status;
}

From source file:org.cap.selfService.myAccount.ui.bean.AddressBookBackingBean.java

public String validateNewInstFax() {

    String status = "sucess";
    FacesMessage message = new FacesMessage();
    FacesContext context = FacesContext.getCurrentInstance();
    Pattern p1 = Pattern.compile(expr1);
    Pattern p2 = Pattern.compile(expr2);

    Matcher m1 = p1.matcher((String) getFaxBusNewInstIpTx().getValue());
    Matcher m2 = p2.matcher((String) getFaxBusNewInstIpTx().getValue());

    try {/*from  ww  w .ja  v  a 2 s.c  o  m*/
        if (getCountryBusNewInstSelOneCho() != null && (getCountryBusNewInstSelOneCho().getValue().equals("US")
                || getCountryBusNewInstSelOneCho().getValue().equals("CA"))) {
            if (!m1.find() && !m2.find()) {
                message.setDetail(resourceBundle.getString("FAX_FORMAT"));
                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                context.addMessage(getFaxBusNewInstIpTx().getClientId(context), message);
                status = "failure";
            }
        }

    } catch (MissingResourceException e) {
        //  sLog.debug(e.getMessage(),e);
        e.printStackTrace();
    }
    return status;
}

From source file:org.cap.selfService.myAccount.ui.bean.AddressBookBackingBean.java

public String validateHomeFax() {

    String status = "sucess";
    FacesMessage message = new FacesMessage();
    FacesContext context = FacesContext.getCurrentInstance();
    Pattern p1 = Pattern.compile(expr1);
    Pattern p2 = Pattern.compile(expr2);

    Matcher m1 = p1.matcher((String) getFaxHomeIpTx().getValue());
    Matcher m2 = p2.matcher((String) getFaxHomeIpTx().getValue());

    try {/*from  w w  w  .  j  a  v  a2  s . c o m*/

        if (getCountryHomeSelOneCho() != null && (getCountryHomeSelOneCho().getValue().equals("US")
                || getCountryHomeSelOneCho().getValue().equals("CA")
                || getCountryHomeSelOneCho().getValue().equals("PR"))) {
            if (!m1.find() && !m2.find()) {
                message.setDetail(resourceBundle.getString("FAX_FORMAT"));
                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                context.addMessage(getFaxHomeIpTx().getClientId(context), message);
                status = "failure";
            }
        }
    } catch (MissingResourceException e) {
        //   sLog.debug(e.getMessage(),e);
        e.printStackTrace();
    }
    return status;
}

From source file:org.cap.selfService.myAccount.ui.bean.AddressBookBackingBean.java

public String validateReqFlds() {
    FacesContext context = FacesContext.getCurrentInstance();

    String status = "sucess";
    try {//from   ww w  .j  av  a 2  s .c  om
        if (getAddressOptionsRdBtn().getValue().equals("business")
                || (getAddressOptionsRdBtn().getValue().equals("businesshome"))) {
            if (getInstitutionOptionsRdBtn().getValue().equals("browseInst")) {

                if (getPartyNameIpLOV().getValue() == null
                        || (getPartyNameIpLOV().getValue() != null
                                && getPartyNameIpLOV().getValue().toString().trim().equals(""))
                        || (getPartyNameIpLOV().getValue() != null
                                && getPartyNameIpLOV().getValue().toString().trim().equals(""))) {

                    status = "failure";
                    FacesMessage message = new FacesMessage();
                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                    message.setDetail(resourceBundle.getString("BUS_INSTNAME_REQ"));
                    context.addMessage(getPartyNameIpLOV().getClientId(context), message);
                } else {
                    if (getAddress1PartyIpTx().getValue() == null || (getAddress1PartyIpTx().getValue() != null
                            && getAddress1PartyIpTx().getValue().toString().trim().equals(""))) {

                        status = "failure";
                        FacesMessage message = new FacesMessage();
                        message.setSeverity(FacesMessage.SEVERITY_ERROR);
                        message.setDetail(resourceBundle.getString("BUS_ADDR1_REQ"));
                        context.addMessage(getAddress1PartyIpTx().getClientId(context), message);
                    }
                    if (getCountryPartySelOneCho().getValue() == null
                            || (getCountryPartySelOneCho().getValue() != null
                                    && getCountryPartySelOneCho().getValue().equals(""))) {

                        status = "failure";
                        FacesMessage message = new FacesMessage();
                        message.setSeverity(FacesMessage.SEVERITY_ERROR);
                        message.setDetail(resourceBundle.getString("BUS_COUNTRY_REQ"));
                        context.addMessage(getCountryPartySelOneCho().getClientId(context), message);
                    }
                    if (getCityPartyIpTx().getValue() == null || (getCityPartyIpTx().getValue() != null
                            && getCityPartyIpTx().getValue().toString().trim().equals(""))) {

                        status = "failure";
                        FacesMessage message = new FacesMessage();
                        message.setSeverity(FacesMessage.SEVERITY_ERROR);
                        message.setDetail(resourceBundle.getString("BUS_CITY_REQ"));
                        context.addMessage(getCityPartyIpTx().getClientId(context), message);
                    }
                    if (getPhonePartyIpTx().getValue() == null || (getPhonePartyIpTx().getValue() != null
                            && getPhonePartyIpTx().getValue().toString().trim().equals(""))) {

                        status = "failure";
                        FacesMessage message = new FacesMessage();
                        message.setSeverity(FacesMessage.SEVERITY_ERROR);
                        message.setDetail(resourceBundle.getString("BUS_PHONE_REQ"));
                        context.addMessage(getPhonePartyIpTx().getClientId(context), message);
                    }

                    if (getPhonePartyIpTx().getValue() != null
                            && !getPhonePartyIpTx().getValue().toString().trim().equals("")) {
                        String phoneStatus = validatePartyPhone();
                        if (phoneStatus.equals("failure")) {
                            status = "failure";
                        }
                    }
                    if (getFaxPartyIpTx().getValue() != null
                            && !getFaxPartyIpTx().getValue().toString().trim().equals("")) {
                        String faxStatus = validatePartyFax();
                        if (faxStatus.equals("failure")) {
                            status = "failure";
                        }
                    }
                    if (getCountryPartySelOneCho().getValue() != null) {

                        if (getCountryPartySelOneCho().getValue().equals("US")) {

                            if (getStatesUSPartySelOneCho().getValue() == null
                                    || (getStatesUSPartySelOneCho().getValue() != null
                                            && getStatesUSPartySelOneCho().getValue().equals(""))) {

                                status = "failure";
                                FacesMessage message = new FacesMessage();
                                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                                message.setDetail(resourceBundle.getString("BUS_STATES_REQ"));
                                context.addMessage(getStatesUSPartySelOneCho().getClientId(context), message);
                            }
                            if (getPostalCodePartyIpTx().getValue() == null
                                    || (getPostalCodePartyIpTx().getValue() != null && getPostalCodePartyIpTx()
                                            .getValue().toString().trim().equals(""))) {

                                status = "failure";
                                FacesMessage message = new FacesMessage();
                                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                                message.setDetail(resourceBundle.getString("BUS_ZIP_REQ"));
                                context.addMessage(getPostalCodePartyIpTx().getClientId(context), message);
                            }
                        }
                        if (getCountryPartySelOneCho().getValue() != null
                                && getCountryPartySelOneCho().getValue().equals("AU")) {

                            if (getStatesAUPartySelOneCho().getValue() == null
                                    || (getStatesAUPartySelOneCho().getValue() != null
                                            && getStatesAUPartySelOneCho().getValue().equals(""))) {

                                status = "failure";
                                FacesMessage message = new FacesMessage();
                                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                                message.setDetail(resourceBundle.getString("BUS_STATES_REQ"));
                                context.addMessage(getStatesAUPartySelOneCho().getClientId(context), message);
                            }
                        }
                        if (getCountryPartySelOneCho().getValue() != null
                                && getCountryPartySelOneCho().getValue().equals("CA")) {
                            if (getStatesCAPartySelOneCho().getValue() == null
                                    || (getStatesCAPartySelOneCho().getValue() != null
                                            && getStatesCAPartySelOneCho().getValue().equals(""))) {

                                status = "failure";
                                FacesMessage message = new FacesMessage();
                                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                                message.setDetail(resourceBundle.getString("BUS_STATES_REQ"));
                                context.addMessage(getStatesCAPartySelOneCho().getClientId(context), message);
                            }
                            if (getPostalCodePartyIpTx().getValue() == null
                                    || (getPostalCodePartyIpTx().getValue() != null && getPostalCodePartyIpTx()
                                            .getValue().toString().trim().equals(""))) {

                                status = "failure";
                                FacesMessage message = new FacesMessage();
                                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                                message.setDetail(resourceBundle.getString("BUS_ZIP_REQ"));
                                context.addMessage(getPostalCodePartyIpTx().getClientId(context), message);
                            }
                        }

                        //party zipcode validation
                        if (getPostalCodePartyIpTx().getValue() != null
                                && !getPostalCodePartyIpTx().getValue().toString().trim().equals("")) {
                            FacesMessage message = new FacesMessage();
                            Pattern p4 = Pattern.compile(expr4);
                            Pattern p5 = Pattern.compile(expr5);
                            Matcher m4 = p4.matcher((String) getPostalCodePartyIpTx().getValue());
                            Matcher m5 = p5.matcher((String) getPostalCodePartyIpTx().getValue());
                            if (getCountryPartySelOneCho() != null
                                    && getCountryPartySelOneCho().getValue().equals("US")) {
                                if (!m4.find()) {
                                    message.setDetail(resourceBundle.getString("ZIPFORMAT"));
                                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                                    context.addMessage(getPostalCodePartyIpTx().getClientId(context), message);
                                    status = "failure";
                                }
                            }
                            if (getCountryPartySelOneCho() != null
                                    && getCountryPartySelOneCho().getValue().equals("CA")) {
                                if (!m5.find()) {
                                    message.setDetail(resourceBundle.getString("ZIPFORMAT"));
                                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                                    context.addMessage(getPostalCodePartyIpTx().getClientId(context), message);
                                    status = "failure";
                                }
                            }
                        }
                    }
                }
            }
            if (getInstitutionOptionsRdBtn().getValue().equals("newInst")) {

                if (getInstitutionNameBusNewInstIpTx().getValue() == null
                        || (getInstitutionNameBusNewInstIpTx().getValue() != null
                                && getInstitutionNameBusNewInstIpTx().getValue().toString().equals(""))) {
                    status = "failure";
                    FacesMessage message = new FacesMessage();
                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                    message.setDetail(resourceBundle.getString("BUS_INSTNAME_REQ"));
                    context.addMessage(getInstitutionNameBusNewInstIpTx().getClientId(context), message);
                }
                if (getAddress1BusNewInstIpTx().getValue() == null
                        || (getAddress1BusNewInstIpTx().getValue() != null
                                && getAddress1BusNewInstIpTx().getValue().toString().equals(""))) {
                    status = "failure";
                    FacesMessage message = new FacesMessage();
                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                    message.setDetail(resourceBundle.getString("BUS_ADDR1_REQ"));
                    context.addMessage(getAddress1BusNewInstIpTx().getClientId(context), message);
                }
                if (getCountryBusNewInstSelOneCho().getValue() == null
                        || (getCountryBusNewInstSelOneCho().getValue() != null
                                && getCountryBusNewInstSelOneCho().getValue().equals(""))) {
                    status = "failure";
                    FacesMessage message = new FacesMessage();
                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                    message.setDetail(resourceBundle.getString("BUS_COUNTRY_REQ"));
                    context.addMessage(getCountryBusNewInstSelOneCho().getClientId(context), message);
                }
                if (getCityBusNewInstIpTx().getValue() == null || (getCityBusNewInstIpTx().getValue() != null
                        && getCityBusNewInstIpTx().getValue().toString().equals(""))) {
                    status = "failure";
                    FacesMessage message = new FacesMessage();
                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                    message.setDetail(resourceBundle.getString("BUS_CITY_REQ"));
                    context.addMessage(getCityBusNewInstIpTx().getClientId(context), message);
                }
                if (getPhoneBusNewInstIpTx().getValue() == null || (getPhoneBusNewInstIpTx().getValue() != null
                        && getPhoneBusNewInstIpTx().getValue().toString().equals(""))) {
                    status = "failure";
                    FacesMessage message = new FacesMessage();
                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                    message.setDetail(resourceBundle.getString("BUS_PHONE_REQ"));
                    context.addMessage(getPhoneBusNewInstIpTx().getClientId(context), message);
                }
                if (getPhoneBusNewInstIpTx().getValue() != null
                        && !getPhoneBusNewInstIpTx().getValue().toString().equals("")) {
                    String phoneStatus = validateNewInstPhone();
                    if (phoneStatus.equals("failure")) {
                        status = "failure";
                    }
                }
                if (getFaxBusNewInstIpTx().getValue() != null
                        && !getFaxBusNewInstIpTx().getValue().toString().equals("")) {
                    String faxStatus = validateNewInstFax();
                    if (faxStatus.equals("failure")) {
                        status = "failure";
                    }
                }
                if (getCountryBusNewInstSelOneCho().getValue().equals("US")) {
                    if (getStatesUSNewInstSelOneCho().getValue() == null
                            || (getStatesUSNewInstSelOneCho().getValue() != null
                                    && getStatesUSNewInstSelOneCho().getValue().equals(""))) {
                        status = "failure";
                        FacesMessage message = new FacesMessage();
                        message.setSeverity(FacesMessage.SEVERITY_ERROR);
                        message.setDetail(resourceBundle.getString("BUS_STATES_REQ"));
                        context.addMessage(getStatesUSNewInstSelOneCho().getClientId(context), message);
                    }
                    if (getPostalCodeBusNewInstIpTx().getValue() == null
                            || (getPostalCodeBusNewInstIpTx().getValue() != null
                                    && getPostalCodeBusNewInstIpTx().getValue().toString().trim().equals(""))) {
                        status = "failure";
                        FacesMessage message = new FacesMessage();
                        message.setSeverity(FacesMessage.SEVERITY_ERROR);
                        message.setDetail(resourceBundle.getString("BUS_ZIP_REQ"));
                        context.addMessage(getPostalCodeBusNewInstIpTx().getClientId(context), message);
                    }
                }
                if (getCountryBusNewInstSelOneCho().getValue().equals("AU")) {
                    if (getStatesAUNewInstSelOneCho().getValue() == null
                            || (getStatesAUNewInstSelOneCho().getValue() != null
                                    && getStatesAUNewInstSelOneCho().getValue().equals(""))) {
                        status = "failure";
                        FacesMessage message = new FacesMessage();
                        message.setSeverity(FacesMessage.SEVERITY_ERROR);
                        message.setDetail(resourceBundle.getString("BUS_STATES_REQ"));
                        context.addMessage(getStatesAUNewInstSelOneCho().getClientId(context), message);
                    }
                }
                if (getCountryBusNewInstSelOneCho().getValue().equals("CA")) {
                    if (getStatesCANewInstSelOneCho().getValue() == null
                            || (getStatesCANewInstSelOneCho().getValue() != null
                                    && getStatesCANewInstSelOneCho().getValue().equals(""))) {
                        status = "failure";
                        FacesMessage message = new FacesMessage();
                        message.setSeverity(FacesMessage.SEVERITY_ERROR);
                        message.setDetail(resourceBundle.getString("BUS_STATES_REQ"));
                        context.addMessage(getStatesCANewInstSelOneCho().getClientId(context), message);
                    }
                    if (getPostalCodeBusNewInstIpTx().getValue() == null
                            || (getPostalCodeBusNewInstIpTx().getValue() != null
                                    && getPostalCodeBusNewInstIpTx().getValue().toString().equals(""))) {
                        status = "failure";
                        FacesMessage message = new FacesMessage();
                        message.setSeverity(FacesMessage.SEVERITY_ERROR);
                        message.setDetail(resourceBundle.getString("BUS_ZIP_REQ"));
                        context.addMessage(getPostalCodeBusNewInstIpTx().getClientId(context), message);
                    }
                }
                //new inst zipcode validation
                if (getPostalCodeBusNewInstIpTx().getValue() != null
                        && !getPostalCodeBusNewInstIpTx().getValue().toString().trim().equals("")) {
                    FacesMessage message = new FacesMessage();
                    Pattern p4 = Pattern.compile(expr4);
                    Pattern p5 = Pattern.compile(expr5);
                    Matcher m4 = p4.matcher((String) getPostalCodeBusNewInstIpTx().getValue());
                    Matcher m5 = p5.matcher((String) getPostalCodeBusNewInstIpTx().getValue());
                    if (getCountryBusNewInstSelOneCho() != null
                            && getCountryBusNewInstSelOneCho().getValue().equals("US")) {
                        if (!m4.find()) {
                            message.setDetail(resourceBundle.getString("ZIPFORMAT"));
                            message.setSeverity(FacesMessage.SEVERITY_ERROR);
                            context.addMessage(getPostalCodeBusNewInstIpTx().getClientId(context), message);
                            status = "failure";
                        }
                    }
                    if (getCountryBusNewInstSelOneCho() != null
                            && getCountryBusNewInstSelOneCho().getValue().equals("CA")) {
                        if (!m5.find()) {
                            message.setDetail(resourceBundle.getString("ZIPFORMAT"));
                            message.setSeverity(FacesMessage.SEVERITY_ERROR);
                            context.addMessage(getPostalCodeBusNewInstIpTx().getClientId(context), message);
                            status = "failure";
                        }
                    }
                }
            }
        }
        //home
        if (getAddressOptionsRdBtn().getValue().equals("home")
                || (getAddressOptionsRdBtn().getValue().equals("businesshome"))) {

            if (getAddress1HomeIpTx().getValue() == null || (getAddress1HomeIpTx().getValue() != null
                    && getAddress1HomeIpTx().getValue().toString().trim().equals(""))) {
                status = "failure";
                FacesMessage message = new FacesMessage();
                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                message.setDetail(resourceBundle.getString("HOME_ADDR1_REQ"));
                context.addMessage(getAddress1HomeIpTx().getClientId(context), message);
            }
            if (getCountryHomeSelOneCho().getValue() == null || (getCountryHomeSelOneCho().getValue() != null
                    && getCountryHomeSelOneCho().getValue().equals(""))) {
                status = "failure";
                FacesMessage message = new FacesMessage();
                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                message.setDetail(resourceBundle.getString("HOME_COUNTRY_REQ"));
                context.addMessage(getCountryHomeSelOneCho().getClientId(context), message);
            }
            if (getCityHomeIpTx().getValue() == null || (getCityHomeIpTx().getValue() != null
                    && getCityHomeIpTx().getValue().toString().trim().equals(""))) {
                status = "failure";
                FacesMessage message = new FacesMessage();
                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                message.setDetail(resourceBundle.getString("HOME_CITY_REQ"));
                context.addMessage(getCityHomeIpTx().getClientId(context), message);
            }
            if (getPhoneHomeIpTx().getValue() == null || (getPhoneHomeIpTx().getValue() != null
                    && getPhoneHomeIpTx().getValue().toString().trim().equals(""))) {
                status = "failure";
                FacesMessage message = new FacesMessage();
                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                message.setDetail(resourceBundle.getString("HOME_PHONE_REQ"));
                context.addMessage(getPhoneHomeIpTx().getClientId(context), message);
            }
            if (getPhoneHomeIpTx().getValue() != null
                    && !getPhoneHomeIpTx().getValue().toString().trim().equals("")) {
                String phoneStatus = validateHomePhone();
                if (phoneStatus.equals("failure")) {
                    status = "failure";
                }
            }
            if (getFaxHomeIpTx().getValue() != null
                    && !getFaxHomeIpTx().getValue().toString().trim().equals("")) {
                String faxStatus = validateHomeFax();
                if (faxStatus.equals("failure")) {
                    status = "failure";
                }
            }
            if (getCountryHomeSelOneCho().getValue().equals("US")) {
                if (getStatesUSHomeSelOneCho().getValue() == null
                        || (getStatesUSHomeSelOneCho().getValue() != null
                                && getStatesUSHomeSelOneCho().getValue().equals(""))) {
                    status = "failure";
                    FacesMessage message = new FacesMessage();
                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                    message.setDetail(resourceBundle.getString("HOME_STATES_REQ"));
                    context.addMessage(getStatesUSHomeSelOneCho().getClientId(context), message);
                }
                if (getPostalCodeHomeIpTx().getValue() == null || (getPostalCodeHomeIpTx().getValue() != null
                        && getPostalCodeHomeIpTx().getValue().toString().trim().equals(""))) {
                    status = "failure";
                    FacesMessage message = new FacesMessage();
                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                    message.setDetail(resourceBundle.getString("HOME_ZIP_REQ"));
                    context.addMessage(getPostalCodeHomeIpTx().getClientId(context), message);
                }
            }
            if (getCountryHomeSelOneCho().getValue().equals("AU")) {
                if (getStatesAUHomeSelOneCho().getValue() == null
                        || (getStatesAUHomeSelOneCho().getValue() != null
                                && getStatesAUHomeSelOneCho().getValue().equals(""))) {
                    status = "failure";
                    FacesMessage message = new FacesMessage();
                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                    message.setDetail(resourceBundle.getString("HOME_STATES_REQ"));
                    context.addMessage(getStatesAUHomeSelOneCho().getClientId(context), message);
                }
            }
            if (getCountryHomeSelOneCho().getValue().equals("CA")) {
                if (getStatesCAHomeSelOneCho().getValue() == null
                        || (getStatesCAHomeSelOneCho().getValue() != null
                                && getStatesCAHomeSelOneCho().getValue().equals(""))) {
                    status = "failure";
                    FacesMessage message = new FacesMessage();
                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                    message.setDetail(resourceBundle.getString("HOME_STATES_REQ"));
                    context.addMessage(getStatesCAHomeSelOneCho().getClientId(context), message);
                }
                if (getPostalCodeHomeIpTx().getValue() == null || (getPostalCodeHomeIpTx().getValue() != null
                        && getPostalCodeHomeIpTx().getValue().toString().trim().equals(""))) {
                    status = "failure";
                    FacesMessage message = new FacesMessage();
                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                    message.setDetail(resourceBundle.getString("HOME_ZIP_REQ"));
                    context.addMessage(getPostalCodeHomeIpTx().getClientId(context), message);
                }
            }
            //home zipcode validation
            if (getPostalCodeHomeIpTx().getValue() != null
                    && !getPostalCodeHomeIpTx().getValue().toString().trim().equals("")) {
                FacesMessage message = new FacesMessage();
                Pattern p4 = Pattern.compile(expr4);
                Pattern p5 = Pattern.compile(expr5);
                Matcher m4 = p4.matcher((String) getPostalCodeHomeIpTx().getValue());
                Matcher m5 = p5.matcher((String) getPostalCodeHomeIpTx().getValue());
                if (getCountryHomeSelOneCho() != null && getCountryHomeSelOneCho().getValue().equals("US")) {
                    if (!m4.find()) {

                        message.setDetail(resourceBundle.getString("ZIPFORMAT"));
                        message.setSeverity(FacesMessage.SEVERITY_ERROR);
                        context.addMessage(getPostalCodeHomeIpTx().getClientId(context), message);
                        status = "failure";
                    }
                }
                if (getCountryHomeSelOneCho() != null && getCountryHomeSelOneCho().getValue().equals("CA")) {
                    if (!m5.find()) {
                        message.setDetail(resourceBundle.getString("ZIPFORMAT"));
                        message.setSeverity(FacesMessage.SEVERITY_ERROR);
                        context.addMessage(getPostalCodeHomeIpTx().getClientId(context), message);
                        status = "failure";
                    }
                }
            }
        }
        if ((getAddressOptionsRdBtn().getValue().equals("businesshome"))) {
            if (getAddressPreferenceRdBtn().getValue() == null) {
                status = "failure";
                FacesMessage message = new FacesMessage();
                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                message.setDetail(resourceBundle.getString("ADDR_OPTIONS_REQ"));
                context.addMessage(getAddressPreferenceRdBtn().getClientId(context), message);
            }
        }

        if (getLicenseNumberIpTx().getValue() != null && !getLicenseNumberIpTx().getValue().equals("")
                && !getLicenseNumberIpTx().isReadOnly()) {
            String expression = "^[A-Za-z][A-Za-z][0-9]{1,20}$";
            Pattern p1 = Pattern.compile(expression);
            Matcher m1 = p1.matcher((String) getLicenseNumberIpTx().getValue());
            if (!m1.find()) {
                status = "failure";
                FacesMessage message = new FacesMessage();
                message.setSeverity(FacesMessage.SEVERITY_ERROR);
                message.setDetail("Invalid License Number");
                context.addMessage(getLicenseNumberIpTx().getClientId(context), message);
            }
        }
    } catch (MissingResourceException e) {
        sLog.debug(e.getMessage(), e);
        e.printStackTrace();
    } catch (Exception e) {
        sLog.debug(e.getMessage(), e);
        e.printStackTrace();
    }
    return status;
}

From source file:edu.ku.brc.af.ui.db.ERTICaptionInfo.java

/**
 * Constructor. Position Index is set after object is created.
 * @param element/*from   www .j a v  a2 s  .  com*/
 */
public ERTICaptionInfo(final Element element, final ResourceBundle resBundle) {
    super();

    int tblId = getAttr(element, "tableid", -1); //$NON-NLS-1$
    if (tblId == -1) {
        throw new RuntimeException(
                "search_config.xml caption has bad id[" + getAttr(element, "tableid", "N/A") + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    }

    DBTableInfo tableInfo = DBTableIdMgr.getInstance().getInfoById(tblId);

    String dataObjFormatterName = getAttr(element, "dataobjformatter", null); //$NON-NLS-1$
    String formatter = getAttr(element, "formatter", dataObjFormatterName); //$NON-NLS-1$

    this.colName = element.attributeValue("col"); //$NON-NLS-1$

    String lookupColName = null;
    if (this.colName != null) {
        if (this.colName.indexOf('.') > -1) {
            lookupColName = StringUtils.substringAfterLast(this.colName, ".");
        } else {
            lookupColName = this.colName;
        }
        fieldInfo = tableInfo.getFieldByColumnName(lookupColName);
    }

    String key = getAttr(element, "key", null); //$NON-NLS-1$
    if (StringUtils.isNotEmpty(key)) {
        try {
            colLabel = resBundle.getString(key);
            description = resBundle.getString(key + "_desc"); //$NON-NLS-1$

        } catch (java.util.MissingResourceException ex) {
            log.error("Missing resource [" + key + "] or [" + key + "_desc]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            colLabel = key;
            description = key + "_desc"; //$NON-NLS-1$
        }

    } else if (tableInfo != null) {
        if (fieldInfo == null) {
            if (this.colName != null && this.colName.endsWith("ID")) //$NON-NLS-1$
            {
                colLabel = this.colName;
                description = ""; //$NON-NLS-1$

            } else if (this.colName == null) {
                colInfoList = new Vector<ColInfo>();
                int pos = 0;
                for (Object colObj : element.selectNodes("col")) //$NON-NLS-1$
                {
                    Element colInfoObj = (Element) colObj;
                    ColInfo columnInfo = new ColInfo(getAttr(colInfoObj, "name", null), //$NON-NLS-1$
                            getAttr(colInfoObj, "field", null)); //$NON-NLS-1$
                    columnInfo.setPosition(pos++);
                    if (colInfoList.size() == 0) {
                        fieldInfo = tableInfo.getFieldByColumnName(columnInfo.getColumnName());
                    }
                    colInfoList.add(columnInfo);
                }

                if (tableInfo != null) {
                    for (ColInfo columnInfo : colInfoList) {
                        DBFieldInfo fi = tableInfo.getFieldByName(columnInfo.getFieldName());
                        if (fi != null) {
                            columnInfo.setFieldClass(fi.getDataClass());
                        } else {
                            log.error("Field Name in TableId doesn't exist Class is not a Data Table[" //$NON-NLS-1$
                                    + tableInfo.getTitle() + "] Field[" + columnInfo.getFieldName() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
                        }
                    }

                } else {
                    log.error("Aggregate Sub Class is not a Data Table[" //$NON-NLS-1$
                            + (tableInfo != null ? tableInfo.getTitle() : "N/A") + "]"); //$NON-NLS-1$
                }

            } else {
                throw new RuntimeException("Couldn't convert column Name[" + this.colName //$NON-NLS-1$
                        + "] to a field name to find the field in table[" + tblId + "]"); //$NON-NLS-1$ //$NON-NLS-2$
            }
        } else if (fieldInfo.getFormatter() != null) {
            formatter = fieldInfo.getFormatter().getName();
        }

    } else {
        throw new RuntimeException("Table Id is bad id[" + getAttr(element, "tableid", "N/A") + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    }

    this.isVisible = getAttr(element, "visible", true); //$NON-NLS-1$

    String aggTableClassName = null;

    Element subElement = (Element) element.selectSingleNode("subobject"); //$NON-NLS-1$

    Element aggElement = (Element) element.selectSingleNode("agg"); //$NON-NLS-1$
    if (aggElement != null) {
        String aggClassName = getAttr(aggElement, "class", null); //$NON-NLS-1$
        if (StringUtils.isNotEmpty(aggClassName)) {
            aggTableClassName = aggClassName;
            try {
                aggClass = Class.forName(aggClassName);
                boolean aggOK = false;
                DBTableInfo tInfo = DBTableIdMgr.getInstance().getByShortClassName(aggClass.getSimpleName());
                if (tInfo != null && StringUtils.isNotEmpty(tInfo.getAggregatorName())) {
                    DataObjAggregator agg = DataObjFieldFormatMgr.getInstance()
                            .getAggregator(tInfo.getAggregatorName());
                    if (agg != null) {
                        aggregatorName = tInfo.getAggregatorName();
                        aggOK = true;
                    }
                }
                if (!aggOK) {
                    aggregatorName = getAttr(aggElement, "aggregator", null); //$NON-NLS-1$
                }
                orderCol = getAttr(aggElement, "ordercol", null); //$NON-NLS-1$

            } catch (ClassNotFoundException ex) {
                ex.printStackTrace();
                edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ERTICaptionInfo.class, ex);
            }
        }
    }

    if (subElement != null) {
        String subClassName = getAttr(subElement, "class", null); //$NON-NLS-1$
        if (StringUtils.isNotEmpty(subClassName)) {
            try {
                subClass = Class.forName(subClassName);
                subClassFieldName = getAttr(subElement, "fieldname", null); //$NON-NLS-1$
                aggTableClassName = subClassName;

            } catch (ClassNotFoundException ex) {
                ex.printStackTrace();
                edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ERTICaptionInfo.class, ex);
            }
        }
    }

    String compositeClassName = null;
    if (StringUtils.isNotEmpty(aggTableClassName)) {
        compositeClassName = aggTableClassName;

    } else if (StringUtils.isNotEmpty(dataObjFormatterName)) {
        dataObjFormatter = DataObjFieldFormatMgr.getInstance().getFormatter(dataObjFormatterName);
        if (dataObjFormatter != null) {
            compositeClassName = dataObjFormatter.getDataClass().getName();
            try {
                aggClass = Class.forName(compositeClassName);

            } catch (ClassNotFoundException ex) {
                ex.printStackTrace();
                edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ERTICaptionInfo.class, ex);
            }
        } else {
            log.error("Couldn't find formatter[" + dataObjFormatterName + "]"); //$NON-NLS-1$ //$NON-NLS-2$
        }
        formatter = null;
    }

    if (StringUtils.isNotEmpty(compositeClassName)) {
        colInfoList = new Vector<ColInfo>();
        for (Object colObj : element.selectNodes("col")) //$NON-NLS-1$
        {
            Element colInfoObj = (Element) colObj;
            ColInfo columnInfo = new ColInfo(getAttr(colInfoObj, "name", null), //$NON-NLS-1$
                    getAttr(colInfoObj, "field", null)); //$NON-NLS-1$
            colInfoList.add(columnInfo);
        }

        DBTableInfo ti = DBTableIdMgr.getInstance().getByClassName(compositeClassName);
        if (ti != null) {
            for (ColInfo columnInfo : colInfoList) {
                DBFieldInfo fi = ti.getFieldByName(columnInfo.getFieldName());
                if (fi != null) {
                    columnInfo.setFieldClass(fi.getDataClass());
                } else {
                    log.error("Field Name is Aggregate Sub Class doesn't exist Class is not a Data Table[" //$NON-NLS-1$
                            + compositeClassName + "] Field[" + columnInfo.getFieldName() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
                }
            }

        } else {
            log.error("Aggregate Sub Class is not a Data Table[" + compositeClassName + "]"); //$NON-NLS-1$ //$NON-NLS-2$
        }
    }

    if (StringUtils.isNotEmpty(formatter)) {
        uiFieldFormatter = UIFieldFormatterMgr.getInstance().getFormatter(formatter);
        if (uiFieldFormatter == null) {
            log.error("The UIFieldFormatter could not be found named [" + formatter + "]"); //$NON-NLS-1$ //$NON-NLS-2$
        }
    }
}