org.openmrs
Class PersonAddress

java.lang.Object
  extended by org.openmrs.BaseOpenmrsObject
      extended by org.openmrs.BaseOpenmrsData
          extended by org.openmrs.PersonAddress
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<PersonAddress>, Address, Auditable, OpenmrsData, OpenmrsObject, Voidable

public class PersonAddress
extends BaseOpenmrsData
implements java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<PersonAddress>, Address

This class is the representation of a person's address. This class is many-to-one to the Person class, so a Person/Patient/User can have zero to n addresses

See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Fields inherited from class org.openmrs.BaseOpenmrsData
creator
 
Constructor Summary
PersonAddress()
          default constructor
PersonAddress(java.lang.Integer personAddressId)
          constructor with id
 
Method Summary
 java.lang.Object clone()
          bitwise copy of the personAddress object.
 int compareTo(PersonAddress other)
           
 boolean equals(java.lang.Object obj)
          Compares this address to the given object/address for similarity.
 boolean equalsContent(PersonAddress otherAddress)
          Compares this PersonAddress object to the given otherAddress.
 java.lang.String getAddress1()
           
 java.lang.String getAddress2()
           
 java.lang.String getAddress3()
          Added for compatibility reasons with 1.8+
 java.lang.String getAddress4()
          Added for compatibility reasons with 1.8+
 java.lang.String getAddress5()
          Added for compatibility reasons with 1.8+
 java.lang.String getAddress6()
          Added for compatibility reasons with 1.8+
 java.lang.String getCityVillage()
           
 java.lang.String getCountry()
           
 java.lang.String getCountyDistrict()
           
 java.lang.Integer getId()
           
 java.lang.String getLatitude()
           
 java.lang.String getLongitude()
           
 java.lang.String getNeighborhoodCell()
           
 Person getPerson()
           
 java.lang.Integer getPersonAddressId()
           
 java.lang.String getPostalCode()
           
 java.lang.Boolean getPreferred()
           
 java.lang.String getRegion()
           
 java.lang.String getStateProvince()
           
 java.lang.String getSubregion()
           
 java.lang.String getTownshipDivision()
           
 int hashCode()
           
 boolean isBlank()
          Convenience method to test whether any of the fields in this address are set
 java.lang.Boolean isPreferred()
           
 void setAddress1(java.lang.String address1)
           
 void setAddress2(java.lang.String address2)
           
 void setAddress3(java.lang.String address3)
          Added for compatibility reasons with 1.8+
 void setAddress4(java.lang.String address4)
          Added for compatibility reasons with 1.8+
 void setAddress5(java.lang.String address5)
          Added for compatibility reasons with 1.8+
 void setAddress6(java.lang.String address6)
          Added for compatibility reasons with 1.8+
 void setCityVillage(java.lang.String cityVillage)
           
 void setCountry(java.lang.String country)
           
 void setCountyDistrict(java.lang.String countyDistrict)
           
 void setId(java.lang.Integer id)
           
 void setLatitude(java.lang.String latitude)
           
 void setLongitude(java.lang.String longitude)
           
 void setNeighborhoodCell(java.lang.String neighborhoodCell)
           
 void setPerson(Person person)
           
 void setPersonAddressId(java.lang.Integer personAddressId)
           
 void setPostalCode(java.lang.String postalCode)
           
 void setPreferred(java.lang.Boolean preferred)
           
 void setRegion(java.lang.String region)
           
 void setStateProvince(java.lang.String stateProvince)
           
 void setSubregion(java.lang.String subregion)
           
 void setTownshipDivision(java.lang.String townshipDivision)
           
 java.lang.String toString()
           
 
Methods inherited from class org.openmrs.BaseOpenmrsData
getChangedBy, getCreator, getDateChanged, getDateCreated, getDateVoided, getVoided, getVoidedBy, getVoidReason, isVoided, setChangedBy, setCreator, setDateChanged, setDateCreated, setDateVoided, setVoided, setVoidedBy, setVoidReason
 
Methods inherited from class org.openmrs.BaseOpenmrsObject
getUuid, setUuid
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openmrs.OpenmrsObject
getUuid, setUuid
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

PersonAddress

public PersonAddress()
default constructor


PersonAddress

public PersonAddress(java.lang.Integer personAddressId)
constructor with id

Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

equals

public boolean equals(java.lang.Object obj)
Compares this address to the given object/address for similarity. Uses the very basic comparison of just the PersonAddress.personAddressId

Overrides:
equals in class java.lang.Object
Parameters:
obj - Object (Usually PersonAddress) with which to compare
Returns:
boolean true/false whether or not they are the same objects
See Also:
Object.equals(java.lang.Object)

equalsContent

public boolean equalsContent(PersonAddress otherAddress)
Compares this PersonAddress object to the given otherAddress. This method differs from equals(Object) in that this method compares the inner fields of each address for equality. Note: Null/empty fields on otherAddress /will not/ cause a false value to be returned

Parameters:
otherAddress - PersonAddress with which to compare
Returns:
boolean true/false whether or not they are the same addresses

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

clone

public java.lang.Object clone()
bitwise copy of the personAddress object. NOTICE: THIS WILL NOT COPY THE PATIENT OBJECT. The PersonAddress.person object in this object AND the cloned object will point at the same person

Overrides:
clone in class java.lang.Object
Returns:
New PersonAddress object

getAddress1

public java.lang.String getAddress1()
Specified by:
getAddress1 in interface Address
Returns:
Returns the address1.

setAddress1

public void setAddress1(java.lang.String address1)
Specified by:
setAddress1 in interface Address
Parameters:
address1 - The address1 to set.

getAddress2

public java.lang.String getAddress2()
Specified by:
getAddress2 in interface Address
Returns:
Returns the address2.

setAddress2

public void setAddress2(java.lang.String address2)
Specified by:
setAddress2 in interface Address
Parameters:
address2 - The address2 to set.

getCityVillage

public java.lang.String getCityVillage()
Specified by:
getCityVillage in interface Address
Returns:
Returns the cityVillage.

setCityVillage

public void setCityVillage(java.lang.String cityVillage)
Specified by:
setCityVillage in interface Address
Parameters:
cityVillage - The cityVillage to set.

getCountry

public java.lang.String getCountry()
Specified by:
getCountry in interface Address
Returns:
Returns the country.

setCountry

public void setCountry(java.lang.String country)
Specified by:
setCountry in interface Address
Parameters:
country - The country to set.

isPreferred

public java.lang.Boolean isPreferred()
Returns:
Returns the preferred.

getPreferred

public java.lang.Boolean getPreferred()

setPreferred

public void setPreferred(java.lang.Boolean preferred)
Parameters:
preferred - The preferred to set.

getLatitude

public java.lang.String getLatitude()
Specified by:
getLatitude in interface Address
Returns:
Returns the latitude.

setLatitude

public void setLatitude(java.lang.String latitude)
Specified by:
setLatitude in interface Address
Parameters:
latitude - The latitude to set.

getLongitude

public java.lang.String getLongitude()
Specified by:
getLongitude in interface Address
Returns:
Returns the longitude.

setLongitude

public void setLongitude(java.lang.String longitude)
Specified by:
setLongitude in interface Address
Parameters:
longitude - The longitude to set.

getPerson

public Person getPerson()
Returns:
Returns the person.

setPerson

public void setPerson(Person person)
Parameters:
person - The person to set.

getPersonAddressId

public java.lang.Integer getPersonAddressId()
Returns:
Returns the personAddressId.

setPersonAddressId

public void setPersonAddressId(java.lang.Integer personAddressId)
Parameters:
personAddressId - The personAddressId to set.

getPostalCode

public java.lang.String getPostalCode()
Specified by:
getPostalCode in interface Address
Returns:
Returns the postalCode.

setPostalCode

public void setPostalCode(java.lang.String postalCode)
Specified by:
setPostalCode in interface Address
Parameters:
postalCode - The postalCode to set.

getStateProvince

public java.lang.String getStateProvince()
Specified by:
getStateProvince in interface Address
Returns:
Returns the stateProvince.

setStateProvince

public void setStateProvince(java.lang.String stateProvince)
Specified by:
setStateProvince in interface Address
Parameters:
stateProvince - The stateProvince to set.

getCountyDistrict

public java.lang.String getCountyDistrict()
Specified by:
getCountyDistrict in interface Address
Returns:
Returns the countyDistrict.

setCountyDistrict

public void setCountyDistrict(java.lang.String countyDistrict)
Specified by:
setCountyDistrict in interface Address
Parameters:
countyDistrict - The countyDistrict to set.

getNeighborhoodCell

public java.lang.String getNeighborhoodCell()
Returns:
Returns the neighborhoodCell.

setNeighborhoodCell

public void setNeighborhoodCell(java.lang.String neighborhoodCell)
Parameters:
neighborhoodCell - The neighborhoodCell to set.

isBlank

public boolean isBlank()
Convenience method to test whether any of the fields in this address are set

Returns:
whether any of the address fields (address1, address2, cityVillage, stateProvince, country, countyDistrict, neighborhoodCell, postalCode, latitude, longitude) are non-null

getRegion

public java.lang.String getRegion()
Returns:
the region

setRegion

public void setRegion(java.lang.String region)
Parameters:
region - the region to set

getSubregion

public java.lang.String getSubregion()
Returns:
the subregion

setSubregion

public void setSubregion(java.lang.String subregion)
Parameters:
subregion - the subregion to set

getTownshipDivision

public java.lang.String getTownshipDivision()
Returns:
the townshipDivision

setTownshipDivision

public void setTownshipDivision(java.lang.String townshipDivision)
Parameters:
townshipDivision - the townshipDivision to set

compareTo

public int compareTo(PersonAddress other)
Specified by:
compareTo in interface java.lang.Comparable<PersonAddress>
See Also:
Comparable.compareTo(java.lang.Object)

getId

public java.lang.Integer getId()
Specified by:
getId in interface OpenmrsObject
Returns:
id - The unique Identifier for the object
Since:
1.5
See Also:
OpenmrsObject.getId()

setId

public void setId(java.lang.Integer id)
Specified by:
setId in interface OpenmrsObject
Parameters:
id - - The unique Identifier for the object
Since:
1.5
See Also:
OpenmrsObject.setId(java.lang.Integer)

getAddress3

public java.lang.String getAddress3()
Added for compatibility reasons with 1.8+

Specified by:
getAddress3 in interface Address

setAddress3

public void setAddress3(java.lang.String address3)
Added for compatibility reasons with 1.8+

Specified by:
setAddress3 in interface Address

getAddress4

public java.lang.String getAddress4()
Added for compatibility reasons with 1.8+

Specified by:
getAddress4 in interface Address

setAddress4

public void setAddress4(java.lang.String address4)
Added for compatibility reasons with 1.8+

Specified by:
setAddress4 in interface Address

getAddress5

public java.lang.String getAddress5()
Added for compatibility reasons with 1.8+

Specified by:
getAddress5 in interface Address

setAddress5

public void setAddress5(java.lang.String address5)
Added for compatibility reasons with 1.8+

Specified by:
setAddress5 in interface Address

setAddress6

public void setAddress6(java.lang.String address6)
Added for compatibility reasons with 1.8+

Specified by:
setAddress6 in interface Address

getAddress6

public java.lang.String getAddress6()
Added for compatibility reasons with 1.8+

Specified by:
getAddress6 in interface Address

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change