org.openmrs
Class PersonName

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

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

A Person can have zero to n PersonName(s).

See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Fields inherited from class org.openmrs.BaseOpenmrsData
creator
 
Constructor Summary
PersonName()
          default constructor
PersonName(java.lang.Integer personNameId)
          constructor with id
PersonName(java.lang.String givenName, java.lang.String middleName, java.lang.String familyName)
          Convenience constructor with the basic requirements
 
Method Summary
 int compareTo(PersonName other)
          TODO: the behavior of this method needs to be controlled by some sort of global property because an implementation can define how they want their names to look (which fields to show/hide)
 boolean equals(java.lang.Object obj)
          Compares two objects for similarity
 boolean equalsContent(PersonName otherName)
          Compares this PersonName object to the given otherName.
 java.util.Date getDateVoided()
          This still exists on PersonName for the SimpleFramework annotation
 java.lang.String getDegree()
           
 java.lang.String getFamilyName()
           
 java.lang.String getFamilyName2()
           
 java.lang.String getFamilyNamePrefix()
           
 java.lang.String getFamilyNameSuffix()
           
 java.lang.String getFullName()
          Convenience method to get all the names of this PersonName and concatonating them together with spaces in between.
 java.lang.String getGivenName()
           
 java.lang.Integer getId()
           
 java.lang.String getMiddleName()
           
 Person getPerson()
           
 java.lang.Integer getPersonNameId()
           
 java.lang.Boolean getPreferred()
           
 java.lang.String getPrefix()
           
 java.lang.Boolean getVoided()
          This method delegates to BaseOpenmrsData.isVoided().
 User getVoidedBy()
          This still exists on PersonName for the SimpleFramework annotation
 java.lang.String getVoidReason()
          This still exists on PersonName for the SimpleFramework annotation
 int hashCode()
           
 java.lang.Boolean isPreferred()
           
static PersonName newInstance(PersonName pn)
          bitwise copy of the personName object.
 void setDateVoided(java.util.Date dateVoided)
           
 void setDegree(java.lang.String degree)
           
 void setFamilyName(java.lang.String familyName)
           
 void setFamilyName2(java.lang.String familyName2)
           
 void setFamilyNamePrefix(java.lang.String familyNamePrefix)
           
 void setFamilyNameSuffix(java.lang.String familyNameSuffix)
           
 void setGivenName(java.lang.String givenName)
           
 void setId(java.lang.Integer id)
           
 void setMiddleName(java.lang.String middleName)
           
 void setPerson(Person person)
           
 void setPersonNameId(java.lang.Integer personNameId)
           
 void setPreferred(java.lang.Boolean preferred)
           
 void setPrefix(java.lang.String prefix)
           
 void setVoided(java.lang.Boolean voided)
          This still exists on PersonName for the SimpleFramework annotation
 void setVoidedBy(User voidedBy)
          This still exists on PersonName for the SimpleFramework annotation
 void setVoidReason(java.lang.String voidReason)
          This still exists on PersonName for the SimpleFramework annotation
 java.lang.String toString()
           
 
Methods inherited from class org.openmrs.BaseOpenmrsData
getChangedBy, getCreator, getDateChanged, getDateCreated, isVoided, setChangedBy, setCreator, setDateChanged, setDateCreated
 
Methods inherited from class org.openmrs.BaseOpenmrsObject
getUuid, setUuid
 
Methods inherited from class java.lang.Object
clone, 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

PersonName

public PersonName()
default constructor


PersonName

public PersonName(java.lang.Integer personNameId)
constructor with id


PersonName

public PersonName(java.lang.String givenName,
                  java.lang.String middleName,
                  java.lang.String familyName)
Convenience constructor with the basic requirements

Parameters:
givenName - String this person's first name
middleName - String this person's middle name
familyName - String this person's last name
Method Detail

equals

public boolean equals(java.lang.Object obj)
Compares two objects for similarity

Overrides:
equals in class java.lang.Object
Parameters:
obj - PersonName to compare to
Returns:
boolean true/false whether or not they are the same objects
See Also:
Object.equals(java.lang.Object)
Expected behavior:
not fail if either has a null person property, return false if this has a missing person property, return false if obj has a missing person property, return true if properties are equal and have null person

hashCode

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

equalsContent

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

Parameters:
otherName - PersonName with which to compare
Returns:
boolean true/false whether or not they are the same names
Expected behavior:
return true if given middle and family name are equal

newInstance

public static PersonName newInstance(PersonName pn)
bitwise copy of the personName object. NOTICE: THIS WILL NOT COPY THE PATIENT OBJECT. The PersonName.person object in this object AND the cloned object will point at the same person

Returns:
New PersonName object
Expected behavior:
copy every property of given personName

getDateVoided

public java.util.Date getDateVoided()
This still exists on PersonName for the SimpleFramework annotation

Specified by:
getDateVoided in interface Voidable
Overrides:
getDateVoided in class BaseOpenmrsData
Returns:
Returns the dateVoided.
See Also:
Voidable.getDateVoided()

setDateVoided

public void setDateVoided(java.util.Date dateVoided)
Specified by:
setDateVoided in interface Voidable
Overrides:
setDateVoided in class BaseOpenmrsData
Parameters:
dateVoided - The dateVoided to set.
See Also:
Voidable.setDateVoided(java.util.Date)

getDegree

public java.lang.String getDegree()
Returns:
Returns the degree.

setDegree

public void setDegree(java.lang.String degree)
Parameters:
degree - The degree to set.

getFamilyName

public java.lang.String getFamilyName()
Returns:
Returns the familyName.
Expected behavior:
return obscured name if obscure_patients is set to true

setFamilyName

public void setFamilyName(java.lang.String familyName)
Parameters:
familyName - The familyName to set.

getFamilyName2

public java.lang.String getFamilyName2()
Returns:
Returns the familyName2.
Expected behavior:
return null if obscure_patients is set to true

setFamilyName2

public void setFamilyName2(java.lang.String familyName2)
Parameters:
familyName2 - The familyName2 to set.

getFamilyNamePrefix

public java.lang.String getFamilyNamePrefix()
Returns:
Returns the familyNamePrefix.
Expected behavior:
return null if obscure_patients is set to true

setFamilyNamePrefix

public void setFamilyNamePrefix(java.lang.String familyNamePrefix)
Parameters:
familyNamePrefix - The familyNamePrefix to set.

getFamilyNameSuffix

public java.lang.String getFamilyNameSuffix()
Returns:
Returns the familyNameSuffix.
Expected behavior:
return null if obscure_patients is set to true

setFamilyNameSuffix

public void setFamilyNameSuffix(java.lang.String familyNameSuffix)
Parameters:
familyNameSuffix - The familyNameSuffix to set.

getGivenName

public java.lang.String getGivenName()
Returns:
Returns the givenName.
Expected behavior:
return obscured name if obscure_patients is set to true

setGivenName

public void setGivenName(java.lang.String givenName)
Parameters:
givenName - The givenName to set.

getMiddleName

public java.lang.String getMiddleName()
Returns:
Returns the middleName.
Expected behavior:
return obscured name if obscure_patients is set to true

setMiddleName

public void setMiddleName(java.lang.String middleName)
Parameters:
middleName - The middleName to set.

getPerson

public Person getPerson()
Returns:
Returns the person.

setPerson

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

getPersonNameId

public java.lang.Integer getPersonNameId()
Returns:
Returns the personNameId.

setPersonNameId

public void setPersonNameId(java.lang.Integer personNameId)
Parameters:
personNameId - The personNameId 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.

getPrefix

public java.lang.String getPrefix()
Returns:
Returns the prefix.
Expected behavior:
return null if obscure_patients is set to true

setPrefix

public void setPrefix(java.lang.String prefix)
Parameters:
prefix - The prefix to set.

getVoided

public java.lang.Boolean getVoided()
Description copied from class: BaseOpenmrsData
This method delegates to BaseOpenmrsData.isVoided(). This is only needed for jstl syntax like ${person.voided} because the return type is a Boolean object instead of a boolean primitive type.

Overrides:
getVoided in class BaseOpenmrsData
See Also:
BaseOpenmrsData.isVoided()

setVoided

public void setVoided(java.lang.Boolean voided)
This still exists on PersonName for the SimpleFramework annotation

Specified by:
setVoided in interface Voidable
Overrides:
setVoided in class BaseOpenmrsData
Parameters:
voided - The voided to set.
See Also:
Voidable.setVoided(java.lang.Boolean)

getVoidedBy

public User getVoidedBy()
This still exists on PersonName for the SimpleFramework annotation

Specified by:
getVoidedBy in interface Voidable
Overrides:
getVoidedBy in class BaseOpenmrsData
Returns:
Returns the voidedBy.
See Also:
Voidable.getVoidedBy()

setVoidedBy

public void setVoidedBy(User voidedBy)
This still exists on PersonName for the SimpleFramework annotation

Specified by:
setVoidedBy in interface Voidable
Overrides:
setVoidedBy in class BaseOpenmrsData
Parameters:
voidedBy - The voidedBy to set.
See Also:
Voidable.setVoidedBy(org.openmrs.User)

getVoidReason

public java.lang.String getVoidReason()
This still exists on PersonName for the SimpleFramework annotation

Specified by:
getVoidReason in interface Voidable
Overrides:
getVoidReason in class BaseOpenmrsData
Returns:
Returns the voidReason.
See Also:
Voidable.getVoidReason()

setVoidReason

public void setVoidReason(java.lang.String voidReason)
This still exists on PersonName for the SimpleFramework annotation

Specified by:
setVoidReason in interface Voidable
Overrides:
setVoidReason in class BaseOpenmrsData
Parameters:
voidReason - The voidReason to set.
See Also:
Voidable.setVoidReason(java.lang.String)

getFullName

public java.lang.String getFullName()
Convenience method to get all the names of this PersonName and concatonating them together with spaces in between. If any part of getPrefix(), getGivenName(), getMiddleName(), etc are null, they are not included in the returned name

Returns:
all of the parts of this PersonName joined with spaces

toString

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

compareTo

public int compareTo(PersonName other)
TODO: the behavior of this method needs to be controlled by some sort of global property because an implementation can define how they want their names to look (which fields to show/hide)

Specified by:
compareTo in interface java.lang.Comparable<PersonName>
See Also:
Comparable.compareTo(java.lang.Object)
Expected behavior:
return negative if other name is voided, return negative if this name is preferred, return negative if other familyName is greater, return negative if other familyName2 is greater, return negative if other givenName is greater, return negative if other middleName is greater, return negative if other familynamePrefix is greater, return negative if other familyNameSuffix is greater, return negative if other dateCreated is greater

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)

OpenMRS-1.7.x

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