edu.vt.middleware.ed
Class PhoneNumber

java.lang.Object
  extended by edu.vt.middleware.ed.AbstractDataObject
      extended by edu.vt.middleware.ed.AbstractMutableDataObject
          extended by edu.vt.middleware.ed.PhoneNumber
All Implemented Interfaces:
CarbonCopy<PhoneNumber>, Congruence<PhoneNumber>, DataObject, MutableDataObject, Persistable, Serializable, Comparable<DataObject>

public class PhoneNumber
extends AbstractMutableDataObject
implements Serializable, CarbonCopy<PhoneNumber>, Congruence<PhoneNumber>

Contains attributes that identify a phone number.

Version:
$Revision: 7963 $
Author:
Daniel Fisher
See Also:
Serialized Form

Field Summary
private  Address address
          address associated with phone number
private  String displayPhoneNumber
          display phone number
static String FIND_BY_ADDRESS_UID
          constant for named query
static String FIND_BY_ADDRESS_UID_AND_TYPE
          constant for named query
static String FIND_BY_PERSON_UID
          constant for named query
static String FIND_BY_PERSON_UID_AND_TYPE
          constant for named query
private static int LEN_AREACODE_PART
          length of phone area code prefix
private static int LEN_SUBSCRIBER_PART
          length of phone subscriber number
private static int LEN_US_PHONE
          length of standard US phone number
private  Person person
          person associated with phone number
private  String phoneNumber
          phone number
private  PhoneNumberType phoneNumberType
          phone number type
private static long serialVersionUID
          serial version UID
private  Boolean unlisted
          whether this address is unlisted
 
Fields inherited from class edu.vt.middleware.ed.AbstractMutableDataObject
modificationDate, modifiedBy
 
Fields inherited from class edu.vt.middleware.ed.AbstractDataObject
createdBy, creationDate, uid
 
Constructor Summary
PhoneNumber()
           
 
Method Summary
 void copyValues(PhoneNumber dataObject)
          Copies the non-relationship values from the supplied object into this object.
private  String formatDisplayPhone(String phone)
          Formats a phone number with no spaces into the following form:
(555) 555-1212
 Address getAddress()
          This returns the address associated with this phone number.
 String getDisplayPhoneNumber()
          This returns the display phone number.
 Person getPerson()
          This returns the person associated with this phone number.
 String getPhoneNumber()
          This returns the phone number.
 PhoneNumberType getPhoneNumberType()
          This returns the phone number type.
 Long getUid()
          This returns the uid.
 boolean isCongruent(PhoneNumber other)
          Determines whether the given object is congruent/equivalent to this object via equals comparison on properties.
 Boolean isUnlisted()
          This returns whether this phone number is unlisted.
 void setAddress(Address a)
          This sets the address associated with this phone number.
 void setPerson(Person p)
          This sets the person associated with this phone number.
 void setPhoneNumber(String s)
          This sets the phone number.
 void setPhoneNumberType(PhoneNumberType pnt)
          This sets the phone number type.
 void setUnlisted(Boolean b)
          This sets whether this phone number is unlisted.
 String toString()
          Returns a String representation of this phone number.
 
Methods inherited from class edu.vt.middleware.ed.AbstractMutableDataObject
getModificationDate, getModifiedBy, setModificationDate, setModifiedBy
 
Methods inherited from class edu.vt.middleware.ed.AbstractDataObject
compareTo, getCreatedBy, getCreationDate, setCreatedBy, setCreationDate, setUid, validateProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.vt.middleware.ed.DataObject
getCreatedBy, getCreationDate, setCreatedBy, setCreationDate, setUid
 

Field Detail

FIND_BY_PERSON_UID

public static final String FIND_BY_PERSON_UID
constant for named query

See Also:
Constant Field Values

FIND_BY_PERSON_UID_AND_TYPE

public static final String FIND_BY_PERSON_UID_AND_TYPE
constant for named query

See Also:
Constant Field Values

FIND_BY_ADDRESS_UID

public static final String FIND_BY_ADDRESS_UID
constant for named query

See Also:
Constant Field Values

FIND_BY_ADDRESS_UID_AND_TYPE

public static final String FIND_BY_ADDRESS_UID_AND_TYPE
constant for named query

See Also:
Constant Field Values

serialVersionUID

private static final long serialVersionUID
serial version UID

See Also:
Constant Field Values

LEN_AREACODE_PART

private static final int LEN_AREACODE_PART
length of phone area code prefix

See Also:
Constant Field Values

LEN_SUBSCRIBER_PART

private static final int LEN_SUBSCRIBER_PART
length of phone subscriber number

See Also:
Constant Field Values

LEN_US_PHONE

private static final int LEN_US_PHONE
length of standard US phone number

See Also:
Constant Field Values

phoneNumberType

private PhoneNumberType phoneNumberType
phone number type


phoneNumber

private String phoneNumber
phone number


displayPhoneNumber

private String displayPhoneNumber
display phone number


unlisted

private Boolean unlisted
whether this address is unlisted


address

private Address address
address associated with phone number


person

private Person person
person associated with phone number

Constructor Detail

PhoneNumber

public PhoneNumber()
Method Detail

getUid

public Long getUid()
This returns the uid.

Specified by:
getUid in interface DataObject
Overrides:
getUid in class AbstractDataObject
Returns:
Long - uid

getPhoneNumberType

public PhoneNumberType getPhoneNumberType()
This returns the phone number type.

Returns:
PhoneNumberType

setPhoneNumberType

public void setPhoneNumberType(PhoneNumberType pnt)
This sets the phone number type.

Parameters:
pnt - PhoneNumberType

getPhoneNumber

public String getPhoneNumber()
This returns the phone number.

Returns:
String

setPhoneNumber

public void setPhoneNumber(String s)
This sets the phone number.

Parameters:
s - String

getDisplayPhoneNumber

public String getDisplayPhoneNumber()
This returns the display phone number.

Returns:
String

isUnlisted

public Boolean isUnlisted()
This returns whether this phone number is unlisted.

Returns:
Boolean

setUnlisted

public void setUnlisted(Boolean b)
This sets whether this phone number is unlisted.

Parameters:
b - Boolean

getAddress

public Address getAddress()
This returns the address associated with this phone number.

Returns:
Address with this phone number

setAddress

public void setAddress(Address a)
This sets the address associated with this phone number.

Parameters:
a - Address with this phone number

getPerson

public Person getPerson()
This returns the person associated with this phone number.

Returns:
Person with this phone number

setPerson

public void setPerson(Person p)
This sets the person associated with this phone number.

Parameters:
p - Person with this phone number

copyValues

public void copyValues(PhoneNumber dataObject)
Copies the non-relationship values from the supplied object into this object.

Specified by:
copyValues in interface CarbonCopy<PhoneNumber>
Parameters:
dataObject - Source to copy from.

isCongruent

public boolean isCongruent(PhoneNumber other)
Determines whether the given object is congruent/equivalent to this object via equals comparison on properties.

Specified by:
isCongruent in interface Congruence<PhoneNumber>
Parameters:
other - The object to compare to this instance.
Returns:
True if the given object is congruent to this instance, false otherwise.

toString

public String toString()
Returns a String representation of this phone number.

Overrides:
toString in class AbstractDataObject
Returns:
String

formatDisplayPhone

private String formatDisplayPhone(String phone)
Formats a phone number with no spaces into the following form:
(555) 555-1212

Parameters:
phone - Phone number string with no spaces.
Returns:
A formatted phone number string.


Copyright © 2008 Virginia Tech. All Rights Reserved.