com.ibm.commerce.user.beans

Class CountryStateListDataBean

  • java.lang.Object
    • com.ibm.commerce.user.beans.CountryStateListDataBean
  • All Implemented Interfaces:
    DataBean, InputDataBean, SmartDataBean, Delegator, java.io.Serializable


    public class CountryStateListDataBean
    extends java.lang.Object
    implements SmartDataBean, Delegator
    This bean gets a complete list of countries and regions and their corresponding states or provinces as defined in the COUNTRY and STATEPROV tables. The results are sorted correctly for the language in the command context. There are several usages to this bean: 1) Get all countries or regions and their corresponding states or provinces. This, option requires that the command context be set, and the request properties to populate the bean. 2) In addition to #1, you can also get the states or provinces for a specific country or region. Use the getStates(countryCode) utility method to get the states or provinces for any country or region. 3) Optionally, before populating the bean, you can also set the countryCode and then call the getCountryCodeStates() for the list of states or provinces for a specific country or region. 4) A new usage is to obtain the display name of a country and the display name of a state that is in the country. Before populating the bean, you can set the countryCode and also the stateCode; and then call the getSelectedCountryDisplayName() to obtain the display name of the country and the getSelectedCountryStateDisplayName() to obtain the display name of the state. 5) Another new usage is to obtain the display name of a state. You can set the stateCode and then call the getSelectedCountryStateDisplayName() to obtain the display name of the state.
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CountryStateListDataBean

        public CountryStateListDataBean()
    • Method Detail

      • getCountries

        public java.util.Vector getCountries()
        Returns the list of countries or regions.
        Returns:
        The list of countries or regions.
      • getCountryCode

        public java.lang.String getCountryCode()
        The country or region code set in the data bean.
        Returns:
        The country or region code.
      • getStateCode

        public java.lang.String getStateCode()
        The state or province code set in the data bean.
        Returns:
        The state or province code.
      • getCountryCodeStates

        public CountryStateListDataBean.StateProvince[] getCountryCodeStates()
        Returns the list of states or provinces for the specified country or region code set in the databean.
        Returns:
        The array of states or provinces.
      • getStates

        public CountryStateListDataBean.StateProvince[] getStates(java.lang.String countryCode)
        Returns the list of states or provinces for the specified country or region code.
        Parameters:
        countryCode - The country or region code.
        Returns:
        The array of states.
      • getSelectedCountryDisplayName

        public java.lang.String getSelectedCountryDisplayName()
        Returns the display name for the specified country or region code set in the databean.
        Returns:
        The display name of the selected country.
      • getSelectedCountryStateDisplayName

        public java.lang.String getSelectedCountryStateDisplayName()
        Returns the display name for the specified state or province code set in the databean. When both country or region and state or province codes are set, the logic assumes the state specified must exist within the specified country. When only the state or province code is set, the logic loops through all states to find a match of the state specified.
        Returns:
        The display name of the selected state.
      • populate

        public void populate()
                      throws java.lang.Exception
        Retrieve the countries or regions and their states. Sorts them in the correct language.
        Specified by:
        populate in interface SmartDataBean
        Throws:
        java.lang.Exception - The exception that occurs during execution.
      • setCountryCode

        public void setCountryCode(java.lang.String inCode)
        Sets the country or region code to be used to retrieve the states or provinces, or to retrieve the country display name.
        Parameters:
        inCode - the country or region code for which the states or provinces, or the country display name are/is returned.
      • setStateCode

        public void setStateCode(java.lang.String inCode)
        Sets the state or province code to be used to retrieve the state display name.
        Parameters:
        inCode - the state or province code for which the state display name is returned.
      • getDelegate

        public Protectable getDelegate()
                                throws java.lang.Exception
        Retrieves its delegate.
        Specified by:
        getDelegate in interface Delegator
        Returns:
        Protectable
        Throws:
        java.lang.Exception