org.cap.selfService.selfRegistration.ui.bean.ContactDetailsBackingBean.java Source code

Java tutorial

Introduction

Here is the source code for org.cap.selfService.selfRegistration.ui.bean.ContactDetailsBackingBean.java

Source

package org.cap.selfService.selfRegistration.ui.bean;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.PhaseEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.validator.ValidatorException;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.adf.share.ADFContext;
import oracle.adf.view.rich.component.rich.RichDialog;
import oracle.adf.view.rich.component.rich.RichPopup;
import oracle.adf.view.rich.component.rich.RichQuery;
import oracle.adf.view.rich.component.rich.input.RichInputListOfValues;
import oracle.adf.view.rich.component.rich.input.RichInputText;
import oracle.adf.view.rich.component.rich.input.RichSelectOneChoice;
import oracle.adf.view.rich.component.rich.input.RichSelectOneRadio;

import oracle.adf.view.rich.component.rich.layout.RichPanelFormLayout;
import oracle.adf.view.rich.component.rich.layout.RichPanelGroupLayout;
import oracle.adf.view.rich.component.rich.layout.RichPanelHeader;
import oracle.adf.view.rich.component.rich.nav.RichCommandButton;
import oracle.adf.view.rich.component.rich.nav.RichCommandImageLink;
import oracle.adf.view.rich.component.rich.nav.RichCommandLink;
import oracle.adf.view.rich.component.rich.output.RichImage;
import oracle.adf.view.rich.component.rich.output.RichOutputLabel;
import oracle.adf.view.rich.component.rich.output.RichOutputText;
import oracle.adf.view.rich.component.rich.output.RichSpacer;
import oracle.adf.view.rich.context.AdfFacesContext;
import oracle.adf.view.rich.event.DialogEvent;

import oracle.adf.view.rich.event.LaunchPopupEvent;
import oracle.adf.view.rich.event.PopupCanceledEvent;
import oracle.adf.view.rich.event.ReturnPopupEvent;
import oracle.adf.view.rich.render.ClientEvent;

import oracle.binding.BindingContainer;
import oracle.binding.OperationBinding;

import oracle.javatools.resourcebundle.BundleFactory;

import oracle.jbo.ApplicationModule;
import oracle.jbo.Row;
import oracle.jbo.ViewCriteria;
import oracle.jbo.ViewCriteriaRow;
import oracle.jbo.ViewObject;
import oracle.jbo.client.Configuration;
import oracle.jbo.uicli.binding.JUCtrlAttrsBinding;
import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
import org.apache.myfaces.trinidad.util.Service;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.cap.selfService.selfRegistration.selfRegModel.bean.PhoneValues;
import org.cap.selfService.selfRegistration.ui.util.JSFUtils;
import org.cap.selfService.selfRegistration.selfRegModel.util.TrilliumValidations;

public class ContactDetailsBackingBean {

    private RichSelectOneRadio addressOptionsRdBtn;
    private RichPopup businessAddressConfirmPopup;
    private RichPopup homeAddressConfirmPopup;
    private RichOutputLabel homeOutputLabel;
    private RichOutputLabel businessOutputLabel;
    private RichInputText partyIdIpTx;
    private RichInputText partyNumberIpTx;
    private RichInputListOfValues partyNameIpLOV;
    private RichInputText address1PartyIpTx;
    private RichInputText address2PartyIpTx;
    private RichInputText address3PartyIpTx;
    private RichInputText address4PartyIpTx;
    private RichSelectOneChoice countryPartySelOneCho;
    private RichSelectOneChoice statesUSPartySelOneCho;
    private RichSelectOneChoice statesAUPartySelOneCho;
    private RichSelectOneChoice statesCAPartySelOneCho;
    private RichInputText statesOthersPartyIpTx;
    private RichInputText cityPartyIpTx;
    private RichInputText postalCodePartyIpTx;
    private RichInputText countyPartyIpTx;
    private RichInputText phonePartyIpTx;
    private RichInputText faxExtPartyIpTx;
    private RichInputText faxPartyIpTx;
    private RichInputText phoneExtPartyIpTx;

    private RichInputText institutionNameBusNewInstIpTx;
    private RichInputText address1BusNewInstIpTx;
    private RichInputText address2BusNewInstIpTx;
    private RichInputText address3BusNewInstIpTx;
    private RichInputText address4BusNewInstIpTx;
    private RichSelectOneChoice countryBusNewInstSelOneCho;
    private RichSelectOneChoice statesUSNewInstSelOneCho;
    private RichSelectOneChoice statesAUNewInstSelOneCho;
    private RichSelectOneChoice statesCANewInstSelOneCho;
    private RichInputText statesOtherNewInstIpTx;
    private RichInputText cityBusNewInstIpTx;
    private RichInputText postalCodeBusNewInstIpTx;
    private RichInputText countyBusNewInstIpTx;
    private RichInputText phoneBusNewInstIpTx;
    private RichInputText phoneExtBusNewInstIpTx;
    private RichInputText faxBusNewInstIpTx;
    private RichInputText faxExtBusNewInstIpTx;

    private RichInputText address1HomeIpTx;
    private RichInputText address2HomeIpTx;
    private RichInputText address3HomeIpTx;
    private RichInputText address4HomeIpTx;
    private RichSelectOneChoice countryHomeSelOneCho;
    private RichSelectOneChoice statesUSHomeSelOneCho;
    private RichSelectOneChoice statesAUHomeSelOneCho;
    private RichSelectOneChoice statesCAHomeSelOneCho;
    private RichInputText statesOtherHomeIpTx;
    private RichInputText cityHomeIpTx;
    private RichInputText postalCodeHomeIpTx;
    private RichInputText countyHomeIpTx;
    private RichInputText phoneHomeIpTx;
    private RichInputText faxHomeIpTx;

    TrilliumValidations tv = new TrilliumValidations();

    private RichPopup browseInstAddressConfirmPopup;
    private RichPopup newInstAddressConfirmPopup;

    private RichCommandLink browseInstCmdLnk;
    private RichOutputLabel browseInstOpLbl;
    private RichPanelFormLayout browseInstPnlFrm;
    private RichPanelFormLayout newInstPnlFrm;
    private RichCommandLink newInstCmdLnk;
    private RichOutputText newInstOpLbl;

    private RichPanelGroupLayout homeAddressPnlGrp;
    private RichPanelGroupLayout businessAddressPnlGrp;
    private static final String RESOURCE_BUNDLE_NAME = "view.SelfServiceViewControllerBundle";
    ResourceBundle resourceBundle = BundleFactory.getBundle(RESOURCE_BUNDLE_NAME);

    DCBindingContainer bindings = (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();
    private RichSelectOneRadio institutionOptionsRdBtn;
    private RichSelectOneRadio addressPreferenceRdBtn;
    final Log sLog = LogFactory.getLog(this.getClass());

    String expr1 = "^[1-9]\\d{2}-\\d{3}-\\d{4}$";
    String expr2 = "^[1-9]\\d{9}$";
    // String expr3 = "^[1-9]\\d*$";
    String expr4 = "^\\d{5}(-?(?!(0000|9999))\\d{4})?$";
    String expr5 = "^[a-zA-Z]\\d[a-zA-Z]\\s?\\d[a-zA-Z]\\d$";

    // private RichCommandLink floridaLicenseCmdLnk;
    private RichPanelGroupLayout licensePnlGrp;
    // private RichOutputText floridaLicenseOpLbl;  
    private RichInputText licenseNumberIpTx;
    private RichPanelGroupLayout floridaLicensePnlGrp;
    private RichCommandImageLink floridaLicenseCmdImgLnk;
    private RichImage floridaLicenseImgLbl;

    public ContactDetailsBackingBean() {
    }

    public void browseInstActionListener(ActionEvent actionEvent) {

        //check whether new institution info flds are not null then only display the confirmation  
        if (getInstitutionNameBusNewInstIpTx().getValue() != null
                && !getInstitutionNameBusNewInstIpTx().getValue().equals("")) {
            showPopup(this.getBrowseInstAddressConfirmPopup(), actionEvent.getComponent());
        } else {
            //delete the new inst related info and disable the partyinfo fields            
            disablePartyInfoFlds();
            enableBusBrowstInstLayoutFlds();
            getInstitutionOptionsRdBtn().setValue("browseInst");
            disableBusNewInstLayoutFlds();
            clearNewInstitutionInformation();
            floridaFlds();
        }
    }

    public void newInstActionListener(ActionEvent actionEvent) {
        //check whether party info flds are not null then only display the confirmation        

        if (getPartyNameIpLOV().getValue() != null
                && (!getPartyNameIpLOV().getValue().toString().trim().equals(""))) {
            showPopup(this.getNewInstAddressConfirmPopup(), actionEvent.getComponent());
        } else {
            //delete the party related info    
            enableBusNewInstLayoutFlds();
            getInstitutionOptionsRdBtn().setValue("newInst");
            disableBusBrowstInstLayoutFlds();
            clearPartyInformation();
            floridaFlds();
        }
    }

    public void addressOptionRdBtnValueChangeListener(ValueChangeEvent valueChangeEvent) {

        getAddressOptionsRdBtn().setImmediate(false);
        Object value = valueChangeEvent.getNewValue();

        if (value.equals("businesshome")) {

            enableHomeLayoutFlds();
            enableBusinessLayoutFlds();
            if (getInstitutionOptionsRdBtn().getValue().equals("browseInst")) {
                if (getPartyNameIpLOV().getValue() != null
                        && getPartyNameIpLOV().getValue().toString().trim().equals("")) {
                    disablePartyInfoFlds();
                }
            }
        } else if (value.equals("business")) {
            if (getAddress1HomeIpTx().getValue() != null && !getAddress1HomeIpTx().getValue().equals("")) {
                getAddressOptionsRdBtn().setImmediate(true);
                showPopup(this.getBusinessAddressConfirmPopup(), valueChangeEvent.getComponent());
            } else {
                disableHomeLayoutFlds();
                enableBusinessLayoutFlds();
                floridaFlds();
                if (getInstitutionOptionsRdBtn().getValue().equals("browseInst")) {
                    if (getPartyNameIpLOV() != null && getPartyNameIpLOV().getValue() != null
                            && getPartyNameIpLOV().getValue().toString().trim().equals("")) {

                        disablePartyInfoFlds();
                        disableBusNewInstLayoutFlds();
                    }
                }
                if (getInstitutionOptionsRdBtn().getValue().equals("newInst")) {

                    disablePartyInfoFlds();
                    disableBusBrowstInstLayoutFlds();
                }
                clearHomeInformation();
            }
        }

        else if (value.equals("home")) {
            if ((getInstitutionOptionsRdBtn().getValue().equals("browseInst")
                    && getPartyNameIpLOV().getValue() != null
                    && !getPartyNameIpLOV().getValue().toString().trim().equals(""))
                    || (getInstitutionOptionsRdBtn().getValue().equals("newInst")
                            && getInstitutionNameBusNewInstIpTx().getValue() != null
                            && !getInstitutionNameBusNewInstIpTx().getValue().equals(""))) {
                getAddressOptionsRdBtn().setImmediate(true);
                showPopup(this.getHomeAddressConfirmPopup(), valueChangeEvent.getComponent());
            } else {
                enableHomeLayoutFlds();
                disableBusinessLayoutFlds();
                // clearPartyInformation();
                clearNewInstitutionInformation();
                floridaFlds();

            }
        }
    }

    public void newInstAddressConfirmDialogListener(DialogEvent dialogEvent) {
        if (dialogEvent.getOutcome().equals(DialogEvent.Outcome.ok)) {

            //delete the party related info             
            enableBusNewInstLayoutFlds();
            getInstitutionOptionsRdBtn().setValue("newInst");
            disableBusBrowstInstLayoutFlds();
            clearPartyInformation();
            floridaFlds();
        }
    }

    public void browseInstAddressConfirmDialogListener(DialogEvent dialogEvent) {
        if (dialogEvent.getOutcome().equals(DialogEvent.Outcome.ok)) {

            disablePartyInfoFlds();
            enableBusBrowstInstLayoutFlds();
            getInstitutionOptionsRdBtn().setValue("browseInst");
            disableBusNewInstLayoutFlds();
            clearNewInstitutionInformation();
            floridaFlds();
        }
    }

    public void deleteNewInstAddrPopupCancelListener(PopupCanceledEvent popupCanceledEvent) {

        getInstitutionOptionsRdBtn().setValue("newInst");
    }

    public void deleteBrowseInstAddrPopupCancelListener(PopupCanceledEvent popupCanceledEvent) {

        getInstitutionOptionsRdBtn().setValue("browseInst");
    }

    public void businessAddressConfirmDialogListener(DialogEvent dialogEvent) {

        if (dialogEvent.getOutcome().equals(DialogEvent.Outcome.ok)) {
            getAddressOptionsRdBtn().setValue("business");
            enableBusinessLayoutFlds();
            if (getInstitutionOptionsRdBtn().getValue().equals("browseInst")) {
                if (getPartyNameIpLOV() != null && getPartyNameIpLOV().getValue() != null
                        && getPartyNameIpLOV().getValue().toString().trim().equals("")) {
                    disablePartyInfoFlds();
                }
                disableBusNewInstLayoutFlds();
            }
            if (getInstitutionOptionsRdBtn().getValue().equals("newInst")) {
                disablePartyInfoFlds();
                disableBusBrowstInstLayoutFlds();
            }
            disableHomeLayoutFlds();
            clearHomeInformation();
            floridaFlds();

        }
    }

    public void homeAddressConfirmDialogListener(DialogEvent dialogEvent) {

        if (dialogEvent.getOutcome().equals(DialogEvent.Outcome.ok)) {

            getAddressOptionsRdBtn().setValue("home");
            disableBusinessLayoutFlds();
            clearNewInstitutionInformation();
            enableHomeLayoutFlds();
            clearPartyInformation();

            floridaFlds();

        }
    }

    public void deleteBusinessAddrPopupCancelListener(PopupCanceledEvent popupCanceledEvent) {
        if (getBusinessAddressPnlGrp().isVisible() && getHomeAddressPnlGrp().isVisible()) {
            getAddressOptionsRdBtn().setValue("businesshome");
        } else if (getBusinessAddressPnlGrp().isVisible()) {
            getAddressOptionsRdBtn().setValue("business");
        }

    }

    public void deleteHomeAddrPopupCancelListener(PopupCanceledEvent popupCanceledEvent) {

        if (getHomeAddressPnlGrp().isVisible() && getBusinessAddressPnlGrp().isVisible()) {
            getAddressOptionsRdBtn().setValue("businesshome");
        } else if (getHomeAddressPnlGrp().isVisible()) {
            getAddressOptionsRdBtn().setValue("home");
        }
    }

    public String validateLoginAndPersonDetailsReqFlds() {
        String status = "sucess";
        JUCtrlAttrsBinding userId = (JUCtrlAttrsBinding) bindings.findNamedObject("UserID");
        JUCtrlAttrsBinding password = (JUCtrlAttrsBinding) bindings.findNamedObject("Password");
        JUCtrlAttrsBinding passwordHint = (JUCtrlAttrsBinding) bindings.findNamedObject("PasswordHint");
        JUCtrlAttrsBinding emailAddress = (JUCtrlAttrsBinding) bindings.findNamedObject("EmailAddress");
        JUCtrlAttrsBinding secQ1 = (JUCtrlAttrsBinding) bindings.findNamedObject("SecurityQuestion1");
        JUCtrlAttrsBinding secQ2 = (JUCtrlAttrsBinding) bindings.findNamedObject("SecurityQuestion2");
        JUCtrlAttrsBinding secQ3 = (JUCtrlAttrsBinding) bindings.findNamedObject("SecurityQuestion3");
        JUCtrlAttrsBinding secAns1 = (JUCtrlAttrsBinding) bindings.findNamedObject("Answer1");
        JUCtrlAttrsBinding secAns2 = (JUCtrlAttrsBinding) bindings.findNamedObject("Answer2");
        JUCtrlAttrsBinding secAns3 = (JUCtrlAttrsBinding) bindings.findNamedObject("Answer3");
        JUCtrlAttrsBinding title = (JUCtrlAttrsBinding) bindings.findNamedObject("PersonTitle");
        JUCtrlAttrsBinding firstName = (JUCtrlAttrsBinding) bindings.findNamedObject("FirstName");
        JUCtrlAttrsBinding lastName = (JUCtrlAttrsBinding) bindings.findNamedObject("LastName");
        String missingReqFlds = "";

        if (userId == null || (userId != null && userId.getAttribute("UserID") == null) || (userId != null
                && userId.getAttribute("UserID") != null && userId.getAttribute("UserID").toString().equals(""))) {
            status = "failure";
            missingReqFlds = missingReqFlds + "UserID is Required, ";
        }
        if (password == null || (password != null && password.getAttribute("Password") == null)
                || (password != null && password.getAttribute("Password") != null
                        && password.getAttribute("Password").toString().equals(""))) {
            status = "failure";
            missingReqFlds = missingReqFlds + "Password is Required, ";
        }
        if (passwordHint == null || (passwordHint != null && passwordHint.getAttribute("PasswordHint") == null)
                || (passwordHint != null && passwordHint.getAttribute("PasswordHint") != null
                        && passwordHint.getAttribute("PasswordHint").toString().equals(""))) {
            status = "failure";
            missingReqFlds = missingReqFlds + "PasswordHint is Required, ";
        }
        if (secQ1 == null || (secQ1 != null && secQ1.getAttribute("SecurityQuestion1") == null)
                || (secQ1 != null && secQ1.getAttribute("SecurityQuestion1") != null
                        && secQ1.getAttribute("SecurityQuestion1").toString().equals(""))) {
            status = "failure";
            missingReqFlds = missingReqFlds + "SecurityQuestion1 is Required, ";
        }
        if (secQ2 == null || (secQ2 != null && secQ2.getAttribute("SecurityQuestion2") == null)
                || (secQ2 != null && secQ2.getAttribute("SecurityQuestion2") != null
                        && secQ2.getAttribute("SecurityQuestion2").toString().equals(""))) {
            status = "failure";
            missingReqFlds = missingReqFlds + "SecurityQuestion2 is Required, ";
        }
        if (secQ3 == null || (secQ3 != null && secQ3.getAttribute("SecurityQuestion3") == null)
                || (secQ3 != null && secQ3.getAttribute("SecurityQuestion3") != null
                        && secQ3.getAttribute("SecurityQuestion3").toString().equals(""))) {
            status = "failure";
            missingReqFlds = missingReqFlds + "SecurityQuestion3 is Required, ";
        }
        if (secAns1 == null || (secAns1 != null && secAns1.getAttribute("Answer1") == null)
                || (secAns1 != null && secAns1.getAttribute("Answer1") != null
                        && secAns1.getAttribute("Answer1").toString().equals(""))) {
            status = "failure";
            missingReqFlds = missingReqFlds + "SecurityAnswer1 is Required, ";
        }
        if (secAns2 == null || (secAns2 != null && secAns2.getAttribute("Answer2") == null)
                || (secAns2 != null && secAns2.getAttribute("Answer2") != null
                        && secAns2.getAttribute("Answer2").toString().equals(""))) {
            status = "failure";
            missingReqFlds = missingReqFlds + "SecurityAnswer2 is Required, ";
        }
        if (secAns3 == null || (secAns3 != null && secAns3.getAttribute("Answer3") == null)
                || (secAns3 != null && secAns3.getAttribute("Answer2") != null
                        && secAns3.getAttribute("Answer3").toString().equals(""))) {
            status = "failure";
            missingReqFlds = missingReqFlds + "SecurityAnswer3 is Required, ";
        }
        if (emailAddress == null || (emailAddress != null && emailAddress.getAttribute("EmailAddress") == null)
                || (emailAddress != null && emailAddress.getAttribute("EmailAddress") != null
                        && emailAddress.getAttribute("EmailAddress").toString().equals(""))) {
            status = "failure";
            missingReqFlds = missingReqFlds + "EmailAddress is Required, ";
        }
        if (title == null || (title != null && title.getAttribute("PersonTitle") == null)
                || (title != null && title.getAttribute("PersonTitle") != null
                        && title.getAttribute("PersonTitle").toString().equals(""))) {
            status = "failure";
            missingReqFlds = missingReqFlds + "PersonTitle is Required, ";
        }
        if (firstName == null || (firstName != null && firstName.getAttribute("FirstName") == null)
                || (firstName != null && firstName.getAttribute("FirstName") != null
                        && firstName.getAttribute("FirstName").toString().equals(""))) {
            status = "failure";
            missingReqFlds = missingReqFlds + "FirstName is Required, ";
        }
        if (lastName == null || (lastName != null && lastName.getAttribute("LastName") == null)
                || (lastName != null && lastName.getAttribute("LastName") != null
                        && lastName.getAttribute("LastName").toString().equals(""))) {
            status = "failure";
            missingReqFlds = missingReqFlds + "LastName is Required, ";
        }
        StringBuffer errorMessages = new StringBuffer("");
        errorMessages.append(missingReqFlds);
        FacesContext facesContext = FacesContext.getCurrentInstance();
        facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Missing Required Fields ",
                "<html>" + errorMessages.toString() + "</html>"));

        return status;
    }

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

        String status = "sucess";
        try {
            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";
                        }
                    }
                }
            }
            //businesshome
            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("")) {
                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("Please enter the proper value");
                    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;
    }

    public String createAccount() {
        String nextPage = "next";
        try {
            String validateReqFlds = validateReqFlds();
            if (!validateReqFlds.equals("sucess")) {
                return null;
            }
            String validateLoginAndPersonDetailsReqFlds = validateLoginAndPersonDetailsReqFlds();
            if (!validateLoginAndPersonDetailsReqFlds.equals("sucess")) {
                return null;
            }

            JUCtrlAttrsBinding credentials = (JUCtrlAttrsBinding) bindings.findNamedObject("Credential");
            // System.out.println("Credential value "+credentials.getAttribute("Value")); 
            if (credentials != null && credentials.getAttribute("Value") != null) {
                String Credvalue = (String) credentials.getAttribute("Value");
                // List Credvalue = (List)credentials.getAttribute("Value");
                credentials.setAttribute("Value", "");
                setCredentials(Credvalue);
            }

            if (getAddressOptionsRdBtn().getValue().equals("home")
                    || (getAddressOptionsRdBtn().getValue().equals("businesshome"))) {
                loadAndSetHomeInfoBindings();
            }
            if (getAddressOptionsRdBtn().getValue().equals("business")
                    || (getAddressOptionsRdBtn().getValue().equals("businesshome"))) {
                loadAndSetBusinessInfoBindings();
            }

            if (getLicenseNumberIpTx() != null && getLicenseNumberIpTx().getValue() != null) {
                JUCtrlAttrsBinding flLicense = (JUCtrlAttrsBinding) bindings.findNamedObject("LicenseNumber");
                flLicense.setAttribute("LicenseNumber", getLicenseNumberIpTx().getValue());
            }

            /*
             * Following code has been added for the iStore-Self Service integration.
             * 
             * Code will retrieve the cookie set from iStore and set the Attribute1 to "Y", which will be retrieved in BPEL 
             * to send notifications to CDM team.
             * 
             * */

            // Start of iStore - Self Service Integration

            try {
                FacesContext facesContext = FacesContext.getCurrentInstance();
                ExternalContext etc = facesContext.getExternalContext();
                HttpServletRequest request = (HttpServletRequest) etc.getRequest();
                String cookieName = "iStoreSSCookie";
                Cookie[] cookies = request.getCookies();
                //  System.out.println("looking for cookie... "+cookies);
                if (cookies != null) {
                    for (int i = 0; i < cookies.length; i++) {
                        if (cookieName.equals(cookies[i].getName()) && cookies[i].getValue() != null) {
                            JUCtrlAttrsBinding attribute1 = (JUCtrlAttrsBinding) bindings
                                    .findNamedObject("Attribute1");
                            attribute1.setAttribute("Attribute1", "Y");
                            break;
                        }
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }

            // End of iStore - Self Service Integration  

            OperationBinding opBinding = bindings.getOperationBinding("process");
            opBinding.execute();
            return nextPage;
        } catch (Exception e) {
            //    System.out.println("Inside createAccount Exception");
            e.printStackTrace();
            sLog.debug(e.getMessage(), e);
            return nextPage;
        }
    }

    public void loadAndSetBusinessInfoBindings() {
        /* Business Address,Phone and Fax Bindings  */
        String foreignPartyNumber;
        String foreignAddr1 = "";
        String foreignAddr2 = "";
        String foreignAddr3 = "";
        String foreignAddr4 = "";
        String foreignCountry = "";
        String foreignState = "";
        String foreignCity = "";
        String foreignZipCode = "";
        String amDef = "org.cap.selfService.selfRegistration.selfRegModel.applicationModule.SelfRegistrationAM";
        String config = "SelfRegistrationAMLocal";
        ApplicationModule am = Configuration.createRootApplicationModule(amDef, config);
        try {
            JUCtrlAttrsBinding institutionNameBus = (JUCtrlAttrsBinding) bindings
                    .findNamedObject("InstitutionNameBus");
            JUCtrlAttrsBinding address1Bus = (JUCtrlAttrsBinding) bindings.findNamedObject("Address1Bus");
            JUCtrlAttrsBinding address2Bus = (JUCtrlAttrsBinding) bindings.findNamedObject("Address2Bus");
            JUCtrlAttrsBinding address3Bus = (JUCtrlAttrsBinding) bindings.findNamedObject("Address3Bus");
            JUCtrlAttrsBinding address4Bus = (JUCtrlAttrsBinding) bindings.findNamedObject("Address4Bus");
            JUCtrlAttrsBinding countryBus = (JUCtrlAttrsBinding) bindings.findNamedObject("CountryBus");
            JUCtrlAttrsBinding stateBus = (JUCtrlAttrsBinding) bindings.findNamedObject("StateBus");
            JUCtrlAttrsBinding cityBus = (JUCtrlAttrsBinding) bindings.findNamedObject("CityBus");
            JUCtrlAttrsBinding postalCodeBus = (JUCtrlAttrsBinding) bindings.findNamedObject("PostalCodeBus");
            JUCtrlAttrsBinding countyBus = (JUCtrlAttrsBinding) bindings.findNamedObject("CountyBus");
            JUCtrlAttrsBinding validateAddressFlagBus = (JUCtrlAttrsBinding) bindings
                    .findNamedObject("IsBusAddressValidated");
            JUCtrlAttrsBinding preferredFlagBus = (JUCtrlAttrsBinding) bindings.findNamedObject("PreferredFlagBus");

            JUCtrlAttrsBinding phoneCountryCodeBus = (JUCtrlAttrsBinding) bindings
                    .findNamedObject("PhoneCountryCodeBus");
            JUCtrlAttrsBinding phoneAreaCodeBus = (JUCtrlAttrsBinding) bindings.findNamedObject("PhoneAreaCodeBus");
            JUCtrlAttrsBinding phoneNumBus = (JUCtrlAttrsBinding) bindings.findNamedObject("PhoneNumberBus");
            JUCtrlAttrsBinding phoneRawNumBus = (JUCtrlAttrsBinding) bindings.findNamedObject("PhoneRawNumberBus");
            JUCtrlAttrsBinding phoneExtBus = (JUCtrlAttrsBinding) bindings.findNamedObject("PhoneExtensionBus");

            JUCtrlAttrsBinding faxCountryCodeBus = (JUCtrlAttrsBinding) bindings
                    .findNamedObject("FaxCountryCodeBus");
            JUCtrlAttrsBinding faxAreaCodeBus = (JUCtrlAttrsBinding) bindings.findNamedObject("FaxAreaCodeBus");
            JUCtrlAttrsBinding faxNumBus = (JUCtrlAttrsBinding) bindings.findNamedObject("FaxNumberBus");
            JUCtrlAttrsBinding faxRawNumBus = (JUCtrlAttrsBinding) bindings.findNamedObject("FaxRawNumberBus");
            JUCtrlAttrsBinding faxExtBus = (JUCtrlAttrsBinding) bindings.findNamedObject("FaxExtensionBus");

            if (getInstitutionOptionsRdBtn().getValue().equals("browseInst")) {
                String inputPartyData = getAddress1PartyIpTx().getValue() + "|" + getAddress2PartyIpTx().getValue()
                        + "|" + getAddress3PartyIpTx().getValue() + "|" + getAddress4PartyIpTx().getValue() + "|"
                        + getCityPartyIpTx().getValue() + "|" + getStatesUSPartySelOneCho().getValue() + "|"
                        + getPostalCodePartyIpTx().getValue();

                if (getCountryPartySelOneCho().getValue().equals("US")) {
                    String busAddrValid = validateAndStandardiseBusinessAddress();
                    if (busAddrValid != null && busAddrValid.equals("sucess"))
                        validateAddressFlagBus.setAttribute("IsAddressValidated", "Y");
                    else
                        validateAddressFlagBus.setAttribute("IsAddressValidated", "N");
                }
                String state = "";
                JUCtrlAttrsBinding InstitutionIDBus = (JUCtrlAttrsBinding) bindings
                        .findNamedObject("InstitutionIDBus");
                InstitutionIDBus.setAttribute("InstitutionID", getPartyIdIpTx().getValue());
                institutionNameBus.setAttribute("InstitutionName", getPartyNameIpLOV().getValue());
                address1Bus.setAttribute("Address1", getAddress1PartyIpTx().getValue());
                address2Bus.setAttribute("Address2", getAddress2PartyIpTx().getValue());
                address3Bus.setAttribute("Address3", getAddress3PartyIpTx().getValue());
                address4Bus.setAttribute("Address4", getAddress4PartyIpTx().getValue());
                countryBus.setAttribute("Country", getCountryPartySelOneCho().getValue());
                if (getCountryPartySelOneCho().getValue().equals("US")) {
                    stateBus.setAttribute("State", getStatesUSPartySelOneCho().getValue());

                }
                if (getCountryPartySelOneCho().getValue().equals("AU")) {
                    stateBus.setAttribute("State", getStatesAUPartySelOneCho().getValue());
                    state = (String) getStatesAUPartySelOneCho().getValue();
                }
                if (getCountryPartySelOneCho().getValue().equals("CA")) {
                    stateBus.setAttribute("State", getStatesCAPartySelOneCho().getValue());
                    state = (String) getStatesCAPartySelOneCho().getValue();
                }
                if (!getCountryPartySelOneCho().getValue().equals("US")
                        && !getCountryPartySelOneCho().getValue().equals("AU")
                        && !getCountryPartySelOneCho().getValue().equals("CA")) {
                    stateBus.setAttribute("State", getStatesOthersPartyIpTx().getValue());
                    state = (String) getStatesOthersPartyIpTx().getValue();
                }
                cityBus.setAttribute("City", getCityPartyIpTx().getValue());
                postalCodeBus.setAttribute("PostalCode", getPostalCodePartyIpTx().getValue());
                countyBus.setAttribute("County", getCountyPartyIpTx().getValue());

                // write code for to check browse inst foreign address change

                if (!getCountryPartySelOneCho().getValue().equals("US")) {
                    ViewObject vo = am.findViewObject("InstitutionLovVO1");
                    ViewCriteria vc = vo.createViewCriteria();
                    ViewCriteriaRow vcr1 = vc.createViewCriteriaRow();
                    vcr1.setAttribute("PartyNumber", getPartyNumberIpTx().getValue());

                    vc.add(vcr1);
                    vo.applyViewCriteria(vc);
                    vo.executeQuery();
                    int size = vo.getRowCount();
                    while (vo.hasNext()) {
                        Row inst = vo.next();
                        foreignAddr1 = (String) inst.getAttribute("Address1");
                        foreignAddr2 = (String) inst.getAttribute("Address2");
                        foreignAddr3 = (String) inst.getAttribute("Address3");
                        foreignAddr4 = (String) inst.getAttribute("Address4");
                        foreignCity = (String) inst.getAttribute("City");
                        foreignState = (String) inst.getAttribute("State");
                        foreignZipCode = (String) inst.getAttribute("PostalCode");
                    }
                    if (foreignAddr1 == null) {
                        foreignAddr1 = "";
                    }
                    if (foreignZipCode == null) {
                        foreignZipCode = "";
                    }
                    if (foreignCity == null) {
                        foreignCity = "";
                    }
                    if (foreignAddr2 == null) {
                        foreignAddr2 = "";
                    }
                    if (foreignAddr3 == null) {
                        foreignAddr3 = "";
                    }
                    if (foreignAddr4 == null) {
                        foreignAddr4 = "";
                    }
                    if (foreignState == null) {
                        foreignState = "";
                    }
                    if (getAddress2PartyIpTx().getValue() == null) {
                        getAddress2PartyIpTx().setValue("");
                    }
                    if (getAddress3PartyIpTx().getValue() == null) {
                        getAddress3PartyIpTx().setValue("");
                    }
                    if (getAddress4PartyIpTx().getValue() == null) {
                        getAddress4PartyIpTx().setValue("");
                    }
                    if (getPostalCodePartyIpTx().getValue() == null) {
                        getPostalCodePartyIpTx().setValue("");
                    }
                    if (state == null) {
                        state = "";
                    }

                    if (foreignAddr1.equals(getAddress1PartyIpTx().getValue())
                            && foreignCity.equals(getCityPartyIpTx().getValue()) && foreignState.equals(state)
                            && foreignZipCode.equals(getPostalCodePartyIpTx().getValue())
                            && foreignAddr2.equals(getAddress2PartyIpTx().getValue())
                            && foreignAddr3.equals(getAddress3PartyIpTx().getValue())
                            && foreignAddr4.equals(getAddress4PartyIpTx().getValue())) {
                        validateAddressFlagBus.setAttribute("IsAddressValidated", "Y");

                    } else {
                        validateAddressFlagBus.setAttribute("IsAddressValidated", "N");

                    }
                }

                //call Phone fax API                

                if (getPhonePartyIpTx().getValue() != null) {

                    PhoneValues phValues = phoneDetails(getCountryPartySelOneCho().getValue().toString(),
                            getPhonePartyIpTx().getValue().toString());
                    if (phValues != null) {
                        String phRawNumber = phValues.getFormattedPhoneNumber();
                        phoneRawNumBus.setAttribute("RawNumber", phRawNumber);
                        phoneExtBus.setAttribute("Extension", getPhoneExtPartyIpTx().getValue());
                    } else {
                        phoneRawNumBus.setAttribute("RawNumber", " " + getPhonePartyIpTx().getValue());
                        phoneExtBus.setAttribute("Extension", getPhoneExtPartyIpTx().getValue());
                    }

                }

                if (getFaxPartyIpTx().getValue() != null) {
                    PhoneValues phValues = phoneDetails(getCountryPartySelOneCho().getValue().toString(),
                            getFaxPartyIpTx().getValue().toString());
                    if (phValues != null) {
                        String faxRawNumber = phValues.getFormattedPhoneNumber();
                        faxRawNumBus.setAttribute("RawNumber", faxRawNumber);
                        faxExtBus.setAttribute("Extension", getFaxExtPartyIpTx().getValue());
                    } else {
                        faxRawNumBus.setAttribute("RawNumber", " " + getFaxPartyIpTx().getValue());
                        faxExtBus.setAttribute("Extension", getFaxExtPartyIpTx().getValue());
                    }
                }

            }

            if (getInstitutionOptionsRdBtn().getValue().equals("newInst")) {
                if (getCountryBusNewInstSelOneCho().getValue().equals("US")) {
                    String busnewInstAddrValid = validateAndStandardiseBusinessAddress();
                    if (busnewInstAddrValid != null && busnewInstAddrValid.equals("sucess")) {
                        validateAddressFlagBus.setAttribute("IsAddressValidated", "Y");
                    } else {
                        validateAddressFlagBus.setAttribute("IsAddressValidated", "N");
                    }
                } else {
                    validateAddressFlagBus.setAttribute("IsAddressValidated", "N");
                }

                institutionNameBus.setAttribute("InstitutionName", getInstitutionNameBusNewInstIpTx().getValue());
                address1Bus.setAttribute("Address1", getAddress1BusNewInstIpTx().getValue());
                address2Bus.setAttribute("Address2", getAddress2BusNewInstIpTx().getValue());
                address3Bus.setAttribute("Address3", getAddress3BusNewInstIpTx().getValue());
                address4Bus.setAttribute("Address4", getAddress4BusNewInstIpTx().getValue());
                countryBus.setAttribute("Country", getCountryBusNewInstSelOneCho().getValue());
                if (getCountryBusNewInstSelOneCho().getValue().equals("US")) {
                    stateBus.setAttribute("State", getStatesUSNewInstSelOneCho().getValue());
                }
                if (getCountryBusNewInstSelOneCho().getValue().equals("AU")) {
                    stateBus.setAttribute("State", getStatesAUNewInstSelOneCho().getValue());
                }
                if (getCountryBusNewInstSelOneCho().getValue().equals("CA")) {
                    stateBus.setAttribute("State", getStatesCANewInstSelOneCho().getValue());
                }
                if (!getCountryBusNewInstSelOneCho().getValue().equals("US")
                        && !getCountryBusNewInstSelOneCho().getValue().equals("AU")
                        && !getCountryBusNewInstSelOneCho().getValue().equals("CA")) {
                    stateBus.setAttribute("State", getStatesOtherNewInstIpTx().getValue());
                }
                cityBus.setAttribute("City", getCityBusNewInstIpTx().getValue());
                postalCodeBus.setAttribute("PostalCode", getPostalCodeBusNewInstIpTx().getValue());
                countyBus.setAttribute("County", getCountyBusNewInstIpTx().getValue());

                if (getPhoneBusNewInstIpTx().getValue() != null) {

                    PhoneValues phValues = phoneDetails(getCountryBusNewInstSelOneCho().getValue().toString(),
                            getPhoneBusNewInstIpTx().getValue().toString());
                    if (phValues != null) {
                        String phRawNumber = phValues.getFormattedPhoneNumber();
                        phoneRawNumBus.setAttribute("RawNumber", phRawNumber);
                        phoneExtBus.setAttribute("Extension", getPhoneExtBusNewInstIpTx().getValue());
                    } else {
                        phoneRawNumBus.setAttribute("RawNumber", " " + getPhoneBusNewInstIpTx().getValue());
                        phoneExtBus.setAttribute("Extension", getPhoneExtBusNewInstIpTx().getValue());
                    }
                }

                if (getFaxBusNewInstIpTx().getValue() != null) {
                    PhoneValues phValues = phoneDetails(getCountryBusNewInstSelOneCho().getValue().toString(),
                            getFaxBusNewInstIpTx().getValue().toString());
                    if (phValues != null) {
                        String phRawNumber = phValues.getFormattedPhoneNumber();
                        faxRawNumBus.setAttribute("RawNumber", phRawNumber);
                        faxExtBus.setAttribute("Extension", getFaxExtBusNewInstIpTx().getValue());
                    } else {
                        faxRawNumBus.setAttribute("RawNumber", " " + getFaxBusNewInstIpTx().getValue());
                        faxExtBus.setAttribute("Extension", getFaxExtBusNewInstIpTx().getValue());
                    }
                }

            }
            if (getAddressOptionsRdBtn().getValue().equals("businesshome")) {
                if (getAddressPreferenceRdBtn().getValue().equals("business"))
                    preferredFlagBus.setAttribute("PreferredFlag", "Y");
                if (getAddressPreferenceRdBtn().getValue().equals("home"))
                    preferredFlagBus.setAttribute("PreferredFlag", "N");
            }
            if (getAddressOptionsRdBtn().getValue().equals("business")) {
                preferredFlagBus.setAttribute("PreferredFlag", "Y");
            }
            if (getAddressOptionsRdBtn().getValue().equals("home")) {
                preferredFlagBus.setAttribute("PreferredFlag", "N");
            }
        } catch (Exception e) {
            sLog.debug(e.getMessage(), e);
            e.printStackTrace();
        } finally {
            Configuration.releaseRootApplicationModule(am, true);
        }
    }

    public void loadAndSetHomeInfoBindings() {
        /* Home Address,Phone and Fax Bindings  */
        JUCtrlAttrsBinding address1Home = (JUCtrlAttrsBinding) bindings.findNamedObject("Address1Home");
        JUCtrlAttrsBinding address2Home = (JUCtrlAttrsBinding) bindings.findNamedObject("Address2Home");
        JUCtrlAttrsBinding address3Home = (JUCtrlAttrsBinding) bindings.findNamedObject("Address3Home");
        JUCtrlAttrsBinding address4Home = (JUCtrlAttrsBinding) bindings.findNamedObject("Address4Home");
        JUCtrlAttrsBinding countryHome = (JUCtrlAttrsBinding) bindings.findNamedObject("CountryHome");
        JUCtrlAttrsBinding stateHome = (JUCtrlAttrsBinding) bindings.findNamedObject("StateHome");
        JUCtrlAttrsBinding cityHome = (JUCtrlAttrsBinding) bindings.findNamedObject("CityHome");
        JUCtrlAttrsBinding postalCodeHome = (JUCtrlAttrsBinding) bindings.findNamedObject("PostalCodeHome");
        JUCtrlAttrsBinding countyHome = (JUCtrlAttrsBinding) bindings.findNamedObject("CountyHome");
        JUCtrlAttrsBinding preferredFlagHome = (JUCtrlAttrsBinding) bindings.findNamedObject("PreferredFlagHome");

        JUCtrlAttrsBinding phoneCountryCodeHome = (JUCtrlAttrsBinding) bindings
                .findNamedObject("PhoneCountryCodeHome");
        JUCtrlAttrsBinding phoneAreaCodeHome = (JUCtrlAttrsBinding) bindings.findNamedObject("PhoneAreaCodeHome");
        JUCtrlAttrsBinding phoneNumberHome = (JUCtrlAttrsBinding) bindings.findNamedObject("PhoneNumberHome");
        JUCtrlAttrsBinding phoneRawNumberHome = (JUCtrlAttrsBinding) bindings.findNamedObject("PhoneRawNumberHome");

        JUCtrlAttrsBinding faxCountryCodeHome = (JUCtrlAttrsBinding) bindings.findNamedObject("FaxCountryCodeHome");
        JUCtrlAttrsBinding faxAreaCodeHome = (JUCtrlAttrsBinding) bindings.findNamedObject("FaxAreaCodeHome");
        JUCtrlAttrsBinding faxNumberHome = (JUCtrlAttrsBinding) bindings.findNamedObject("FaxNumberHome");
        JUCtrlAttrsBinding faxRawNumberHome = (JUCtrlAttrsBinding) bindings.findNamedObject("FaxRawNumberHome");

        JUCtrlAttrsBinding validateAddressFlagHome = (JUCtrlAttrsBinding) bindings
                .findNamedObject("IsHomeAddressValidated");
        if (getCountryHomeSelOneCho().getValue().equals("US")) {
            String homeAddrValid = validateAndStandardiseHomeAddress();
            if (homeAddrValid != null && homeAddrValid.equals("sucess")) {
                validateAddressFlagHome.setAttribute("IsAddressValidated", "Y");
            } else {
                validateAddressFlagHome.setAttribute("IsAddressValidated", " N");
            }
        } else {
            validateAddressFlagHome.setAttribute("IsAddressValidated", " N");
        }
        address1Home.setAttribute("Address1", getAddress1HomeIpTx().getValue());
        address2Home.setAttribute("Address2", getAddress2HomeIpTx().getValue());
        address3Home.setAttribute("Address3", getAddress3HomeIpTx().getValue());
        address4Home.setAttribute("Address4", getAddress4HomeIpTx().getValue());
        countryHome.setAttribute("Country", getCountryHomeSelOneCho().getValue());
        if (getCountryHomeSelOneCho().getValue().equals("US")) {
            stateHome.setAttribute("State", getStatesUSHomeSelOneCho().getValue());
        }
        if (getCountryHomeSelOneCho().getValue().equals("AU")) {
            stateHome.setAttribute("State", getStatesAUHomeSelOneCho().getValue());
        }
        if (getCountryHomeSelOneCho().getValue().equals("CA")) {
            stateHome.setAttribute("State", getStatesCAHomeSelOneCho().getValue());
        }
        if (!getCountryHomeSelOneCho().getValue().equals("US") && !getCountryHomeSelOneCho().getValue().equals("AU")
                && !getCountryHomeSelOneCho().getValue().equals("CA")) {
            stateHome.setAttribute("State", getStatesOtherHomeIpTx().getValue());
        }
        cityHome.setAttribute("City", getCityHomeIpTx().getValue());
        postalCodeHome.setAttribute("PostalCode", getPostalCodeHomeIpTx().getValue());
        countyHome.setAttribute("County", getCountyHomeIpTx().getValue());

        if (getPhoneHomeIpTx().getValue() != null) {
            PhoneValues phValues = phoneDetails(getCountryHomeSelOneCho().getValue().toString(),
                    getPhoneHomeIpTx().getValue().toString());
            if (phValues != null) {
                String phRawNumber = phValues.getFormattedPhoneNumber();
                phoneRawNumberHome.setAttribute("RawNumber", phRawNumber);
            } else {
                phoneRawNumberHome.setAttribute("RawNumber", " " + getPhoneHomeIpTx().getValue());
            }
        }

        if (getFaxHomeIpTx().getValue() != null) {
            PhoneValues phValues = phoneDetails(getCountryHomeSelOneCho().getValue().toString(),
                    getFaxHomeIpTx().getValue().toString());
            if (phValues != null) {
                String faxRawNumber = phValues.getFormattedPhoneNumber();
                faxRawNumberHome.setAttribute("RawNumber", faxRawNumber);
            } else {
                faxRawNumberHome.setAttribute("RawNumber", " " + getFaxHomeIpTx().getValue());
            }
        }

        if (getAddressOptionsRdBtn().getValue().equals("businesshome")) {
            if (getAddressPreferenceRdBtn().getValue().equals("home"))
                preferredFlagHome.setAttribute("PreferredFlag", "Y");
            if (getAddressPreferenceRdBtn().getValue().equals("business"))
                preferredFlagHome.setAttribute("PreferredFlag", "N");
        }
        if (getAddressOptionsRdBtn().getValue().equals("home")) {
            preferredFlagHome.setAttribute("PreferredFlag", "Y");
        }
        if (getAddressOptionsRdBtn().getValue().equals("business")) {
            preferredFlagHome.setAttribute("PreferredFlag", "N");
        }
    }

    public String validateAndStandardiseHomeAddress() {
        String validateHomeAddressStatus = null;

        /*   String inputData= "|"+getAddress1HomeIpTx().getValue()+"|"+getAddress2HomeIpTx().getValue()+"|"+getAddress3HomeIpTx().getValue()+"|"+getAddress4HomeIpTx().getValue()+
               "|"+ getCityHomeIpTx().getValue()+"|"+getStatesUSHomeSelOneCho().getValue() +"|"+ getPostalCodeHomeIpTx().getValue()+"|"+ "";*/
        String[] inputData = new String[8];
        inputData[0] = (String) getAddress1HomeIpTx().getValue();
        inputData[1] = (String) getAddress2HomeIpTx().getValue();
        inputData[2] = (String) getAddress3HomeIpTx().getValue();
        inputData[3] = (String) getAddress4HomeIpTx().getValue();
        inputData[4] = (String) getCityHomeIpTx().getValue();
        inputData[5] = (String) getStatesUSHomeSelOneCho().getValue();
        inputData[6] = (String) getPostalCodeHomeIpTx().getValue();
        inputData[7] = "";
        String[] outPut = tv.cleanseData(inputData);

        String failOutLevel = outPut[8];

        if (failOutLevel != null && failOutLevel.equals("0")) {
            validateHomeAddressStatus = "sucess";
            getAddress1HomeIpTx().setValue(outPut[0]);
            getAddress2HomeIpTx().setValue(outPut[1]);
            getAddress3HomeIpTx().setValue(outPut[2]);
            getAddress4HomeIpTx().setValue(outPut[3]);
            getCityHomeIpTx().setValue(outPut[4]);
            getStatesUSHomeSelOneCho().setValue(outPut[5]);
            getPostalCodeHomeIpTx().setValue(outPut[6]);
            getCountryHomeSelOneCho().setValue("US");
            getCountyHomeIpTx().setValue(outPut[7]);
        }
        return validateHomeAddressStatus;
    }

    public String validateAndStandardiseBusinessAddress() {
        String validateBusinessAddressStatus = "failure";

        if (getInstitutionOptionsRdBtn().getValue().equals("browseInst")) {
            /*  String inputData =getAddress1PartyIpTx().getValue()+"|"+getAddress2PartyIpTx().getValue()+"|"+getAddress3PartyIpTx().getValue()+"|"+getAddress4PartyIpTx().getValue()+
               "|"+ getCityPartyIpTx().getValue()+"|"+getStatesUSPartySelOneCho().getValue() +"|"+ getPostalCodePartyIpTx().getValue();*/
            //  String[] inputData1 = {"2400 Pratt St Ste 1300","","","","Durham","NC", "27705-3976"};
            String[] inputData = new String[8];
            inputData[0] = (String) getAddress1PartyIpTx().getValue();
            inputData[1] = (String) getAddress2PartyIpTx().getValue();
            inputData[2] = (String) getAddress3PartyIpTx().getValue();
            inputData[3] = (String) getAddress4PartyIpTx().getValue();
            inputData[4] = (String) getCityPartyIpTx().getValue();
            inputData[5] = (String) getStatesUSPartySelOneCho().getValue();
            inputData[6] = (String) getPostalCodePartyIpTx().getValue();
            inputData[7] = "";
            String[] outPut = tv.cleanseData(inputData);

            String failOutLevel = outPut[8];

            if (failOutLevel != null && failOutLevel.equals("0")) {

                validateBusinessAddressStatus = "sucess";
                getAddress1PartyIpTx().setValue(outPut[0]);
                getAddress2PartyIpTx().setValue(outPut[1]);
                getAddress3PartyIpTx().setValue(outPut[2]);
                getAddress4PartyIpTx().setValue(outPut[3]);
                getCityPartyIpTx().setValue(outPut[4]);
                getStatesUSPartySelOneCho().setValue(outPut[5]);
                getPostalCodePartyIpTx().setValue(outPut[6]);
                getCountryPartySelOneCho().setValue("US");
                getCountyPartyIpTx().setValue(outPut[7]);

            }
        }
        if (getInstitutionOptionsRdBtn().getValue().equals("newInst")) {
            /*  String inputData = "|"+getAddress1BusNewInstIpTx().getValue()+"|"+getAddress2BusNewInstIpTx().getValue()+"|"+getAddress3BusNewInstIpTx().getValue()+","+getAddress4BusNewInstIpTx().getValue()+
                  "|"+ getCityBusNewInstIpTx().getValue()+"|"+getStatesUSNewInstSelOneCho().getValue() +"|"+ getPostalCodeBusNewInstIpTx().getValue()+"|"+ "";*/

            String[] inputData = new String[8];
            inputData[0] = (String) getAddress1BusNewInstIpTx().getValue();
            inputData[1] = (String) getAddress2BusNewInstIpTx().getValue();
            inputData[2] = (String) getAddress3BusNewInstIpTx().getValue();
            inputData[3] = (String) getAddress4BusNewInstIpTx().getValue();
            inputData[4] = (String) getCityBusNewInstIpTx().getValue();
            inputData[5] = (String) getStatesUSNewInstSelOneCho().getValue();
            inputData[6] = (String) getPostalCodeBusNewInstIpTx().getValue();
            inputData[7] = "";
            String[] outPut = tv.cleanseData(inputData);
            String failOutLevel = outPut[8];
            if (failOutLevel != null && failOutLevel.equals("0")) {
                validateBusinessAddressStatus = "sucess";
                getAddress1BusNewInstIpTx().setValue(outPut[0]);
                getAddress2BusNewInstIpTx().setValue(outPut[1]);
                getAddress3BusNewInstIpTx().setValue(outPut[2]);
                getAddress3BusNewInstIpTx().setValue(outPut[3]);
                getCityBusNewInstIpTx().setValue(outPut[4]);
                getStatesUSNewInstSelOneCho().setValue(outPut[5]);
                getPostalCodeBusNewInstIpTx().setValue(outPut[6]);
                getCountryBusNewInstSelOneCho().setValue("US");
                getCountyBusNewInstIpTx().setValue(outPut[7]);
            }
        }

        return validateBusinessAddressStatus;
    }

    public void clearPartyInformation() {

        getPartyIdIpTx().setValue("");
        getPartyNumberIpTx().setValue("");
        getPartyNameIpLOV().setValue(" ");
        getAddress1PartyIpTx().setValue("");
        getAddress2PartyIpTx().setValue("");
        getAddress3PartyIpTx().setValue("");
        getAddress4PartyIpTx().setValue("");
        getCountryPartySelOneCho().setValue("");
        getStatesUSPartySelOneCho().setValue("");
        getStatesAUPartySelOneCho().setValue("");
        getStatesCAPartySelOneCho().setValue("");
        getStatesOthersPartyIpTx().setValue("");
        getCityPartyIpTx().setValue("");
        getPostalCodePartyIpTx().setValue("");
        getCountyPartyIpTx().setValue("");
        getPhonePartyIpTx().setValue("");
        getPhoneExtPartyIpTx().setValue("");
        getFaxExtPartyIpTx().setValue("");
        getFaxPartyIpTx().setValue("");

    }

    public void clearNewInstitutionInformation() {
        getInstitutionNameBusNewInstIpTx().setValue("");
        getAddress1BusNewInstIpTx().setValue("");
        getAddress2BusNewInstIpTx().setValue("");
        getAddress3BusNewInstIpTx().setValue("");
        getAddress4BusNewInstIpTx().setValue("");
        getCountryBusNewInstSelOneCho().setValue("US");
        getStatesUSNewInstSelOneCho().setValue("");
        getStatesAUNewInstSelOneCho().setValue("");
        getStatesCANewInstSelOneCho().setValue("");
        getStatesOtherNewInstIpTx().setValue("");
        getCityBusNewInstIpTx().setValue("");
        getPostalCodeBusNewInstIpTx().setValue("");
        getCountyBusNewInstIpTx().setValue("");
        getPhoneBusNewInstIpTx().setValue("");
        getPhoneExtBusNewInstIpTx().setValue("");
        getFaxBusNewInstIpTx().setValue("");
        getFaxExtBusNewInstIpTx().setValue("");

    }

    public void clearHomeInformation() {

        getAddress1HomeIpTx().setValue("");
        getAddress2HomeIpTx().setValue("");
        getAddress3HomeIpTx().setValue("");
        getAddress4HomeIpTx().setValue("");
        getCountryHomeSelOneCho().setValue("US");
        getStatesUSHomeSelOneCho().setValue("");
        getStatesAUHomeSelOneCho().setValue("");
        getStatesCAHomeSelOneCho().setValue("");
        getStatesOtherHomeIpTx().setValue("");
        getCityHomeIpTx().setValue("");
        getPostalCodeHomeIpTx().setValue("");
        getCountyHomeIpTx().setValue("");
        getPhoneHomeIpTx().setValue("");
        getFaxHomeIpTx().setValue("");
    }

    public void disablePartyInfoFlds() {

        getAddress1PartyIpTx().setDisabled(true);
        getAddress2PartyIpTx().setDisabled(true);
        getAddress3PartyIpTx().setDisabled(true);
        getAddress4PartyIpTx().setDisabled(true);
        getCountryPartySelOneCho().setDisabled(true);
        getCityPartyIpTx().setDisabled(true);
        getPostalCodePartyIpTx().setDisabled(true);
        getStatesAUPartySelOneCho().setDisabled(true);
        getStatesCAPartySelOneCho().setDisabled(true);
        getStatesUSPartySelOneCho().setDisabled(true);
        getStatesOthersPartyIpTx().setDisabled(true);
        getPhonePartyIpTx().setDisabled(true);
        getPhoneExtPartyIpTx().setDisabled(true);
        getFaxPartyIpTx().setDisabled(true);
        getFaxExtPartyIpTx().setDisabled(true);

    }

    public void enablePartyInfoFlds() {

        getAddress1PartyIpTx().setDisabled(false);
        getAddress2PartyIpTx().setDisabled(false);
        getAddress3PartyIpTx().setDisabled(false);
        getAddress4PartyIpTx().setDisabled(false);
        getCountryPartySelOneCho().setDisabled(false);
        getCityPartyIpTx().setDisabled(false);
        getPostalCodePartyIpTx().setDisabled(false);
        getStatesAUPartySelOneCho().setDisabled(false);
        getStatesCAPartySelOneCho().setDisabled(false);
        getStatesUSPartySelOneCho().setDisabled(false);
        getStatesOthersPartyIpTx().setDisabled(false);
        getPhonePartyIpTx().setDisabled(false);
        getPhoneExtPartyIpTx().setDisabled(false);
        getFaxPartyIpTx().setDisabled(false);
        getFaxExtPartyIpTx().setDisabled(false);

    }

    private void showPopup(RichPopup popUp, UIComponent source) {

        FacesContext context = FacesContext.getCurrentInstance();
        String popupId = popUp.getClientId(context);
        //String alignId = source.getClientId(context);
        String alignId = "Spacer6";
        StringBuilder script = new StringBuilder();
        script.append("var popup = AdfPage.PAGE.findComponent('").append(popupId).append("'); ")
                .append("if (!popup.isPopupVisible()) { ").append("var hints = {}; ")
                .append("hints    [AdfRichPopup.HINT_ALIGN_ID] = '").append(alignId).append("'; ")
                .append("hints[AdfRichPopup.HINT_ALIGN] = AdfRichPopup.ALIGN_START_AFTER; ")
                .append("popup.show(hints);}");
        ExtendedRenderKitService erks = Service.getService(context.getRenderKit(), ExtendedRenderKitService.class);
        erks.addScript(context, script.toString());
    }

    public void floridaFlds() {

        try {
            if (getAddressOptionsRdBtn().getValue().equals("business")) {

                if (getInstitutionOptionsRdBtn().getValue().equals("browseInst")) {

                    if (getCountryPartySelOneCho() != null && getCountryPartySelOneCho().getValue() != null
                            && getCountryPartySelOneCho().getValue().equals("US")
                            && getStatesUSPartySelOneCho() != null && getStatesUSPartySelOneCho().getValue() != null
                            && !getStatesUSPartySelOneCho().getValue().equals("FL")
                            && !getStatesUSPartySelOneCho().getValue().equals("")
                            && !getLicensePnlGrp().isVisible()) {

                        getFloridaLicensePnlGrp().setVisible(true);
                        getFloridaLicenseCmdImgLnk().setVisible(true);
                        getFloridaLicenseImgLbl().setVisible(false);
                        getLicensePnlGrp().setVisible(false);
                    } else if (getCountryPartySelOneCho() != null && getCountryPartySelOneCho().getValue() != null
                            && getCountryPartySelOneCho().getValue().equals("US")
                            && getStatesUSPartySelOneCho().getValue() != null
                            && getStatesUSPartySelOneCho().getValue().equals("FL")) {

                        getFloridaLicensePnlGrp().setVisible(true);
                        getFloridaLicenseCmdImgLnk().setVisible(false);
                        getFloridaLicenseImgLbl().setVisible(true);
                        getLicensePnlGrp().setVisible(true);
                    } else if (getCountryPartySelOneCho().getValue() == null
                            || !getCountryPartySelOneCho().getValue().equals("US")
                            || (getCountryPartySelOneCho().getValue().equals("US")
                                    && getStatesUSPartySelOneCho().getValue() == null)
                            || (getCountryPartySelOneCho().getValue().equals("US")
                                    && getStatesUSPartySelOneCho().getValue() != null
                                    && getStatesUSPartySelOneCho().getValue().equals("")
                                    && getStatesUSPartySelOneCho().getValue().equals(""))) {

                        getFloridaLicensePnlGrp().setVisible(false);
                        getFloridaLicenseCmdImgLnk().setVisible(false);
                        getFloridaLicenseImgLbl().setVisible(false);
                        getLicensePnlGrp().setVisible(false);
                        getLicenseNumberIpTx().setValue("");
                    }
                } else {

                    if (getCountryBusNewInstSelOneCho() != null
                            && getCountryBusNewInstSelOneCho().getValue() != null
                            && getCountryBusNewInstSelOneCho().getValue().equals("US")
                            && getStatesUSNewInstSelOneCho().getValue() != null
                            && !getStatesUSNewInstSelOneCho().getValue().equals("FL")
                            && !getStatesUSNewInstSelOneCho().getValue().equals("")
                            && !getLicensePnlGrp().isVisible()) {

                        getFloridaLicensePnlGrp().setVisible(true);
                        getFloridaLicenseCmdImgLnk().setVisible(true);
                        getFloridaLicenseImgLbl().setVisible(false);
                        getLicensePnlGrp().setVisible(false);
                    } else if (getCountryBusNewInstSelOneCho() != null
                            && getCountryBusNewInstSelOneCho().getValue() != null
                            && getCountryBusNewInstSelOneCho().getValue().equals("US")
                            && getStatesUSNewInstSelOneCho().getValue() != null
                            && getStatesUSNewInstSelOneCho().getValue().equals("FL")) {

                        getFloridaLicensePnlGrp().setVisible(true);
                        getFloridaLicenseCmdImgLnk().setVisible(false);
                        getFloridaLicenseImgLbl().setVisible(true);
                        getLicensePnlGrp().setVisible(true);
                    } else if (getCountryBusNewInstSelOneCho() != null
                            && getCountryBusNewInstSelOneCho().getValue() != null
                            && !getCountryBusNewInstSelOneCho().getValue().equals("US")
                            || (getCountryBusNewInstSelOneCho() != null
                                    && getCountryBusNewInstSelOneCho().getValue() != null
                                    && getCountryBusNewInstSelOneCho().getValue().equals("US")
                                    && getStatesUSNewInstSelOneCho().getValue() == null)
                            || (getCountryBusNewInstSelOneCho() != null
                                    && getCountryBusNewInstSelOneCho().getValue() != null
                                    && getCountryBusNewInstSelOneCho().getValue().equals("US")
                                    && getStatesUSNewInstSelOneCho().getValue() != null
                                    && getStatesUSNewInstSelOneCho().getValue().equals(""))) {

                        getFloridaLicensePnlGrp().setVisible(false);
                        getFloridaLicenseCmdImgLnk().setVisible(false);
                        getFloridaLicenseImgLbl().setVisible(false);
                        getLicensePnlGrp().setVisible(false);
                        getLicenseNumberIpTx().setValue("");
                    }
                }
            } else if (getAddressOptionsRdBtn().getValue().equals("home")) {

                if (getCountryHomeSelOneCho().getValue().equals("US")
                        && getStatesUSHomeSelOneCho().getValue() != null
                        && !getStatesUSHomeSelOneCho().getValue().equals("FL")
                        && !getStatesUSHomeSelOneCho().getValue().equals("") && !getLicensePnlGrp().isVisible()) {

                    getFloridaLicensePnlGrp().setVisible(true);
                    getFloridaLicenseCmdImgLnk().setVisible(true);
                    getFloridaLicenseImgLbl().setVisible(false);
                    getLicensePnlGrp().setVisible(false);
                } else if (getCountryHomeSelOneCho().getValue().equals("US")
                        && getStatesUSHomeSelOneCho().getValue() != null
                        && getStatesUSHomeSelOneCho().getValue().equals("FL")) {

                    getFloridaLicensePnlGrp().setVisible(true);
                    getFloridaLicenseCmdImgLnk().setVisible(false);
                    getFloridaLicenseImgLbl().setVisible(true);
                    getLicensePnlGrp().setVisible(true);
                } else if (!getCountryHomeSelOneCho().getValue().equals("US")
                        || (getCountryHomeSelOneCho().getValue().equals("US")
                                && getStatesUSHomeSelOneCho().getValue() == null)
                        || (getCountryHomeSelOneCho().getValue().equals("US")
                                && getStatesUSHomeSelOneCho().getValue() != null
                                && getStatesUSHomeSelOneCho().getValue().equals(""))) {

                    getFloridaLicensePnlGrp().setVisible(false);
                    getFloridaLicenseCmdImgLnk().setVisible(false);
                    getFloridaLicenseImgLbl().setVisible(false);
                    getLicensePnlGrp().setVisible(false);
                    getLicenseNumberIpTx().setValue("");
                }
            } else if (getAddressOptionsRdBtn().getValue().equals("businesshome")) {
                if (getInstitutionOptionsRdBtn().getValue().equals("newInst")) {
                    if ((!getLicensePnlGrp().isVisible() && getCountryBusNewInstSelOneCho() != null
                            && getCountryBusNewInstSelOneCho().getValue() != null
                            && getCountryBusNewInstSelOneCho().getValue().equals("US")
                            && getCountryHomeSelOneCho().getValue().equals("US")
                            && getStatesUSNewInstSelOneCho().getValue() != null
                            && !getStatesUSNewInstSelOneCho().getValue().equals("")
                            && !getStatesUSNewInstSelOneCho().getValue().equals("FL")) ||

                            (!getLicensePnlGrp().isVisible() && getCountryBusNewInstSelOneCho() != null
                                    && getCountryBusNewInstSelOneCho().getValue() != null
                                    && getCountryBusNewInstSelOneCho().getValue().equals("US")
                                    && getCountryHomeSelOneCho().getValue().equals("US")
                                    && getStatesUSHomeSelOneCho().getValue() != null
                                    && !getStatesUSHomeSelOneCho().getValue().equals("")
                                    && !getStatesUSHomeSelOneCho().getValue().equals("FL"))
                            ||

                            (!getLicensePnlGrp().isVisible() && getCountryBusNewInstSelOneCho() != null
                                    && getCountryBusNewInstSelOneCho().getValue() != null
                                    && getCountryBusNewInstSelOneCho().getValue().equals("US")
                                    && !getCountryHomeSelOneCho().getValue().equals("US")
                                    && getStatesUSNewInstSelOneCho().getValue() != null
                                    && !getStatesUSNewInstSelOneCho().getValue().equals("FL")
                                    && !getStatesUSNewInstSelOneCho().getValue().equals(""))
                            ||

                            ((!getLicensePnlGrp().isVisible() && getCountryBusNewInstSelOneCho() != null
                                    && getCountryBusNewInstSelOneCho().getValue() != null
                                    && !getCountryBusNewInstSelOneCho().getValue().equals("US")
                                    && getCountryHomeSelOneCho().getValue().equals("US")
                                    && getStatesUSHomeSelOneCho().getValue() != null
                                    && !getStatesUSHomeSelOneCho().getValue().equals("FL")
                                    && !getStatesUSHomeSelOneCho().getValue().equals("")))) {

                        getFloridaLicensePnlGrp().setVisible(true);
                        getFloridaLicenseCmdImgLnk().setVisible(true);
                        getFloridaLicenseImgLbl().setVisible(false);
                        getLicensePnlGrp().setVisible(false);
                    } else if ((getCountryBusNewInstSelOneCho() != null
                            && getCountryBusNewInstSelOneCho().getValue() != null
                            && getCountryBusNewInstSelOneCho().getValue().equals("US")
                            && getCountryHomeSelOneCho().getValue().equals("US")
                            && getStatesUSNewInstSelOneCho() != null
                            && getStatesUSNewInstSelOneCho().getValue() != null
                            && getStatesUSNewInstSelOneCho().getValue().equals("FL")
                            && getStatesUSHomeSelOneCho().getValue() != null
                            && getStatesUSHomeSelOneCho().getValue().equals("FL")
                            || (getCountryBusNewInstSelOneCho() != null
                                    && getCountryBusNewInstSelOneCho().getValue() != null
                                    && getCountryBusNewInstSelOneCho().getValue().equals("US")
                                    && !getCountryHomeSelOneCho().getValue().equals("US")
                                    && getStatesUSNewInstSelOneCho().getValue() != null
                                    && getStatesUSNewInstSelOneCho().getValue().equals("FL"))
                            || (getCountryBusNewInstSelOneCho() != null
                                    && getCountryBusNewInstSelOneCho().getValue() != null
                                    && !getCountryBusNewInstSelOneCho().getValue().equals("US")
                                    && getCountryHomeSelOneCho().getValue().equals("US")
                                    && getStatesUSHomeSelOneCho().getValue() != null
                                    && getStatesUSHomeSelOneCho().getValue().equals("FL")))) {

                        getFloridaLicensePnlGrp().setVisible(true);
                        getFloridaLicenseCmdImgLnk().setVisible(false);
                        getFloridaLicenseImgLbl().setVisible(true);
                        getLicensePnlGrp().setVisible(true);
                    }

                    else if ((!getCountryBusNewInstSelOneCho().getValue().equals("US")
                            && !getCountryHomeSelOneCho().getValue().equals("US"))
                            || (getCountryBusNewInstSelOneCho().getValue().equals("US")
                                    && getStatesUSNewInstSelOneCho().getValue() == null
                                    && getCountryHomeSelOneCho().getValue().equals("US")
                                    && getStatesUSHomeSelOneCho().getValue() == null)
                            || (getCountryBusNewInstSelOneCho().getValue().equals("US")
                                    && getStatesUSNewInstSelOneCho().getValue() != null
                                    && getStatesUSNewInstSelOneCho().getValue().equals("")
                                    && getCountryHomeSelOneCho().getValue().equals("US")
                                    && getStatesUSHomeSelOneCho().getValue() != null
                                    && getStatesUSHomeSelOneCho().getValue().equals(""))
                            || (getCountryHomeSelOneCho().getValue().equals("US")
                                    && getStatesUSHomeSelOneCho().getValue() == null
                                    && !getCountryBusNewInstSelOneCho().getValue().equals("US"))
                            || (getCountryHomeSelOneCho().getValue().equals("US")
                                    && getStatesUSHomeSelOneCho().getValue() != null
                                    && getStatesUSHomeSelOneCho().getValue().equals("")
                                    && !getCountryBusNewInstSelOneCho().getValue().equals("US"))
                            || (getCountryBusNewInstSelOneCho().getValue().equals("US")
                                    && getStatesUSNewInstSelOneCho().getValue() == null
                                    && !getCountryHomeSelOneCho().getValue().equals("US"))
                            || (getCountryBusNewInstSelOneCho().getValue().equals("US")
                                    && getStatesUSNewInstSelOneCho().getValue() != null
                                    && getStatesUSNewInstSelOneCho().getValue().equals("")
                                    && !getCountryHomeSelOneCho().getValue().equals("US"))) {

                        getFloridaLicensePnlGrp().setVisible(false);
                        getFloridaLicenseCmdImgLnk().setVisible(false);
                        getFloridaLicenseImgLbl().setVisible(false);
                        getLicensePnlGrp().setVisible(false);
                        getLicenseNumberIpTx().setValue("");
                    }
                }

                else {
                    //Party disabled
                    if (getCountryPartySelOneCho().isDisabled()) {

                        if (getCountryHomeSelOneCho().getValue().equals("US")
                                && getStatesUSHomeSelOneCho().getValue() != null
                                && !getStatesUSHomeSelOneCho().getValue().equals("FL")
                                && !getStatesUSHomeSelOneCho().getValue().equals("")
                                && !getLicensePnlGrp().isVisible()) {

                            getFloridaLicensePnlGrp().setVisible(true);
                            getFloridaLicenseCmdImgLnk().setVisible(true);
                            getFloridaLicenseImgLbl().setVisible(false);
                            getLicensePnlGrp().setVisible(false);
                        } else if (getCountryHomeSelOneCho().getValue().equals("US")
                                && getStatesUSHomeSelOneCho().getValue() != null
                                && getStatesUSHomeSelOneCho().getValue().equals("FL")) {

                            getFloridaLicensePnlGrp().setVisible(true);
                            getFloridaLicenseCmdImgLnk().setVisible(false);
                            getFloridaLicenseImgLbl().setVisible(true);
                            getLicensePnlGrp().setVisible(true);
                        } else if (!getCountryHomeSelOneCho().getValue().equals("US")
                                || (getCountryHomeSelOneCho().getValue().equals("US")
                                        && getStatesUSHomeSelOneCho().getValue() == null)
                                || (getCountryHomeSelOneCho().getValue().equals("US")
                                        && getStatesUSHomeSelOneCho().getValue() != null
                                        && getStatesUSHomeSelOneCho().getValue().equals(""))) {

                            getFloridaLicensePnlGrp().setVisible(false);
                            getFloridaLicenseCmdImgLnk().setVisible(false);
                            getFloridaLicenseImgLbl().setVisible(false);
                            getLicensePnlGrp().setVisible(false);
                            getLicenseNumberIpTx().setValue("");
                        }
                    }
                    //Party not disabled
                    else {

                        if ((!getLicensePnlGrp().isVisible() && getCountryPartySelOneCho().getValue().equals("US")
                                && getCountryHomeSelOneCho().getValue().equals("US")
                                && getStatesUSPartySelOneCho().getValue() != null
                                && !getStatesUSPartySelOneCho().getValue().equals("FL")
                                && !getStatesUSPartySelOneCho().getValue().equals("")
                                && getStatesUSHomeSelOneCho().getValue() != null
                                && !getStatesUSHomeSelOneCho().getValue().equals("FL")
                                && !getStatesUSHomeSelOneCho().getValue().equals(""))
                                || (!getLicensePnlGrp().isVisible()
                                        && getCountryPartySelOneCho().getValue().equals("US")
                                        && getCountryHomeSelOneCho().getValue().equals("US")
                                        && getStatesUSPartySelOneCho().getValue() != null
                                        && !getStatesUSPartySelOneCho().getValue().equals("FL")
                                        && !getStatesUSPartySelOneCho().getValue().equals(""))
                                || (!getLicensePnlGrp().isVisible()
                                        && (!getCountryPartySelOneCho().getValue().equals("US")
                                                && getCountryHomeSelOneCho().getValue().equals("US")
                                                && getStatesUSHomeSelOneCho().getValue() != null
                                                && !getStatesUSHomeSelOneCho().getValue().equals("FL")
                                                && !getStatesUSHomeSelOneCho().getValue().equals("")))) {

                            getFloridaLicensePnlGrp().setVisible(true);
                            getFloridaLicenseCmdImgLnk().setVisible(true);
                            getFloridaLicenseImgLbl().setVisible(false);
                            getLicensePnlGrp().setVisible(false);
                        } else if ((getCountryPartySelOneCho().getValue().equals("US")
                                && getCountryHomeSelOneCho().getValue().equals("US")
                                && (getStatesUSPartySelOneCho().getValue() != null
                                        && getStatesUSPartySelOneCho().getValue().equals("FL"))
                                || (getStatesUSHomeSelOneCho().getValue() != null
                                        && getStatesUSHomeSelOneCho().getValue().equals("FL")))
                                || (getCountryPartySelOneCho().getValue().equals("US")
                                        && !getCountryHomeSelOneCho().getValue().equals("US")
                                        && getStatesUSPartySelOneCho().getValue() != null
                                        && getStatesUSPartySelOneCho().getValue().equals("FL"))
                                || (!getCountryPartySelOneCho().getValue().equals("US")
                                        && getCountryHomeSelOneCho().getValue().equals("US")
                                        && getStatesUSHomeSelOneCho().getValue() != null
                                        && getStatesUSHomeSelOneCho().getValue().equals("FL"))) {

                            getFloridaLicensePnlGrp().setVisible(true);
                            getFloridaLicenseCmdImgLnk().setVisible(false);
                            getFloridaLicenseImgLbl().setVisible(true);
                            getLicensePnlGrp().setVisible(true);
                        } else if ((!getCountryPartySelOneCho().getValue().equals("US")
                                && !getCountryHomeSelOneCho().getValue().equals("US"))
                                || (getCountryPartySelOneCho().getValue().equals("US")
                                        && getStatesUSPartySelOneCho().getValue() == null
                                        && getCountryHomeSelOneCho().getValue().equals("US")
                                        && getStatesUSHomeSelOneCho().getValue() == null)
                                || (getCountryPartySelOneCho().getValue().equals("US")
                                        && getStatesUSPartySelOneCho().getValue() != null
                                        && getStatesUSPartySelOneCho().getValue().equals("")
                                        && getCountryHomeSelOneCho().getValue().equals("US")
                                        && getStatesUSHomeSelOneCho().getValue() != null
                                        && getStatesUSHomeSelOneCho().getValue().equals(""))
                                || (getCountryHomeSelOneCho().getValue().equals("US")
                                        && getStatesUSHomeSelOneCho().getValue() == null
                                        && !getCountryPartySelOneCho().getValue().equals("US"))
                                || (getCountryHomeSelOneCho().getValue().equals("US")
                                        && getStatesUSHomeSelOneCho().getValue() != null
                                        && getStatesUSHomeSelOneCho().getValue().equals("")
                                        && !getCountryPartySelOneCho().getValue().equals("US"))
                                || (getCountryPartySelOneCho().getValue().equals("US")
                                        && getStatesUSPartySelOneCho().getValue() == null
                                        && !getCountryHomeSelOneCho().getValue().equals("US"))
                                || (getCountryPartySelOneCho().getValue().equals("US")
                                        && getStatesUSPartySelOneCho().getValue() != null
                                        && getStatesUSPartySelOneCho().getValue().equals("")
                                        && !getCountryHomeSelOneCho().getValue().equals("US"))) {

                            getFloridaLicensePnlGrp().setVisible(false);
                            getFloridaLicenseCmdImgLnk().setVisible(false);
                            getFloridaLicenseImgLbl().setVisible(false);
                            getLicensePnlGrp().setVisible(false);
                            getLicenseNumberIpTx().setValue("");
                        }
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void partyDetailsReturnPopupListener(ReturnPopupEvent returnPopupEvent) {

        BindingContext bindingContext = BindingContext.getCurrent();
        BindingContainer bindings = bindingContext.getCurrentBindingsEntry();
        try {
            DCIteratorBinding iter;
            iter = (DCIteratorBinding) bindings.get("InstitutionDisplay1Iterator");
            Row r = iter.getCurrentRow();

            if (r.getAttribute("PartyId") != null && r.getAttribute("PartyNumber") != null) {
                enablePartyInfoFlds();
                if (r.getAttribute("Country").equals("US")) {

                    getCountryPartySelOneCho().setValue("US");
                    getStatesUSPartySelOneCho().setValue(r.getAttribute("State"));
                } else if (r.getAttribute("Country").equals("AU")) {

                    getCountryPartySelOneCho().setValue("AU");
                    getStatesAUPartySelOneCho().setValue(r.getAttribute("State"));

                } else if (r.getAttribute("Country").equals("CA")) {

                    getCountryPartySelOneCho().setValue("CA");
                    getStatesCAPartySelOneCho().setValue(r.getAttribute("State"));
                } else if (!r.getAttribute("Country").equals("US") && !r.getAttribute("Country").equals("AU")
                        && !r.getAttribute("Country").equals("CA")) {

                    getCountryPartySelOneCho().setValue(r.getAttribute("Country"));
                    getStatesOthersPartyIpTx().setValue(r.getAttribute("State"));

                }
                floridaFlds();
            }
        } catch (Exception e) {
            sLog.debug(e.getMessage(), e);
            e.printStackTrace();
        }
    }

    public void setStatesOthersPartyIpTx(RichInputText statesOthersPartyIpTx) {
        this.statesOthersPartyIpTx = statesOthersPartyIpTx;
    }

    public RichInputText getStatesOthersPartyIpTx() {
        return statesOthersPartyIpTx;
    }

    public void setHomeOutputLabel(RichOutputLabel homeOutputLabel) {
        this.homeOutputLabel = homeOutputLabel;
    }

    public RichOutputLabel getHomeOutputLabel() {
        return homeOutputLabel;
    }

    public void setBusinessOutputLabel(RichOutputLabel businessOutputLabel) {
        this.businessOutputLabel = businessOutputLabel;
    }

    public RichOutputLabel getBusinessOutputLabel() {
        return businessOutputLabel;
    }

    public void setStatesUSHomeSelOneCho(RichSelectOneChoice statesUSHomeSelOneCho) {
        this.statesUSHomeSelOneCho = statesUSHomeSelOneCho;
    }

    public RichSelectOneChoice getStatesUSHomeSelOneCho() {
        return statesUSHomeSelOneCho;
    }

    public void setBusinessAddressConfirmPopup(RichPopup businessAddressConfirmPopup) {
        this.businessAddressConfirmPopup = businessAddressConfirmPopup;
    }

    public RichPopup getBusinessAddressConfirmPopup() {
        return businessAddressConfirmPopup;
    }

    public void setHomeAddressConfirmPopup(RichPopup homeAddressConfirmPopup) {
        this.homeAddressConfirmPopup = homeAddressConfirmPopup;
    }

    public RichPopup getHomeAddressConfirmPopup() {
        return homeAddressConfirmPopup;
    }

    public void setAddressOptionsRdBtn(RichSelectOneRadio addressOptionsRdBtn) {
        this.addressOptionsRdBtn = addressOptionsRdBtn;
    }

    public RichSelectOneRadio getAddressOptionsRdBtn() {
        return addressOptionsRdBtn;
    }

    public void setCountryPartySelOneCho(RichSelectOneChoice countryPartySelOneCho) {
        this.countryPartySelOneCho = countryPartySelOneCho;
    }

    public RichSelectOneChoice getCountryPartySelOneCho() {
        return countryPartySelOneCho;
    }

    public void setStatesUSPartySelOneCho(RichSelectOneChoice statesUSPartySelOneCho) {
        this.statesUSPartySelOneCho = statesUSPartySelOneCho;
    }

    public RichSelectOneChoice getStatesUSPartySelOneCho() {
        return statesUSPartySelOneCho;
    }

    public void setStatesAUPartySelOneCho(RichSelectOneChoice statesAUPartySelOneCho) {
        this.statesAUPartySelOneCho = statesAUPartySelOneCho;
    }

    public RichSelectOneChoice getStatesAUPartySelOneCho() {
        return statesAUPartySelOneCho;
    }

    public void setStatesCAPartySelOneCho(RichSelectOneChoice statesCAPartySelOneCho) {
        this.statesCAPartySelOneCho = statesCAPartySelOneCho;
    }

    public RichSelectOneChoice getStatesCAPartySelOneCho() {
        return statesCAPartySelOneCho;
    }

    public void setCountryHomeSelOneCho(RichSelectOneChoice countryHomeSelOneCho) {
        this.countryHomeSelOneCho = countryHomeSelOneCho;
    }

    public RichSelectOneChoice getCountryHomeSelOneCho() {
        return countryHomeSelOneCho;
    }

    public void setPartyIdIpTx(RichInputText partyIdIpTx) {
        this.partyIdIpTx = partyIdIpTx;
    }

    public RichInputText getPartyIdIpTx() {
        return partyIdIpTx;
    }

    public void setPartyNumberIpTx(RichInputText partyNumberIpTx) {
        this.partyNumberIpTx = partyNumberIpTx;
    }

    public RichInputText getPartyNumberIpTx() {
        return partyNumberIpTx;
    }

    public void setPartyNameIpLOV(RichInputListOfValues partyNameIpLOV) {
        this.partyNameIpLOV = partyNameIpLOV;
    }

    public RichInputListOfValues getPartyNameIpLOV() {
        return partyNameIpLOV;
    }

    public void setAddress1PartyIpTx(RichInputText address1PartyIpTx) {
        this.address1PartyIpTx = address1PartyIpTx;
    }

    public RichInputText getAddress1PartyIpTx() {
        return address1PartyIpTx;
    }

    public void setAddress2PartyIpTx(RichInputText address2PartyIpTx) {
        this.address2PartyIpTx = address2PartyIpTx;
    }

    public RichInputText getAddress2PartyIpTx() {
        return address2PartyIpTx;
    }

    public void setAddress3PartyIpTx(RichInputText address3PartyIpTx) {
        this.address3PartyIpTx = address3PartyIpTx;
    }

    public RichInputText getAddress3PartyIpTx() {
        return address3PartyIpTx;
    }

    public void setAddress4PartyIpTx(RichInputText address4PartyIpTx) {
        this.address4PartyIpTx = address4PartyIpTx;
    }

    public RichInputText getAddress4PartyIpTx() {
        return address4PartyIpTx;
    }

    public void setCityPartyIpTx(RichInputText cityPartyIpTx) {
        this.cityPartyIpTx = cityPartyIpTx;
    }

    public RichInputText getCityPartyIpTx() {
        return cityPartyIpTx;
    }

    public void setPostalCodePartyIpTx(RichInputText postalCodePartyIpTx) {
        this.postalCodePartyIpTx = postalCodePartyIpTx;
    }

    public RichInputText getPostalCodePartyIpTx() {
        return postalCodePartyIpTx;
    }

    public void setCountyPartyIpTx(RichInputText countyPartyIpTx) {
        this.countyPartyIpTx = countyPartyIpTx;
    }

    public RichInputText getCountyPartyIpTx() {
        return countyPartyIpTx;
    }

    public void setPhonePartyIpTx(RichInputText phonePartyIpTx) {
        this.phonePartyIpTx = phonePartyIpTx;
    }

    public RichInputText getPhonePartyIpTx() {
        return phonePartyIpTx;
    }

    public void setCountryBusNewInstSelOneCho(RichSelectOneChoice countryBusNewInstSelOneCho) {
        this.countryBusNewInstSelOneCho = countryBusNewInstSelOneCho;
    }

    public RichSelectOneChoice getCountryBusNewInstSelOneCho() {
        return countryBusNewInstSelOneCho;
    }

    public void setFaxExtPartyIpTx(RichInputText faxExtPartyIpTx) {
        this.faxExtPartyIpTx = faxExtPartyIpTx;
    }

    public RichInputText getFaxExtPartyIpTx() {
        return faxExtPartyIpTx;
    }

    public void setFaxPartyIpTx(RichInputText faxPartyIpTx) {
        this.faxPartyIpTx = faxPartyIpTx;
    }

    public RichInputText getFaxPartyIpTx() {
        return faxPartyIpTx;
    }

    public void setPhoneExtPartyIpTx(RichInputText phoneExtPartyIpTx) {
        this.phoneExtPartyIpTx = phoneExtPartyIpTx;
    }

    public RichInputText getPhoneExtPartyIpTx() {
        return phoneExtPartyIpTx;
    }

    public void setStatesUSNewInstSelOneCho(RichSelectOneChoice statesUSNewInstSelOneCho) {
        this.statesUSNewInstSelOneCho = statesUSNewInstSelOneCho;
    }

    public RichSelectOneChoice getStatesUSNewInstSelOneCho() {
        return statesUSNewInstSelOneCho;
    }

    public void setInstitutionNameBusNewInstIpTx(RichInputText institutionNameBusNewInstIpTx) {
        this.institutionNameBusNewInstIpTx = institutionNameBusNewInstIpTx;
    }

    public RichInputText getInstitutionNameBusNewInstIpTx() {
        return institutionNameBusNewInstIpTx;
    }

    public void setAddress1BusNewInstIpTx(RichInputText address1BusNewInstIpTx) {
        this.address1BusNewInstIpTx = address1BusNewInstIpTx;
    }

    public RichInputText getAddress1BusNewInstIpTx() {
        return address1BusNewInstIpTx;
    }

    public void setAddress2BusNewInstIpTx(RichInputText address2BusNewInstIpTx) {
        this.address2BusNewInstIpTx = address2BusNewInstIpTx;
    }

    public RichInputText getAddress2BusNewInstIpTx() {
        return address2BusNewInstIpTx;
    }

    public void setAddress3BusNewInstIpTx(RichInputText address3BusNewInstIpTx) {
        this.address3BusNewInstIpTx = address3BusNewInstIpTx;
    }

    public RichInputText getAddress3BusNewInstIpTx() {
        return address3BusNewInstIpTx;
    }

    public void setAddress4BusNewInstIpTx(RichInputText address4BusNewInstIpTx) {
        this.address4BusNewInstIpTx = address4BusNewInstIpTx;
    }

    public RichInputText getAddress4BusNewInstIpTx() {
        return address4BusNewInstIpTx;
    }

    public void setStatesAUNewInstSelOneCho(RichSelectOneChoice statesAUNewInstSelOneCho) {
        this.statesAUNewInstSelOneCho = statesAUNewInstSelOneCho;
    }

    public RichSelectOneChoice getStatesAUNewInstSelOneCho() {
        return statesAUNewInstSelOneCho;
    }

    public void setStatesCANewInstSelOneCho(RichSelectOneChoice statesCANewInstSelOneCho) {
        this.statesCANewInstSelOneCho = statesCANewInstSelOneCho;
    }

    public RichSelectOneChoice getStatesCANewInstSelOneCho() {
        return statesCANewInstSelOneCho;
    }

    public void setStatesOtherNewInstIpTx(RichInputText statesOtherNewInstIpTx) {
        this.statesOtherNewInstIpTx = statesOtherNewInstIpTx;
    }

    public RichInputText getStatesOtherNewInstIpTx() {
        return statesOtherNewInstIpTx;
    }

    public void setCityBusNewInstIpTx(RichInputText cityBusNewInstIpTx) {
        this.cityBusNewInstIpTx = cityBusNewInstIpTx;
    }

    public RichInputText getCityBusNewInstIpTx() {
        return cityBusNewInstIpTx;
    }

    public void setPostalCodeBusNewInstIpTx(RichInputText postalCodeBusNewInstIpTx) {
        this.postalCodeBusNewInstIpTx = postalCodeBusNewInstIpTx;
    }

    public RichInputText getPostalCodeBusNewInstIpTx() {
        return postalCodeBusNewInstIpTx;
    }

    public void setCountyBusNewInstIpTx(RichInputText countyBusNewInstIpTx) {
        this.countyBusNewInstIpTx = countyBusNewInstIpTx;
    }

    public RichInputText getCountyBusNewInstIpTx() {
        return countyBusNewInstIpTx;
    }

    public void setPhoneBusNewInstIpTx(RichInputText phoneBusNewInstIpTx) {
        this.phoneBusNewInstIpTx = phoneBusNewInstIpTx;
    }

    public RichInputText getPhoneBusNewInstIpTx() {
        return phoneBusNewInstIpTx;
    }

    public void setPhoneExtBusNewInstIpTx(RichInputText phoneExtBusNewInstIpTx) {
        this.phoneExtBusNewInstIpTx = phoneExtBusNewInstIpTx;
    }

    public RichInputText getPhoneExtBusNewInstIpTx() {
        return phoneExtBusNewInstIpTx;
    }

    public void setFaxBusNewInstIpTx(RichInputText faxBusNewInstIpTx) {
        this.faxBusNewInstIpTx = faxBusNewInstIpTx;
    }

    public RichInputText getFaxBusNewInstIpTx() {
        return faxBusNewInstIpTx;
    }

    public void setFaxExtBusNewInstIpTx(RichInputText faxExtBusNewInstIpTx) {
        this.faxExtBusNewInstIpTx = faxExtBusNewInstIpTx;
    }

    public RichInputText getFaxExtBusNewInstIpTx() {
        return faxExtBusNewInstIpTx;
    }

    public void setAddress1HomeIpTx(RichInputText address1HomeIpTx) {
        this.address1HomeIpTx = address1HomeIpTx;
    }

    public RichInputText getAddress1HomeIpTx() {
        return address1HomeIpTx;
    }

    public void setAddress2HomeIpTx(RichInputText address2HomeIpTx) {
        this.address2HomeIpTx = address2HomeIpTx;
    }

    public RichInputText getAddress2HomeIpTx() {
        return address2HomeIpTx;
    }

    public void setAddress3HomeIpTx(RichInputText address3HomeIpTx) {
        this.address3HomeIpTx = address3HomeIpTx;
    }

    public RichInputText getAddress3HomeIpTx() {
        return address3HomeIpTx;
    }

    public void setAddress4HomeIpTx(RichInputText address4HomeIpTx) {
        this.address4HomeIpTx = address4HomeIpTx;
    }

    public RichInputText getAddress4HomeIpTx() {
        return address4HomeIpTx;
    }

    public void setStatesAUHomeSelOneCho(RichSelectOneChoice statesAUHomeSelOneCho) {
        this.statesAUHomeSelOneCho = statesAUHomeSelOneCho;
    }

    public RichSelectOneChoice getStatesAUHomeSelOneCho() {
        return statesAUHomeSelOneCho;
    }

    public void setStatesCAHomeSelOneCho(RichSelectOneChoice statesCAHomeSelOneCho) {
        this.statesCAHomeSelOneCho = statesCAHomeSelOneCho;
    }

    public RichSelectOneChoice getStatesCAHomeSelOneCho() {
        return statesCAHomeSelOneCho;
    }

    public void setStatesOtherHomeIpTx(RichInputText statesOtherHomeIpTx) {
        this.statesOtherHomeIpTx = statesOtherHomeIpTx;
    }

    public RichInputText getStatesOtherHomeIpTx() {
        return statesOtherHomeIpTx;
    }

    public void setCityHomeIpTx(RichInputText cityHomeIpTx) {
        this.cityHomeIpTx = cityHomeIpTx;
    }

    public RichInputText getCityHomeIpTx() {
        return cityHomeIpTx;
    }

    public void setPostalCodeHomeIpTx(RichInputText postalCodeHomeIpTx) {
        this.postalCodeHomeIpTx = postalCodeHomeIpTx;
    }

    public RichInputText getPostalCodeHomeIpTx() {
        return postalCodeHomeIpTx;
    }

    public void setCountyHomeIpTx(RichInputText countyHomeIpTx) {
        this.countyHomeIpTx = countyHomeIpTx;
    }

    public RichInputText getCountyHomeIpTx() {
        return countyHomeIpTx;
    }

    public void setPhoneHomeIpTx(RichInputText phoneHomeIpTx) {
        this.phoneHomeIpTx = phoneHomeIpTx;
    }

    public RichInputText getPhoneHomeIpTx() {
        return phoneHomeIpTx;
    }

    public void setFaxHomeIpTx(RichInputText faxHomeIpTx) {
        this.faxHomeIpTx = faxHomeIpTx;
    }

    public RichInputText getFaxHomeIpTx() {
        return faxHomeIpTx;
    }

    public void setBrowseInstAddressConfirmPopup(RichPopup browseInstAddressConfirmPopup) {
        this.browseInstAddressConfirmPopup = browseInstAddressConfirmPopup;
    }

    public RichPopup getBrowseInstAddressConfirmPopup() {
        return browseInstAddressConfirmPopup;
    }

    public void setNewInstAddressConfirmPopup(RichPopup newInstAddressConfirmPopup) {
        this.newInstAddressConfirmPopup = newInstAddressConfirmPopup;
    }

    public RichPopup getNewInstAddressConfirmPopup() {
        return newInstAddressConfirmPopup;
    }

    public void setBrowseInstCmdLnk(RichCommandLink browseInstCmdLnk) {
        this.browseInstCmdLnk = browseInstCmdLnk;
    }

    public RichCommandLink getBrowseInstCmdLnk() {
        return browseInstCmdLnk;
    }

    public void setBrowseInstOpLbl(RichOutputLabel browseInstOpLbl) {
        this.browseInstOpLbl = browseInstOpLbl;
    }

    public RichOutputLabel getBrowseInstOpLbl() {
        return browseInstOpLbl;
    }

    public void setBrowseInstPnlFrm(RichPanelFormLayout browseInstPnlFrm) {
        this.browseInstPnlFrm = browseInstPnlFrm;
    }

    public RichPanelFormLayout getBrowseInstPnlFrm() {
        return browseInstPnlFrm;
    }

    public void setNewInstCmdLnk(RichCommandLink newInstCmdLnk) {
        this.newInstCmdLnk = newInstCmdLnk;
    }

    public RichCommandLink getNewInstCmdLnk() {
        return newInstCmdLnk;
    }

    public void setNewInstOpLbl(RichOutputText newInstOpLbl) {
        this.newInstOpLbl = newInstOpLbl;
    }

    public RichOutputText getNewInstOpLbl() {
        return newInstOpLbl;
    }

    public void setNewInstPnlFrm(RichPanelFormLayout newInstPnlFrm) {
        this.newInstPnlFrm = newInstPnlFrm;
    }

    public RichPanelFormLayout getNewInstPnlFrm() {
        return newInstPnlFrm;
    }

    public void setHomeAddressPnlGrp(RichPanelGroupLayout homeAddressPnlGrp) {
        this.homeAddressPnlGrp = homeAddressPnlGrp;
    }

    public RichPanelGroupLayout getHomeAddressPnlGrp() {
        return homeAddressPnlGrp;
    }

    public void setBusinessAddressPnlGrp(RichPanelGroupLayout businessAddressPnlGrp) {
        this.businessAddressPnlGrp = businessAddressPnlGrp;
    }

    public RichPanelGroupLayout getBusinessAddressPnlGrp() {
        return businessAddressPnlGrp;
    }

    public void setInstitutionOptionsRdBtn(RichSelectOneRadio institutionOptionsRdBtn) {
        this.institutionOptionsRdBtn = institutionOptionsRdBtn;
    }

    public RichSelectOneRadio getInstitutionOptionsRdBtn() {
        return institutionOptionsRdBtn;
    }

    public void setAddressPreferenceRdBtn(RichSelectOneRadio addressPreferenceRdBtn) {
        this.addressPreferenceRdBtn = addressPreferenceRdBtn;
    }

    public RichSelectOneRadio getAddressPreferenceRdBtn() {
        return addressPreferenceRdBtn;
    }

    public void initMethod(PhaseEvent phaseEvent) {

        Map requestScope = ADFContext.getCurrent().getRequestScope();
        //   System.out.println("Credentials from bindings ");
        //chk whether it is coming from previous page and also for options button not null
        if (requestScope.get("PAGESOURCE") != null && requestScope.get("PAGESOURCE").equals("personDetails")) {
            //   String credentials = (String)requestScope.get("CREDENTIALS");
            //   System.out.println("Init Cred "+credentials);
            //    setCredentials(credentials);
            if (getAddressOptionsRdBtn().getValue() == null) {

                //    getFloridaLicensePnlGrp().setVisible(false);
                getCountryBusNewInstSelOneCho().setValue("US");
                getCountryHomeSelOneCho().setValue("US");
                getAddressOptionsRdBtn().setValue("business");
                getInstitutionOptionsRdBtn().setValue("browseInst");
                enableBusinessLayoutFlds();
                enableBusBrowstInstLayoutFlds();
                disableHomeLayoutFlds();
                disableBusNewInstLayoutFlds();
                disablePartyInfoFlds();
            } else if (getAddressOptionsRdBtn().getValue().equals("business")) {

                if (getInstitutionOptionsRdBtn().getValue().equals("browseInst")) {
                    enableBusinessLayoutFlds(); //y
                    enableBusBrowstInstLayoutFlds();
                    disableBusNewInstLayoutFlds();
                    disableHomeLayoutFlds(); //y

                }
                //  if(getInstitutionOptionsRdBtn().getValue().equals("newInst")){
                else {
                    enableBusinessLayoutFlds();
                    disableBusBrowstInstLayoutFlds();
                    enableBusNewInstLayoutFlds();
                    disableHomeLayoutFlds();
                    //  disableBusNewInstLayoutFlds(); 
                }
            } else if (getAddressOptionsRdBtn().getValue().equals("home")) {

                disableBusinessLayoutFlds();
                enableHomeLayoutFlds();
                //added by priya
                if (getInstitutionOptionsRdBtn().getValue().equals("browseInst")) {
                    disableBusNewInstLayoutFlds();
                    //added by priya
                    enableBusBrowstInstLayoutFlds();
                } else {
                    disableBusBrowstInstLayoutFlds();
                    //added by priya
                    enableBusNewInstLayoutFlds();
                }
            } else if (getAddressOptionsRdBtn().getValue().equals("businesshome")) {

                enableBusinessLayoutFlds();
                enableHomeLayoutFlds();
                if (getInstitutionOptionsRdBtn().getValue().equals("browseInst")) {
                    disableBusNewInstLayoutFlds();
                    enableBusBrowstInstLayoutFlds();
                    if (getPartyNameIpLOV() != null && getPartyNameIpLOV().getValue() != null
                            && getPartyNameIpLOV().getValue().toString().trim().equals("")) {
                        disablePartyInfoFlds();
                    }
                } else {
                    disableBusBrowstInstLayoutFlds();
                    //added by priya
                    enableBusNewInstLayoutFlds();
                }
            }
        } else if (getAddressOptionsRdBtn().getValue() == null) {
            System.out.println("Inside init last else if to chk page expire");
            getCountryBusNewInstSelOneCho().setValue("US");
            getCountryHomeSelOneCho().setValue("US");
            getAddressOptionsRdBtn().setValue("business");
            getInstitutionOptionsRdBtn().setValue("browseInst");
            enableBusinessLayoutFlds();
            enableBusBrowstInstLayoutFlds();
            disableHomeLayoutFlds();
            disableBusNewInstLayoutFlds();
            disablePartyInfoFlds();
        }

    }

    public void enableBusBrowstInstLayoutFlds() {
        getBrowseInstPnlFrm().setVisible(true);
        getBrowseInstOpLbl().setVisible(true);
        getBrowseInstCmdLnk().setVisible(false);
    }

    public void disableBusBrowstInstLayoutFlds() {
        getBrowseInstPnlFrm().setVisible(false);
        getBrowseInstOpLbl().setVisible(false);
        getBrowseInstCmdLnk().setVisible(true);
    }

    public void enableBusNewInstLayoutFlds() {
        getNewInstCmdLnk().setVisible(false);
        getNewInstOpLbl().setVisible(true);
        getNewInstPnlFrm().setVisible(true);
    }

    public void disableBusNewInstLayoutFlds() {
        getNewInstCmdLnk().setVisible(true);
        getNewInstOpLbl().setVisible(false);
        getNewInstPnlFrm().setVisible(false);
    }

    public void enableBusinessLayoutFlds() {
        getBusinessOutputLabel().setVisible(true);
        getBusinessAddressPnlGrp().setVisible(true);
    }

    public void disableBusinessLayoutFlds() {
        getBusinessOutputLabel().setVisible(false);
        getBusinessAddressPnlGrp().setVisible(false);
    }

    public void enableHomeLayoutFlds() {
        getHomeOutputLabel().setVisible(true);
        getHomeAddressPnlGrp().setVisible(true);

    }

    public void disableHomeLayoutFlds() {
        getHomeOutputLabel().setVisible(false);
        getHomeAddressPnlGrp().setVisible(false);

    }

    public void countryPartySelOneChoValueChangeListener(ValueChangeEvent valueChangeEvent) {

        floridaFlds();
        if (valueChangeEvent.getNewValue() != null && valueChangeEvent.getNewValue().equals("US")) {
            getStatesAUPartySelOneCho().setValue("");
            getStatesCAPartySelOneCho().setValue("");
            getStatesOthersPartyIpTx().setValue("");
        } else if (valueChangeEvent.getNewValue() != null && valueChangeEvent.getNewValue().equals("AU")) {
            getStatesUSPartySelOneCho().setValue("");
            getStatesCAPartySelOneCho().setValue("");
            getStatesOthersPartyIpTx().setValue("");

        } else if (valueChangeEvent.getNewValue() != null && valueChangeEvent.getNewValue().equals("CA")) {
            getStatesUSPartySelOneCho().setValue("");
            getStatesAUPartySelOneCho().setValue("");
            getStatesOthersPartyIpTx().setValue("");
        } else if (valueChangeEvent.getNewValue() != null && !valueChangeEvent.getNewValue().equals("US")
                && !valueChangeEvent.getNewValue().equals("AU") && !valueChangeEvent.getNewValue().equals("CA")) {
            getStatesUSPartySelOneCho().setValue("");
            getStatesAUPartySelOneCho().setValue("");
            getStatesCAPartySelOneCho().setValue("");

        }
    }

    public void countryHomeSelOneChoValueChangeListener(ValueChangeEvent valueChangeEvent) {

        floridaFlds();
        if (valueChangeEvent.getNewValue() != null && valueChangeEvent.getNewValue().equals("US")) {
            getStatesAUHomeSelOneCho().setValue("");
            getStatesCAHomeSelOneCho().setValue("");
            getStatesOtherHomeIpTx().setValue("");
        } else if (valueChangeEvent.getNewValue() != null && valueChangeEvent.getNewValue().equals("AU")) {
            getStatesUSHomeSelOneCho().setValue("");
            getStatesCAHomeSelOneCho().setValue("");
            getStatesOtherHomeIpTx().setValue("");
        } else if (valueChangeEvent.getNewValue() != null && valueChangeEvent.getNewValue().equals("CA")) {
            getStatesUSHomeSelOneCho().setValue("");
            getStatesAUHomeSelOneCho().setValue("");
            getStatesOtherHomeIpTx().setValue("");
        } else if (valueChangeEvent.getNewValue() != null && !valueChangeEvent.getNewValue().equals("US")
                && !valueChangeEvent.getNewValue().equals("AU") && !valueChangeEvent.getNewValue().equals("CA")) {
            getStatesUSHomeSelOneCho().setValue("");
            getStatesAUHomeSelOneCho().setValue("");
            getStatesCAHomeSelOneCho().setValue("");
        }
    }

    public void countryNewInstSelOneChoValueChangeListener(ValueChangeEvent valueChangeEvent) {

        floridaFlds();
        if (valueChangeEvent.getNewValue() != null && valueChangeEvent.getNewValue().equals("US")) {
            getStatesAUNewInstSelOneCho().setValue("");
            getStatesCANewInstSelOneCho().setValue("");
            getStatesOtherNewInstIpTx().setValue("");
        } else if (valueChangeEvent.getNewValue() != null && valueChangeEvent.getNewValue().equals("AU")) {
            getStatesUSNewInstSelOneCho().setValue("");
            getStatesCANewInstSelOneCho().setValue("");
            getStatesOtherNewInstIpTx().setValue("");
        } else if (valueChangeEvent.getNewValue() != null && valueChangeEvent.getNewValue().equals("CA")) {
            getStatesUSNewInstSelOneCho().setValue("");
            getStatesAUNewInstSelOneCho().setValue("");
            getStatesOtherNewInstIpTx().setValue("");
        } else if (valueChangeEvent.getNewValue() != null && !valueChangeEvent.getNewValue().equals("US")
                && !valueChangeEvent.getNewValue().equals("AU") && !valueChangeEvent.getNewValue().equals("CA")) {
            getStatesUSNewInstSelOneCho().setValue("");
            getStatesAUNewInstSelOneCho().setValue("");
            getStatesCANewInstSelOneCho().setValue("");
        }
    }

    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 {

            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;
    }

    public String validatePartyFax() {

        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) getFaxPartyIpTx().getValue());
        Matcher m2 = p2.matcher((String) getFaxPartyIpTx().getValue());

        try {
            if (getCountryPartySelOneCho() != null && (getCountryPartySelOneCho().getValue().equals("US")
                    || getCountryPartySelOneCho().getValue().equals("CA"))) {
                if (!m1.find() && !m2.find()) {
                    message.setDetail(resourceBundle.getString("FAX_FORMAT"));
                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                    context.addMessage(getFaxPartyIpTx().getClientId(context), message);
                    status = "failure";
                }
            }

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

    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 {
            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;
    }

    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 {
            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;
    }

    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 {
            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;
    }

    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 {

            if (getCountryHomeSelOneCho() != null && (getCountryHomeSelOneCho().getValue().equals("US")
                    || getCountryHomeSelOneCho().getValue().equals("CA"))) {
                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;
    }

    public void lovLaunch(LaunchPopupEvent launchPopupEvent) {
        RichInputListOfValues inputListOfValues = (RichInputListOfValues) launchPopupEvent.getComponent();
        if (inputListOfValues != null) {
            FacesContext facesContext = FacesContext.getCurrentInstance();
            String clientId = inputListOfValues.getClientId(facesContext);
            StringBuffer scriptBuffer = new StringBuffer();
            scriptBuffer.append(
                    " var docComp = AdfPage.PAGE.findComponent(\"f1\"); var comp = AdfPage.PAGE.findComponent(\"");
            scriptBuffer.append(clientId).append("\");  ");
            scriptBuffer.append(" if (comp != null && docComp != null) { var CompId = comp.getId(); ");
            scriptBuffer.append(" AdfCustomEvent.queue(docComp,\"lovafterlaunch\",{compId:CompId},true);}");
            String script = scriptBuffer.toString();
            ExtendedRenderKitService erks = Service.getService(facesContext.getRenderKit(),
                    ExtendedRenderKitService.class);
            erks.addScript(facesContext, script);
        }
        // Add event code here...
    }

    public void lovAfterLaunch(ClientEvent clientEvent) {
        if (clientEvent.getParameters().size() > 0 && clientEvent.getParameters().get("compId") != null) {
            String compId = clientEvent.getParameters().get("compId").toString();
            RichInputListOfValues inputListOfValues = (RichInputListOfValues) JSFUtils.findComponentInRoot(compId);
            if (inputListOfValues != null) {
                Iterator<String> facetNames = inputListOfValues.getFacetNames();
                RichPopup richPopup = null;
                String facetName = null;
                UIComponent componentFacet = null;
                UIComponent componentdialog = null;
                while (facetNames.hasNext()) {
                    facetName = facetNames.next();
                    if (facetName != null) {
                        componentFacet = inputListOfValues.getFacet(facetName);
                        if (componentFacet != null && componentFacet instanceof RichPopup) {
                            richPopup = (RichPopup) componentFacet;
                            break;
                        }
                    }
                }
                if (richPopup != null) {
                    List<UIComponent> uiCompList = richPopup.getChildren();
                    if (uiCompList.size() > 0) {
                        componentdialog = uiCompList.get(0);
                        if (componentdialog != null && componentdialog instanceof RichDialog) {
                            RichDialog richDialog = (RichDialog) componentdialog;
                            if (richDialog != null) {
                                /*  richDialog.setAffirmativeTextAndAccessKey("&OK");
                                  richDialog.setCancelTextAndAccessKey("&Cancel");  */

                                AdfFacesContext.getCurrentInstance().addPartialTarget(richDialog);
                                if (richDialog.getChildCount() == 1 && richDialog.getChildren().get(0) != null
                                        && richDialog.getChildren().get(0) instanceof RichPanelGroupLayout) {
                                    RichPanelGroupLayout panelGroupLayout = (RichPanelGroupLayout) richDialog
                                            .getChildren().get(0);
                                    uiCompList = panelGroupLayout.getChildren();
                                    if (uiCompList.size() > 0 && uiCompList.get(0) != null
                                            && uiCompList.get(0) instanceof RichPanelHeader) {
                                        RichPanelHeader richPanelHeader = (RichPanelHeader) uiCompList.get(0);
                                        if (richPanelHeader.getChildCount() == 1
                                                && richPanelHeader.getChildren().get(0) != null
                                                && richPanelHeader.getChildren().get(0) instanceof RichQuery) {
                                            RichQuery richQuery = (RichQuery) richPanelHeader.getChildren().get(0);
                                            if (richQuery != null) {
                                                richQuery.setModeChangeVisible(false);
                                                richQuery.setHeaderText(
                                                        "Providing your CAP# /CLIA# will ensure that you are affiliated with the correct existing institution");

                                                AdfFacesContext.getCurrentInstance().addPartialTarget(richQuery);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    public void floridaLicenseActionListener(ActionEvent actionEvent) {
        getLicensePnlGrp().setVisible(true);
        getFloridaLicenseCmdImgLnk().setVisible(false);
        getFloridaLicenseImgLbl().setVisible(true);

    }

    public void setLicensePnlGrp(RichPanelGroupLayout licensePnlGrp) {
        this.licensePnlGrp = licensePnlGrp;
    }

    public RichPanelGroupLayout getLicensePnlGrp() {
        return licensePnlGrp;
    }

    public void setLicenseNumberIpTx(RichInputText licenseNumberIpTx) {
        this.licenseNumberIpTx = licenseNumberIpTx;
    }

    public RichInputText getLicenseNumberIpTx() {
        return licenseNumberIpTx;
    }

    public void setFloridaLicensePnlGrp(RichPanelGroupLayout floridaLicensePnlGrp) {
        this.floridaLicensePnlGrp = floridaLicensePnlGrp;
    }

    public RichPanelGroupLayout getFloridaLicensePnlGrp() {
        return floridaLicensePnlGrp;
    }

    public void stateUSPartySelOneChoValueChangeListener(ValueChangeEvent valueChangeEvent) {
        floridaFlds();
    }

    public void statesUSNewInstSelOneChoValueChangeListener(ValueChangeEvent valueChangeEvent) {

        floridaFlds();
    }

    public void statesUSHomeSelOneChoValueChangeListener(ValueChangeEvent valueChangeEvent) {
        floridaFlds();
    }

    public void setFloridaLicenseCmdImgLnk(RichCommandImageLink floridaLicenseCmdImgLnk) {
        this.floridaLicenseCmdImgLnk = floridaLicenseCmdImgLnk;
    }

    public RichCommandImageLink getFloridaLicenseCmdImgLnk() {
        return floridaLicenseCmdImgLnk;
    }

    public void setFloridaLicenseImgLbl(RichImage floridaLicenseImgLbl) {
        this.floridaLicenseImgLbl = floridaLicenseImgLbl;
    }

    public RichImage getFloridaLicenseImgLbl() {
        return floridaLicenseImgLbl;
    }

    public void setCredentials(String selectedCredentials) {
        //   System.out.println("I am inside set Credentials");
        DCBindingContainer bindings = (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();
        //   System.out.println("selectedCredentials in contactdetails "+selectedCredentials);
        if (selectedCredentials != null) {
            //  selectedCredentials = selectedCredentials+",";
            DCIteratorBinding credIter = bindings.findIteratorBinding("CredentialIterator");
            ViewObject voCred = credIter.getViewObject();
            OperationBinding opBindingCredRow = bindings.getOperationBinding("CreateCredentialRow");
            opBindingCredRow.execute();

            ArrayList<String> items = new ArrayList<String>(
                    Arrays.asList(selectedCredentials.substring(1, selectedCredentials.length() - 1).split(",")));
            if (items != null) {
                voCred.executeQuery();
                for (int i = 0; i < items.size(); i++) {
                    //   System.out.println("items.get(i) "+items.get(i));
                    voCred.createRow().setAttribute("Value", items.get(i).trim());
                }
            }
        }
    }

    public PhoneValues phoneDetails(String country, String number) {
        System.out.println("Inside phoneDetails");
        DCBindingContainer bindings = (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();
        JUCtrlAttrsBinding phoneNumberInPut = (JUCtrlAttrsBinding) bindings.findNamedObject("phoneNumber");
        JUCtrlAttrsBinding countryInPut = (JUCtrlAttrsBinding) bindings.findNamedObject("country");
        JUCtrlAttrsBinding returnValue = (JUCtrlAttrsBinding) bindings.findNamedObject("return");
        phoneNumberInPut.setAttribute("getPhoneDetails_phoneNumber", number);
        countryInPut.setAttribute("getPhoneDetails_country", country);
        OperationBinding opBindingPhoneAPI = bindings.getOperationBinding("getPhoneDetails");
        opBindingPhoneAPI.execute();
        PhoneValues values = new PhoneValues();
        values = (PhoneValues) returnValue.getAttribute("getPhoneDetails_return");

        if (values != null) {
            System.out.println("areacode is " + values.getPhoneAreaCode());
            System.out.println("number is " + values.getPhoneNumber());
            System.out.println("countryCode is " + values.getPhoneCountryCode());
            System.out.println("formattedNumber is " + values.getFormattedPhoneNumber());
        }
        return values;
    }

}