Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.webapps.bean
Class Address  view Address download Address.java

java.lang.Object
  extended bycom.RuntimeCollective.webapps.bean.Address
All Implemented Interfaces:
EntityBean, java.io.Serializable

public class Address
extends java.lang.Object
implements EntityBean

An address. Each user may have many different addresses associated with them -- billing address, home address, etc -- each of which may have a different name and nationality. These attributes typically default to the name and nationality of the user, but may be changed.

Version:
$Id: Address.java,v 1.7 2003/09/30 15:13:09 joe Exp $

Field Summary
protected  java.lang.String address1
          Address line 1.
protected  java.lang.String address2
          Address line 2.
protected  java.lang.String address3
          Address line 3.
protected  java.lang.String city
          City.
protected  java.lang.String country
          Two letter ISO country code.
static java.lang.String DATABASE_TABLE
           
protected  java.lang.String email
          Email.
protected  java.lang.String firstName
          First name
protected  int id
          ID
protected  java.lang.String lastName
          Last name
protected  java.lang.String nationality
          Two letter ISO nationality code.
private static java.lang.String ORDER_BY_ID
           
protected  java.lang.String phoneArea
          The area code of the user's phone number.
protected  java.lang.String phoneCountry
          The country code of the user's phone number.
protected  java.lang.String phoneNumber
          The user's local phone number.
protected  java.lang.String postcode
          Post code.
private static java.lang.String SELECT_ID_FROM
           
protected  java.lang.String state
          State.
private static java.lang.String WHERE_FIRSTNAME
           
 
Fields inherited from interface com.RuntimeCollective.webapps.bean.EntityBean
INTERFACE_BEAN, NULL_ID
 
Constructor Summary
Address()
          Default constructor generates a new blank bean with a new unique ID.
Address(int id)
          Generate a bean from the database for the given primary key.
 
Method Summary
 void delete()
          Delete this bean from the database.
static java.util.List dirtyGetUserAddresses(User user)
          Get all the addresses of a given User.
 java.lang.String getAddress1()
          Get the user's address line 1.
 java.lang.String getAddress2()
          Get the user's address line 2.
 java.lang.String getAddress3()
          Get the user's address line 3.
 java.lang.String getCity()
          Get the user's city.
 java.lang.String getCountry()
          Get the user's country code for country of residence.
 java.lang.String getEmail()
          Get the user's email.
 java.lang.String getFirstName()
          Get first name
 int getId()
          Get the address's ID.
 java.lang.String getLastName()
          Get last name
 java.lang.String getNationality()
          Get the user's nationality code.
 java.lang.String getPhoneArea()
          Get the area code of the user's phone number.
 java.lang.String getPhoneCountry()
          Get the country code of the user's phone number.
 java.lang.String getPhoneNumber()
          Get the user's local phone number.
 java.lang.String getPostcode()
          Get the user's post code.
 java.lang.String getState()
          Get the user's state.
 void save()
          Save this bean to the database.
 void setAddress1(java.lang.String address1)
          Set the user's address line 1.
 void setAddress2(java.lang.String address2)
          Set the user's address line 2.
 void setAddress3(java.lang.String address3)
          Set the user's address line 3.
 void setCity(java.lang.String city)
          Set the user's city.
 void setCountry(java.lang.String country)
          Set the user's country of residence code.
 void setEmail(java.lang.String email)
          Set the user's email.
 void setFirstName(java.lang.String firstName)
          Set first name
 void setId(int id)
          Set the address's ID.
 void setLastName(java.lang.String lastName)
          Set last name
 void setNationality(java.lang.String nationality)
          Set the user's nationality code.
 void setPhoneArea(java.lang.String phoneArea)
          Set the area code of the user's phone number.
 void setPhoneCountry(java.lang.String phoneCountry)
          Set the country code of the user's phone number.
 void setPhoneNumber(java.lang.String phoneNumber)
          Set the user's local phone number.
 void setPostcode(java.lang.String postcode)
          Set the user's post code.
 void setState(java.lang.String state)
          Set the user's state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATABASE_TABLE

public static java.lang.String DATABASE_TABLE

id

protected int id
ID


email

protected java.lang.String email
Email.


firstName

protected java.lang.String firstName
First name


lastName

protected java.lang.String lastName
Last name


address1

protected java.lang.String address1
Address line 1.


address2

protected java.lang.String address2
Address line 2.


address3

protected java.lang.String address3
Address line 3.


city

protected java.lang.String city
City.


state

protected java.lang.String state
State.


postcode

protected java.lang.String postcode
Post code.


phoneCountry

protected java.lang.String phoneCountry
The country code of the user's phone number.


phoneArea

protected java.lang.String phoneArea
The area code of the user's phone number.


phoneNumber

protected java.lang.String phoneNumber
The user's local phone number.


country

protected java.lang.String country
Two letter ISO country code.


nationality

protected java.lang.String nationality
Two letter ISO nationality code.


SELECT_ID_FROM

private static final java.lang.String SELECT_ID_FROM
See Also:
Constant Field Values

WHERE_FIRSTNAME

private static final java.lang.String WHERE_FIRSTNAME
See Also:
Constant Field Values

ORDER_BY_ID

private static final java.lang.String ORDER_BY_ID
See Also:
Constant Field Values
Constructor Detail

Address

public Address()
        throws java.sql.SQLException
Default constructor generates a new blank bean with a new unique ID.


Address

public Address(int id)
        throws java.sql.SQLException
Generate a bean from the database for the given primary key.

Method Detail

save

public void save()
          throws java.sql.SQLException
Save this bean to the database.

Specified by:
save in interface EntityBean

delete

public void delete()
            throws java.sql.SQLException
Delete this bean from the database.

Specified by:
delete in interface EntityBean

getId

public int getId()
Get the address's ID.

Specified by:
getId in interface EntityBean

setId

public void setId(int id)
Set the address's ID.

Specified by:
setId in interface EntityBean

getEmail

public java.lang.String getEmail()
Get the user's email.


setEmail

public void setEmail(java.lang.String email)
Set the user's email.


getFirstName

public java.lang.String getFirstName()
Get first name


setFirstName

public void setFirstName(java.lang.String firstName)
Set first name


getLastName

public java.lang.String getLastName()
Get last name


setLastName

public void setLastName(java.lang.String lastName)
Set last name


getAddress1

public java.lang.String getAddress1()
Get the user's address line 1.


setAddress1

public void setAddress1(java.lang.String address1)
Set the user's address line 1.


getAddress2

public java.lang.String getAddress2()
Get the user's address line 2.


setAddress2

public void setAddress2(java.lang.String address2)
Set the user's address line 2.


getAddress3

public java.lang.String getAddress3()
Get the user's address line 3.


setAddress3

public void setAddress3(java.lang.String address3)
Set the user's address line 3.


getCity

public java.lang.String getCity()
Get the user's city.


setCity

public void setCity(java.lang.String city)
Set the user's city.


getState

public java.lang.String getState()
Get the user's state.


setState

public void setState(java.lang.String state)
Set the user's state.


getPostcode

public java.lang.String getPostcode()
Get the user's post code.


setPostcode

public void setPostcode(java.lang.String postcode)
Set the user's post code.


getPhoneCountry

public java.lang.String getPhoneCountry()
Get the country code of the user's phone number.


setPhoneCountry

public void setPhoneCountry(java.lang.String phoneCountry)
Set the country code of the user's phone number.


getPhoneArea

public java.lang.String getPhoneArea()
Get the area code of the user's phone number.


setPhoneArea

public void setPhoneArea(java.lang.String phoneArea)
Set the area code of the user's phone number.


getPhoneNumber

public java.lang.String getPhoneNumber()
Get the user's local phone number.


setPhoneNumber

public void setPhoneNumber(java.lang.String phoneNumber)
Set the user's local phone number.


getCountry

public java.lang.String getCountry()
Get the user's country code for country of residence.


setCountry

public void setCountry(java.lang.String country)
Set the user's country of residence code. This will also update the user's country name.


getNationality

public java.lang.String getNationality()
Get the user's nationality code.


setNationality

public void setNationality(java.lang.String nationality)
Set the user's nationality code. This will also update the user's nationality name.


dirtyGetUserAddresses

public static java.util.List dirtyGetUserAddresses(User user)
Get all the addresses of a given User. This is a dirty method which supposed that the firstname property of addresses stores the user's id. It is being used by the ecommerce module, to save time. Ecommerce also assumes that the lastname is used for the address' "alias". FIXME: this method shouldn't be use, set up a proper user-address one-to-many relationship.