com.ibm.commerce.user.beans

Class AddressBookDataBean

  • All Implemented Interfaces:
    DataBean, InputDataBean, SmartDataBean, Delegator, com.ibm.commerce.user.beans.AddressBookInputDataBean, com.ibm.commerce.user.beans.AddressBookSmartDataBean, java.io.Serializable


    public class AddressBookDataBean
    extends AddressBookAccessBean
    implements com.ibm.commerce.user.beans.AddressBookInputDataBean, com.ibm.commerce.user.beans.AddressBookSmartDataBean, Delegator
    The bean representing the address book information of a member.

    The AddressBookAccessBean will automatically get userId from commandContext. Users can use the getAddressList() method to get a list of all the addresses that belong to this user. The getAddressBookProperties() method returns a hashtable containing the information in the AddressBook property file.

    Usage:
    1. The first thing that you need to do is instantiate the object.
              For example: 
       
                      AddressBookDataBean dbAddressBook = new AddressBookDataBean();
                      dbAddressBook.setCommandContext(commandContext);
                      
                      // optional
                      dbAddressBook.setMemberId(strMemberId);
                              OR
                      dbAddressBook.setUserId(strUserId);
       
      Note that the setMemberId()/setUserId() method will always override the userId in the command context.
    2. Once the object has been initialized, you can use it to get the list of AddressDataBeans. Or you can invoke the populate method to get the list of addressId/nickname pairs.
              example: to get the list of AddressDataBeans for this member
       
                      AddressDataBean[] arrAddressBeans = 
                              dbAddressBook.getAddressDataBeansList();
       
              example: to get the list of addressId/nickname pairs
       
                      dbAddressBook.populate();
                      String[][] arrAddressList = 
                              dbAddressBook.getAddressList();
       
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

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

        public static final java.lang.String CLASSNAME
        The fully qualified name of this class.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AddressBookDataBean

        public AddressBookDataBean()
        AddressBookDataBean default constructor.
    • Method Detail

      • getAddressAccessBeans

        public java.util.Enumeration getAddressAccessBeans()
        Gets an Enumeration of all AddressAccessBeans belonging to this member.
        Specified by:
        getAddressAccessBeans in interface com.ibm.commerce.user.beans.AddressBookSmartDataBean
        Returns:
        An enumeration of all AddresseAccessBeans belonging to this member.
      • getAddressList

        public java.lang.String[][] getAddressList()
        Returns a two dimensional array which contains all addresses belonging to this member.
        First column of the array: Address Ids
        Second column of the array: Address Nicknames + address type + * (if this address is primary)
        Specified by:
        getAddressList in interface com.ibm.commerce.user.beans.AddressBookSmartDataBean
        Returns:
        String[][] Address list array
      • getCommandContext

        public CommandContext getCommandContext()
        Returns the command's context within this bean.
        Specified by:
        getCommandContext in interface SmartDataBean
        Returns:
        com.ibm.commerce.command.CommandContext
      • getDelegate

        public Protectable getDelegate()
        Returns the Protectable object whose access control policies will indirectly control the access control for this object
        Specified by:
        getDelegate in interface Delegator
        Returns:
        The Protectable object whose access control policies will indirectly control the access control for this object
        Throws:
        java.lang.Exception
      • getStoreDirectory

        public java.lang.String getStoreDirectory()
        Gets the name of the store directory, which is used in the getUserRegistrationProperties() method for the path to the property file.
        Specified by:
        getStoreDirectory in interface com.ibm.commerce.user.beans.AddressBookSmartDataBean
        Returns:
        The name of the store directory
      • populate

        public void populate()
        Fetches and populates information needed by the bean. Before invoking this method, ensure that the setCommandContext() method is invoked. If you want to override the memberId from the command context, set it using the setMemberId() or setUserId() methods. After executing this method, the getAddressList() method will be populated.
        Specified by:
        populate in interface SmartDataBean
        Throws:
        java.lang.Exception - Any exception thrown during the populating of the bean
      • setCommandContext

        public void setCommandContext(CommandContext acommandContext)
        Sets the command context.
        Specified by:
        setCommandContext in interface SmartDataBean
        Parameters:
        aCommandContext - The command context.
      • setMemberId

        public void setMemberId(java.lang.Long anMemberId)
        Sets the MemberId. If the MemberId is not set, it will be fetched from the Command Context.
        Overrides:
        setMemberId in class AddressBookAccessBean
        Parameters:
        anMemberId - The member Id
      • setMemberId

        public void setMemberId(java.lang.String astrMemberId)
        Sets the MemberId. If the MemberId is not set, it will be fetched from the Command Context.
        Overrides:
        setMemberId in class AddressBookAccessBean
        Parameters:
        astrMemberId - The member Id
      • setRequestProperties

        public void setRequestProperties(TypedProperty requestProperties)
        Sets the request properties.
        Specified by:
        setRequestProperties in interface InputDataBean
        Parameters:
        requestProperties - The request properties.
      • setStoreDirectory

        public void setStoreDirectory(java.lang.String astrStoreDirectory)
        Sets the name of store directory, which is used as the path to the find the property file in the getAddressBookProperties() method.
        Specified by:
        setStoreDirectory in interface com.ibm.commerce.user.beans.AddressBookInputDataBean
        Parameters:
        astrStoreDirectory - The name of store directory
      • setUserId

        public void setUserId(java.lang.Long anUserId)
        Sets the UserId. If the UserId is not set, it will be fetched from the Command Context.
        Specified by:
        setUserId in interface com.ibm.commerce.user.beans.AddressBookInputDataBean
        Parameters:
        anUserId - The User Id
      • setUserId

        public void setUserId(java.lang.String astrUserId)
        Sets the UserId. If the UserId is not set, it will be fetched from the Command Context.
        Specified by:
        setUserId in interface com.ibm.commerce.user.beans.AddressBookInputDataBean
        Parameters:
        astrUserId - The User Id
      • getAddressAccessBeansList

        public AddressAccessBean[] getAddressAccessBeansList()
        Returns an AddressAccessBean array which contains all AddressAccessbeans belonging to this member.
        Specified by:
        getAddressAccessBeansList in interface com.ibm.commerce.user.beans.AddressBookSmartDataBean
        Returns:
        AddressAccessBean[] An Address AccessBean array which contains all Address AccessBeans belong to this member.
      • getAddressDataBeansList

        public AddressDataBean[] getAddressDataBeansList()
        Returns an AddressDataBeanarray which contains all AddressDatabeans that belong to this member.
        Returns:
        AddressDataBean[] An Address DataBean array which contains all Address Databeans belonging to this customer. Returns empty array if no addresses were found.
      • getNumberOfAddresses

        public int getNumberOfAddresses()
        Returns the number of addresses in the address book
        Returns:
        int the number of addresses in the address book