org.openmrs.api.impl
Class PersonServiceImpl

java.lang.Object
  extended by org.openmrs.api.impl.BaseOpenmrsService
      extended by org.openmrs.api.impl.PersonServiceImpl
All Implemented Interfaces:
OpenmrsService, PersonService

public class PersonServiceImpl
extends BaseOpenmrsService
implements PersonService

Default implementation of the PersonService

Which implementation to use is determined by Spring. See the spring application context file in /metadata/api/spring/applicatContext-service.xml

See Also:
PersonService, Context

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.openmrs.api.PersonService
PersonService.ATTR_VIEW_TYPE
 
Constructor Summary
PersonServiceImpl()
           
 
Method Summary
 Person createPerson(Person person)
          Deprecated. use savePerson(Person)
 void createPersonAttributeType(PersonAttributeType type)
          Deprecated. use savePersonAttributeType(PersonAttributeType)
 void createRelationship(Relationship relationship)
          Deprecated. use saveRelationship(Relationship)
 void createRelationshipType(RelationshipType relationshipType)
          Deprecated. use saveRelationshipType(RelationshipType)
 void deletePerson(Person person)
          Deprecated. use purgePerson(Person)
 void deletePersonAttributeType(java.lang.Integer attrTypeId)
          Deprecated. use purgePersonAttributeType(PersonAttributeType)
 void deletePersonAttributeType(PersonAttributeType type)
          Deprecated. use purgePersonAttributeType(PersonAttributeType)
 void deleteRelationship(Relationship relationship)
          Deprecated. use purgeRelationship(Relationship)
 void deleteRelationshipType(RelationshipType relationshipType)
          Deprecated. use purgeRelationshipType(RelationshipType)
 java.util.Set<Person> findPeople(java.lang.String searchPhrase, boolean includeVoided)
          Deprecated. use getPeople(String, Boolean)
 java.util.Set<Person> findPeople(java.lang.String searchPhrase, boolean includeVoided, java.util.List<java.lang.String> roles)
          Deprecated. use getPeople(String, Boolean)
 java.util.Set<Person> findPeople(java.lang.String searchPhrase, boolean includeVoided, java.lang.String roles)
          Deprecated. use getPeople(String, Boolean)
 RelationshipType findRelationshipType(java.lang.String relationshipTypeName)
          Deprecated. use getRelationshipTypeByName(String)
 java.util.List<PersonAttributeType> getAllPersonAttributeTypes()
          Get all PersonAttributeTypes in the database
 java.util.List<PersonAttributeType> getAllPersonAttributeTypes(boolean includeRetired)
          Get all PersonAttributeTypes in the database with the option of including the retired types
 java.util.List<Relationship> getAllRelationships()
          Get list of relationships that are not voided
 java.util.List<Relationship> getAllRelationships(boolean includeVoided)
          Get list of relationships optionally including the voided ones or not
 java.util.List<RelationshipType> getAllRelationshipTypes()
          Get all relationshipTypes Includes retired relationship types
 java.util.List<RelationshipType> getAllRelationshipTypes(boolean includeRetired)
          Get all relationshipTypes with the option of including the retired types
 java.util.List<Person> getPeople(java.lang.String searchPhrase, java.lang.Boolean dead)
          Find a person matching the searchPhrase search string
 Person getPerson(java.lang.Integer personId)
          Gets a person by internal id
 Person getPerson(Patient pat)
          Deprecated. use getPerson(Integer)
 Person getPerson(User user)
          Deprecated. use getPerson(Integer)
 PersonAddress getPersonAddressByUuid(java.lang.String uuid)
          Get PersonAddress by its UUID
 PersonAttribute getPersonAttribute(java.lang.Integer id)
          Get a PersonAttribute from the database with the given PersonAttributeid
 PersonAttribute getPersonAttributeByUuid(java.lang.String uuid)
          Get PersonAttribute by its UUID
 PersonAttributeType getPersonAttributeType(java.lang.Integer typeId)
          Get the PersonAttributeType given the type's PersonAttributeTypeId
 PersonAttributeType getPersonAttributeType(java.lang.String s)
          Deprecated. use getPersonAttributeTypeByName(String)
 PersonAttributeType getPersonAttributeTypeByName(java.lang.String typeName)
          Get the PersonAttributeType given the type's name
 PersonAttributeType getPersonAttributeTypeByUuid(java.lang.String uuid)
          Gets a person attribute type with the given uuid.
 java.util.List<PersonAttributeType> getPersonAttributeTypes()
          Deprecated. use getAllPersonAttributeTypes()
 java.util.List<PersonAttributeType> getPersonAttributeTypes(OpenmrsConstants.PERSON_TYPE personType, PersonService.ATTR_VIEW_TYPE viewType)
          Gets the types defined for the given person type (person, user, patient) and the given type of view (one person vs many person objects)
 java.util.List<PersonAttributeType> getPersonAttributeTypes(java.lang.String personTypeStr, java.lang.String displayTypeStr)
          Deprecated. @see PersonService.getPersonAttributeTypes(java.lang.String, java.lang.String)
 java.util.List<PersonAttributeType> getPersonAttributeTypes(java.lang.String exactName, java.lang.String format, java.lang.Integer foreignKey, java.lang.Boolean searchable)
          Find person attribute types matching the given parameters.
 Person getPersonByUuid(java.lang.String uuid)
          Get Person by its UUID
 PersonName getPersonNameByUuid(java.lang.String uuid)
          Get PersonName by its UUID
 Relationship getRelationship(java.lang.Integer relationshipId)
          Get relationship by internal relationship identifier
 Relationship getRelationshipByUuid(java.lang.String uuid)
          Get Relationship by its UUID
 java.util.Map<Person,java.util.List<Person>> getRelationshipMap(RelationshipType relType)
          Get all relationships for a given type of relationship mapped from the personA to all of the personB's
 java.util.List<Relationship> getRelationships()
          Deprecated. use getAllRelationships()
 java.util.List<Relationship> getRelationships(Person p)
          Deprecated. use getRelationshipsByPerson(Person)
 java.util.List<Relationship> getRelationships(Person p, boolean showVoided)
          Deprecated. use getRelationshipsByPerson(Person)
 java.util.List<Relationship> getRelationships(Person fromPerson, Person toPerson, RelationshipType relType)
          Get relationships stored in the database that
 java.util.Map<Person,java.util.List<Person>> getRelationships(RelationshipType relType)
          Deprecated. use getRelationshipMap(RelationshipType)
 java.util.List<Relationship> getRelationshipsByPerson(Person p)
          Get list of relationships that include Person in person_id or relative_id Does not include voided relationships
 java.util.List<Relationship> getRelationshipsTo(Person toPerson, RelationshipType relType)
          Deprecated. use getRelationships(Person, Person, RelationshipType)
 RelationshipType getRelationshipType(java.lang.Integer relationshipTypeId)
          Get relationshipType by internal identifier
 RelationshipType getRelationshipTypeByName(java.lang.String relationshipTypeName)
          Find relationshipType by exact name match
 RelationshipType getRelationshipTypeByUuid(java.lang.String uuid)
          Gets the relationship type with the given uuid.
 java.util.List<RelationshipType> getRelationshipTypes()
          Deprecated. use getAllRelationshipTypes()
 java.util.List<RelationshipType> getRelationshipTypes(java.lang.String searchString)
          Get relationshipTypes by searching through the names and loosely matching to the given searchString
 java.util.List<RelationshipType> getRelationshipTypes(java.lang.String relationshipTypeName, java.lang.Boolean preferred)
          Find relationshipTypes by exact name match and/or preferred status
 java.util.Set<Person> getSimilarPeople(java.lang.String name, java.lang.Integer birthyear, java.lang.String gender)
          Find a similar person given the attributes.
 java.util.Set<Person> getSimilarPeople(java.lang.String nameSearch, java.lang.Integer birthyear, java.lang.String gender, java.lang.String personType)
          Deprecated. @see getSimilarPeople(String, Integer, String)
 PersonName parsePersonName(java.lang.String name)
          Parses a name into a PersonName (separate Given, Middle, and Family names)
 void purgePerson(Person person)
          Purges a person from the database (cannot be undone)
 void purgePersonAttributeType(PersonAttributeType type)
          Purges a PersonAttribute type from the database (cannot be undone)
 void purgeRelationship(Relationship relationship)
          Purges a relationship from the database (cannot be undone)
 void purgeRelationshipType(RelationshipType relationshipType)
          Purge relationship type from the database (cannot be undone)
 PersonAttributeType retirePersonAttributeType(PersonAttributeType type, java.lang.String retiredReason)
          Retire a Person Attribute Type
 RelationshipType retireRelationshipType(RelationshipType type, java.lang.String retiredReason)
          Retire a Person Relationship Type
 Person savePerson(Person person)
          Creates or updates a Person in the database
 PersonAttributeType savePersonAttributeType(PersonAttributeType type)
          Save the given person attribute type in the database.
 Relationship saveRelationship(Relationship relationship)
          Create or update a relationship between people.
 RelationshipType saveRelationshipType(RelationshipType relationshipType)
          Inserts or updates the given relationship type object in the database
 void setPersonDAO(PersonDAO dao)
          Sets the DAO for this service.
 PersonName splitPersonName(java.lang.String name)
          Deprecated. see #parsePersonName(String)
 Person unvoidPerson(Person person)
          Effectively resurrects this person in the db.
 Relationship unvoidRelationship(Relationship relationship)
          Unvoid Relationship in the database, effectively marking this as a valid relationship again
 void updatePerson(Person person)
          Deprecated. use savePerson(Person)
 void updatePersonAttributeType(PersonAttributeType type)
          Deprecated. use savePersonAttributeType(PersonAttributeType)
 void updateRelationship(Relationship relationship)
          Deprecated. use saveRelationship(Relationship)
 void updateRelationshipType(RelationshipType relationshipType)
          Deprecated. use saveRelationshipType(RelationshipType)
 Person voidPerson(Person person, java.lang.String reason)
          Effectively removes this person from the system.
 Relationship voidRelationship(Relationship relationship, java.lang.String voidReason)
          Voids the given Relationship, effectively removing it from openmrs.
 
Methods inherited from class org.openmrs.api.impl.BaseOpenmrsService
onShutdown, onStartup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersonServiceImpl

public PersonServiceImpl()
Method Detail

setPersonDAO

public void setPersonDAO(PersonDAO dao)
Description copied from interface: PersonService
Sets the DAO for this service. This is done through spring injection

Specified by:
setPersonDAO in interface PersonService
Parameters:
dao - DAO for this service
See Also:
PersonService.setPersonDAO(org.openmrs.api.db.PersonDAO)

getSimilarPeople

public java.util.Set<Person> getSimilarPeople(java.lang.String name,
                                              java.lang.Integer birthyear,
                                              java.lang.String gender)
                                       throws APIException
Description copied from interface: PersonService
Find a similar person given the attributes. This does a very loose lookup with the nameSearch parameter. This does a very loose lookup on birthyear as well. Any person with a null/missing birthdate is included and anyone with a birthyear plus/minus one year from the given birthyear is also included

Specified by:
getSimilarPeople in interface PersonService
Parameters:
name - string to search the person's name for
birthyear - the year of birth to restrict
gender - The gender field to search on (Typically just "M" or "F")
Returns:
Set object with all people matching criteria
Throws:
APIException
See Also:
PersonService.getSimilarPeople(java.lang.String, java.lang.Integer, java.lang.String)

getSimilarPeople

public java.util.Set<Person> getSimilarPeople(java.lang.String nameSearch,
                                              java.lang.Integer birthyear,
                                              java.lang.String gender,
                                              java.lang.String personType)
                                       throws APIException
Deprecated. @see getSimilarPeople(String, Integer, String)

Description copied from interface: PersonService
This method is needed to limit the ability for Users/Patients to be created that are already of the other type. This method will not be needed after a Person/Patient/User refactor that is due in 1.6.

Specified by:
getSimilarPeople in interface PersonService
Parameters:
nameSearch - string to search the person's name for
birthyear - the year of birth to restrict
gender - The gender field to search on (Typically just "M" or "F")
personType - one of person, user, or patient. If Person, any Person object is returned, if Patient, only Persons that are Patients are returned, if User, only Persons that are Users are returned
Returns:
Set object with all people matching criteria
Throws:
APIException
See Also:
PersonService.getSimilarPeople(java.lang.String, java.lang.Integer, java.lang.String, java.lang.String)

getPeople

public java.util.List<Person> getPeople(java.lang.String searchPhrase,
                                        java.lang.Boolean dead)
                                 throws APIException
Description copied from interface: PersonService
Find a person matching the searchPhrase search string

Specified by:
getPeople in interface PersonService
Parameters:
searchPhrase - person name to match on
dead - if true will return only dead patients, if false will return only alive patients, if null will return both
Returns:
list of person objects matches the parameters
Throws:
APIException
See Also:
PersonService.getPeople(String, Boolean)

findPeople

public java.util.Set<Person> findPeople(java.lang.String searchPhrase,
                                        boolean includeVoided)
Deprecated. use getPeople(String, Boolean)

Specified by:
findPeople in interface PersonService

findPeople

public java.util.Set<Person> findPeople(java.lang.String searchPhrase,
                                        boolean includeVoided,
                                        java.lang.String roles)
Deprecated. use getPeople(String, Boolean)

Specified by:
findPeople in interface PersonService

findPeople

public java.util.Set<Person> findPeople(java.lang.String searchPhrase,
                                        boolean includeVoided,
                                        java.util.List<java.lang.String> roles)
Deprecated. use getPeople(String, Boolean)

Specified by:
findPeople in interface PersonService

getAllPersonAttributeTypes

public java.util.List<PersonAttributeType> getAllPersonAttributeTypes()
                                                               throws APIException
Description copied from interface: PersonService
Get all PersonAttributeTypes in the database

Specified by:
getAllPersonAttributeTypes in interface PersonService
Returns:
All person attribute types including the retired ones
Throws:
APIException
See Also:
PersonService.getAllPersonAttributeTypes()

getAllPersonAttributeTypes

public java.util.List<PersonAttributeType> getAllPersonAttributeTypes(boolean includeRetired)
                                                               throws APIException
Description copied from interface: PersonService
Get all PersonAttributeTypes in the database with the option of including the retired types

Specified by:
getAllPersonAttributeTypes in interface PersonService
Parameters:
includeRetired - boolean - include retired attribute types as well?
Returns:
List object of all PersonAttributeTypes, possibly including retired ones
Throws:
APIException
See Also:
PersonService.getAllPersonAttributeTypes(boolean)

getPersonAttributeTypeByName

public PersonAttributeType getPersonAttributeTypeByName(java.lang.String typeName)
                                                 throws APIException
Description copied from interface: PersonService
Get the PersonAttributeType given the type's name

Specified by:
getPersonAttributeTypeByName in interface PersonService
Returns:
the PersonAttributeType that has the given name or null if none found
Throws:
APIException
See Also:
PersonService.getPersonAttributeTypeByName(java.lang.String)

purgePersonAttributeType

public void purgePersonAttributeType(PersonAttributeType type)
                              throws APIException
Description copied from interface: PersonService
Purges a PersonAttribute type from the database (cannot be undone)

Specified by:
purgePersonAttributeType in interface PersonService
Parameters:
type - type to be purged from the database
Throws:
APIException
See Also:
PersonService.purgePersonAttributeType(org.openmrs.PersonAttributeType)

savePersonAttributeType

public PersonAttributeType savePersonAttributeType(PersonAttributeType type)
                                            throws APIException
Description copied from interface: PersonService
Save the given person attribute type in the database.
If the given type's Id is not empty, then also need to change any global property which is in OpenmrsConstants.GLOBAL_PROPERTIES_OF_PERSON_ATTRIBUTES and reference this given type, prior to saving this given type.

Specified by:
savePersonAttributeType in interface PersonService
Returns:
the saved person attribute type
Throws:
APIException
See Also:
PersonService.savePersonAttributeType(org.openmrs.PersonAttributeType)

retirePersonAttributeType

public PersonAttributeType retirePersonAttributeType(PersonAttributeType type,
                                                     java.lang.String retiredReason)
                                              throws APIException
Description copied from interface: PersonService
Retire a Person Attribute Type

Specified by:
retirePersonAttributeType in interface PersonService
Throws:
APIException
See Also:
org.openmrs.api.PersonService#retirePersonAttributeType(org.openmrs.PersonAttributeType)

createPersonAttributeType

public void createPersonAttributeType(PersonAttributeType type)
                               throws APIException
Deprecated. use savePersonAttributeType(PersonAttributeType)

Specified by:
createPersonAttributeType in interface PersonService
Throws:
APIException

updatePersonAttributeType

public void updatePersonAttributeType(PersonAttributeType type)
                               throws APIException
Deprecated. use savePersonAttributeType(PersonAttributeType)

Specified by:
updatePersonAttributeType in interface PersonService
Throws:
APIException

getPersonAttributeTypes

public java.util.List<PersonAttributeType> getPersonAttributeTypes(java.lang.String exactName,
                                                                   java.lang.String format,
                                                                   java.lang.Integer foreignKey,
                                                                   java.lang.Boolean searchable)
                                                            throws APIException
Description copied from interface: PersonService
Find person attribute types matching the given parameters. Retired types are included in the results

Specified by:
getPersonAttributeTypes in interface PersonService
Parameters:
exactName - (optional) The name of type
format - (optional) The format for this type
foreignKey - (optional) The foreign key
searchable - (optional) if true only returns searchable types, if false returns only nonsearchable and if null returns all
Returns:
list of PersonAttributeTypes matching the given parameters
Throws:
APIException
See Also:
PersonService.getPersonAttributeTypes(java.lang.String, java.lang.String, java.lang.Integer, java.lang.Boolean)

deletePersonAttributeType

public void deletePersonAttributeType(java.lang.Integer attrTypeId)
Deprecated. use purgePersonAttributeType(PersonAttributeType)

Description copied from interface: PersonService
Delete a Person Attribute Type

Specified by:
deletePersonAttributeType in interface PersonService

deletePersonAttributeType

public void deletePersonAttributeType(PersonAttributeType type)
Deprecated. use purgePersonAttributeType(PersonAttributeType)

Specified by:
deletePersonAttributeType in interface PersonService

getPersonAttributeTypes

public java.util.List<PersonAttributeType> getPersonAttributeTypes()
Deprecated. use getAllPersonAttributeTypes()

Specified by:
getPersonAttributeTypes in interface PersonService

getPersonAttributeType

public PersonAttributeType getPersonAttributeType(java.lang.Integer typeId)
Description copied from interface: PersonService
Get the PersonAttributeType given the type's PersonAttributeTypeId

Specified by:
getPersonAttributeType in interface PersonService
Parameters:
typeId - PersonAttributeType.personAttributeTypeId to match on
Returns:
the type matching this id or null if none was found
See Also:
PersonService.getPersonAttributeType(java.lang.Integer)

getPersonAttribute

public PersonAttribute getPersonAttribute(java.lang.Integer id)
Description copied from interface: PersonService
Get a PersonAttribute from the database with the given PersonAttributeid

Specified by:
getPersonAttribute in interface PersonService
Parameters:
id - the PersonAttribute.personAttributeId to match on
Returns:
the matching PersonAttribute or null if none was found
See Also:
PersonService.getPersonAttribute(java.lang.Integer)

getPersonAttributeType

public PersonAttributeType getPersonAttributeType(java.lang.String s)
Deprecated. use getPersonAttributeTypeByName(String)

Specified by:
getPersonAttributeType in interface PersonService

getRelationship

public Relationship getRelationship(java.lang.Integer relationshipId)
                             throws APIException
Description copied from interface: PersonService
Get relationship by internal relationship identifier

Specified by:
getRelationship in interface PersonService
Returns:
Relationship the relationship to match on or null if none found
Throws:
APIException
See Also:
PersonService.getRelationship(java.lang.Integer)

getRelationships

public java.util.List<Relationship> getRelationships()
                                              throws APIException
Deprecated. use getAllRelationships()

Specified by:
getRelationships in interface PersonService
Throws:
APIException

getRelationships

public java.util.List<Relationship> getRelationships(Person p,
                                                     boolean showVoided)
                                              throws APIException
Deprecated. use getRelationshipsByPerson(Person)

Specified by:
getRelationships in interface PersonService
Throws:
APIException

getRelationships

public java.util.List<Relationship> getRelationships(Person p)
                                              throws APIException
Deprecated. use getRelationshipsByPerson(Person)

Specified by:
getRelationships in interface PersonService
Throws:
APIException

getRelationshipsTo

public java.util.List<Relationship> getRelationshipsTo(Person toPerson,
                                                       RelationshipType relType)
                                                throws APIException
Deprecated. use getRelationships(Person, Person, RelationshipType)

Specified by:
getRelationshipsTo in interface PersonService
Throws:
APIException

getRelationshipTypes

public java.util.List<RelationshipType> getRelationshipTypes()
                                                      throws APIException
Deprecated. use getAllRelationshipTypes()

Specified by:
getRelationshipTypes in interface PersonService
Throws:
APIException

getRelationshipType

public RelationshipType getRelationshipType(java.lang.Integer relationshipTypeId)
                                     throws APIException
Description copied from interface: PersonService
Get relationshipType by internal identifier

Specified by:
getRelationshipType in interface PersonService
Returns:
relationshipType with given internal identifier or null if none found
Throws:
APIException
See Also:
PersonService.getRelationshipType(java.lang.Integer)

findRelationshipType

public RelationshipType findRelationshipType(java.lang.String relationshipTypeName)
                                      throws APIException
Deprecated. use getRelationshipTypeByName(String)

Specified by:
findRelationshipType in interface PersonService
Throws:
APIException

getRelationshipTypeByName

public RelationshipType getRelationshipTypeByName(java.lang.String relationshipTypeName)
                                           throws APIException
Description copied from interface: PersonService
Find relationshipType by exact name match

Specified by:
getRelationshipTypeByName in interface PersonService
Parameters:
relationshipTypeName - name to match on
Returns:
RelationshipType with given name or null if none found
Throws:
APIException
See Also:
PersonService.getRelationshipTypeByName(java.lang.String)

purgePerson

public void purgePerson(Person person)
                 throws APIException
Description copied from interface: PersonService
Purges a person from the database (cannot be undone)

Specified by:
purgePerson in interface PersonService
Parameters:
person - person to be purged from the database
Throws:
APIException
See Also:
PersonService.purgePerson(org.openmrs.Person)

savePerson

public Person savePerson(Person person)
                  throws APIException
Description copied from interface: PersonService
Creates or updates a Person in the database

Specified by:
savePerson in interface PersonService
Parameters:
person - person to be created or updated
Returns:
person who was created or updated
Throws:
APIException
See Also:
PersonService.savePerson(org.openmrs.Person)

createPerson

public Person createPerson(Person person)
                    throws APIException
Deprecated. use savePerson(Person)

Specified by:
createPerson in interface PersonService
Throws:
APIException

updatePerson

public void updatePerson(Person person)
                  throws APIException
Deprecated. use savePerson(Person)

Specified by:
updatePerson in interface PersonService
Throws:
APIException

deletePerson

public void deletePerson(Person person)
                  throws APIException
Deprecated. use purgePerson(Person)

Specified by:
deletePerson in interface PersonService
Throws:
APIException

voidPerson

public Person voidPerson(Person person,
                         java.lang.String reason)
                  throws APIException
Description copied from interface: PersonService
Effectively removes this person from the system. UserService.voidUser(person) and PatientService.voidPatient(person) are also called

Specified by:
voidPerson in interface PersonService
Parameters:
person - person to be voided
reason - reason for voiding person
Returns:
the person that was voided
Throws:
APIException
See Also:
PersonService.voidPerson(org.openmrs.Person, java.lang.String)

unvoidPerson

public Person unvoidPerson(Person person)
                    throws APIException
Description copied from interface: PersonService
Effectively resurrects this person in the db. Unvoids the associated Patient and User as well

Specified by:
unvoidPerson in interface PersonService
Parameters:
person - person to be revived
Returns:
the person that was unvoided
Throws:
APIException
See Also:
PersonService.unvoidPerson(org.openmrs.Person)

getPerson

public Person getPerson(java.lang.Integer personId)
                 throws APIException
Description copied from interface: PersonService
Gets a person by internal id

Specified by:
getPerson in interface PersonService
Parameters:
personId - internal identifier of person to get
Returns:
Person person with given internal identifier
Throws:
APIException
See Also:
PersonService.getPerson(java.lang.Integer)

getPerson

public Person getPerson(Patient pat)
                 throws APIException
Deprecated. use getPerson(Integer)

Description copied from interface: PersonService
Use either PersonService.getPerson(Integer) passing in pat.getPatientId() or just cast the pat object to a Person object because Patient is a subclass of Person. (Person)pat

Specified by:
getPerson in interface PersonService
Throws:
APIException

getPerson

public Person getPerson(User user)
                 throws APIException
Deprecated. use getPerson(Integer)

Description copied from interface: PersonService
Use either PersonService.getPerson(Integer) passing in user.getUserId() or just cast the user object to a Person object because User is a subclass of Person. (Person)user

Specified by:
getPerson in interface PersonService
Throws:
APIException

getAllRelationships

public java.util.List<Relationship> getAllRelationships()
                                                 throws APIException
Description copied from interface: PersonService
Get list of relationships that are not voided

Specified by:
getAllRelationships in interface PersonService
Returns:
non-voided Relationship list
Throws:
APIException
See Also:
PersonService.getAllRelationships()

getAllRelationships

public java.util.List<Relationship> getAllRelationships(boolean includeVoided)
                                                 throws APIException
Description copied from interface: PersonService
Get list of relationships optionally including the voided ones or not

Specified by:
getAllRelationships in interface PersonService
Parameters:
includeVoided - true/false whether to include the voided relationships
Returns:
non-voided Relationship list
Throws:
APIException
See Also:
PersonService.getAllRelationships(boolean)

getRelationships

public java.util.List<Relationship> getRelationships(Person fromPerson,
                                                     Person toPerson,
                                                     RelationshipType relType)
                                              throws APIException
Description copied from interface: PersonService
Get relationships stored in the database that

Specified by:
getRelationships in interface PersonService
Parameters:
fromPerson - (optional) Person to in the person_id column
toPerson - (optional) Person in the relative_id column
relType - (optional) The RelationshipType to match
Returns:
relationships matching the given parameters
Throws:
APIException
See Also:
PersonService.getRelationships(org.openmrs.Person, org.openmrs.Person, org.openmrs.RelationshipType)

getRelationshipsByPerson

public java.util.List<Relationship> getRelationshipsByPerson(Person p)
                                                      throws APIException
Description copied from interface: PersonService
Get list of relationships that include Person in person_id or relative_id Does not include voided relationships

Specified by:
getRelationshipsByPerson in interface PersonService
Parameters:
p - person object listed on either side of the relationship
Returns:
Relationship list
Throws:
APIException
See Also:
PersonService.getRelationshipsByPerson(org.openmrs.Person)

purgeRelationship

public void purgeRelationship(Relationship relationship)
                       throws APIException
Description copied from interface: PersonService
Purges a relationship from the database (cannot be undone)

Specified by:
purgeRelationship in interface PersonService
Parameters:
relationship - relationship to be purged from the database
Throws:
APIException
See Also:
PersonService.purgeRelationship(org.openmrs.Relationship)

saveRelationship

public Relationship saveRelationship(Relationship relationship)
                              throws APIException
Description copied from interface: PersonService
Create or update a relationship between people. Saves the given relationship to the database

Specified by:
saveRelationship in interface PersonService
Parameters:
relationship - relationship to be created or updated
Returns:
relationship that was created or updated
Throws:
APIException
See Also:
PersonService.saveRelationship(org.openmrs.Relationship)

createRelationship

public void createRelationship(Relationship relationship)
                        throws APIException
Deprecated. use saveRelationship(Relationship)

Specified by:
createRelationship in interface PersonService
Throws:
APIException

updateRelationship

public void updateRelationship(Relationship relationship)
                        throws APIException
Deprecated. use saveRelationship(Relationship)

Specified by:
updateRelationship in interface PersonService
Throws:
APIException

deleteRelationship

public void deleteRelationship(Relationship relationship)
                        throws APIException
Deprecated. use purgeRelationship(Relationship)

Specified by:
deleteRelationship in interface PersonService
Throws:
APIException

voidRelationship

public Relationship voidRelationship(Relationship relationship,
                                     java.lang.String voidReason)
                              throws APIException
Description copied from interface: PersonService
Voids the given Relationship, effectively removing it from openmrs.

Specified by:
voidRelationship in interface PersonService
Parameters:
relationship - Relationship to void
voidReason - String reason the relationship is being voided.
Returns:
the newly saved relationship
Throws:
APIException
See Also:
PersonService.voidRelationship(org.openmrs.Relationship, java.lang.String)

unvoidRelationship

public Relationship unvoidRelationship(Relationship relationship)
                                throws APIException
Description copied from interface: PersonService
Unvoid Relationship in the database, effectively marking this as a valid relationship again

Specified by:
unvoidRelationship in interface PersonService
Parameters:
relationship - Relationship to unvoid
Returns:
the newly unvoided relationship
Throws:
APIException
See Also:
PersonService.unvoidRelationship(org.openmrs.Relationship)

createRelationshipType

public void createRelationshipType(RelationshipType relationshipType)
                            throws APIException
Deprecated. use saveRelationshipType(RelationshipType)

Specified by:
createRelationshipType in interface PersonService
Throws:
APIException

updateRelationshipType

public void updateRelationshipType(RelationshipType relationshipType)
                            throws APIException
Deprecated. use saveRelationshipType(RelationshipType)

Specified by:
updateRelationshipType in interface PersonService
Throws:
APIException

deleteRelationshipType

public void deleteRelationshipType(RelationshipType relationshipType)
                            throws APIException
Deprecated. use purgeRelationshipType(RelationshipType)

Specified by:
deleteRelationshipType in interface PersonService
Throws:
APIException

getAllRelationshipTypes

public java.util.List<RelationshipType> getAllRelationshipTypes()
                                                         throws APIException
Description copied from interface: PersonService
Get all relationshipTypes Includes retired relationship types

Specified by:
getAllRelationshipTypes in interface PersonService
Returns:
relationshipType list
Throws:
APIException
See Also:
PersonService.getAllRelationshipTypes()

getRelationshipTypes

public java.util.List<RelationshipType> getRelationshipTypes(java.lang.String searchString)
                                                      throws APIException
Description copied from interface: PersonService
Get relationshipTypes by searching through the names and loosely matching to the given searchString

Specified by:
getRelationshipTypes in interface PersonService
Parameters:
searchString - string to match to a relationship type name
Returns:
list of relationship types or empty list if none found
Throws:
APIException
See Also:
PersonService.getRelationshipTypes(java.lang.String)

getRelationshipTypes

public java.util.List<RelationshipType> getRelationshipTypes(java.lang.String relationshipTypeName,
                                                             java.lang.Boolean preferred)
                                                      throws APIException
Description copied from interface: PersonService
Find relationshipTypes by exact name match and/or preferred status

Specified by:
getRelationshipTypes in interface PersonService
Parameters:
relationshipTypeName - name to match on
preferred - if true, returns on preferred types, if false returns only the nonpreferred types. if null returns both
Returns:
RelationshipTypes with given name and preferred status
Throws:
APIException
See Also:
PersonService.getRelationshipTypes(java.lang.String, java.lang.Boolean)

purgeRelationshipType

public void purgeRelationshipType(RelationshipType relationshipType)
                           throws APIException
Description copied from interface: PersonService
Purge relationship type from the database (cannot be undone)

Specified by:
purgeRelationshipType in interface PersonService
Parameters:
relationshipType - relationship type to be purged
Throws:
APIException
See Also:
PersonService.purgeRelationshipType(org.openmrs.RelationshipType)

saveRelationshipType

public RelationshipType saveRelationshipType(RelationshipType relationshipType)
                                      throws APIException
Description copied from interface: PersonService
Inserts or updates the given relationship type object in the database

Specified by:
saveRelationshipType in interface PersonService
Parameters:
relationshipType - type to be created or updated
Returns:
relationship type that was created or updated
Throws:
APIException
See Also:
PersonService.saveRelationshipType(org.openmrs.RelationshipType)

getPersonAttributeTypes

public java.util.List<PersonAttributeType> getPersonAttributeTypes(OpenmrsConstants.PERSON_TYPE personType,
                                                                   PersonService.ATTR_VIEW_TYPE viewType)
                                                            throws APIException
Description copied from interface: PersonService
Gets the types defined for the given person type (person, user, patient) and the given type of view (one person vs many person objects)

Specified by:
getPersonAttributeTypes in interface PersonService
Parameters:
personType - PERSON, USER, PATIENT, or null. Both PERSON and null mean to return attr types for both patients and users
viewType - whether this is a listing or viewing or null for both listing and viewing
Returns:
list of PersonAttributeTypes that should be displayed
Throws:
APIException
See Also:
PersonService.getPersonAttributeTypes(org.openmrs.util.OpenmrsConstants.PERSON_TYPE, org.openmrs.api.PersonService.ATTR_VIEW_TYPE)

getPersonAttributeTypes

public java.util.List<PersonAttributeType> getPersonAttributeTypes(java.lang.String personTypeStr,
                                                                   java.lang.String displayTypeStr)
                                                            throws APIException
Deprecated. @see PersonService.getPersonAttributeTypes(java.lang.String, java.lang.String)

Specified by:
getPersonAttributeTypes in interface PersonService
Throws:
APIException

parsePersonName

public PersonName parsePersonName(java.lang.String name)
                           throws APIException
Description copied from interface: PersonService
Parses a name into a PersonName (separate Given, Middle, and Family names)

Specified by:
parsePersonName in interface PersonService
Parameters:
name - person name to be parsed
Returns:
parsed person name
Throws:
APIException
See Also:
PersonService.parsePersonName(java.lang.String)

splitPersonName

public PersonName splitPersonName(java.lang.String name)
Deprecated. see #parsePersonName(String)

Description copied from interface: PersonService
Splits the name string into Given, Middle, and Family parts of a PersonName

Specified by:
splitPersonName in interface PersonService
Returns:
fully formed PersonName object
See Also:
PersonService.parsePersonName(String)

getRelationshipMap

public java.util.Map<Person,java.util.List<Person>> getRelationshipMap(RelationshipType relType)
                                                                throws APIException
Description copied from interface: PersonService
Get all relationships for a given type of relationship mapped from the personA to all of the personB's

Specified by:
getRelationshipMap in interface PersonService
Parameters:
relType - type of relationship for which to retrieve all relationships
Returns:
all relationships for the given type of relationship
Throws:
APIException
See Also:
PersonService.getRelationshipMap(org.openmrs.RelationshipType)

getRelationships

public java.util.Map<Person,java.util.List<Person>> getRelationships(RelationshipType relType)
                                                              throws APIException
Deprecated. use getRelationshipMap(RelationshipType)

Specified by:
getRelationships in interface PersonService
Throws:
APIException

getPersonAttributeTypeByUuid

public PersonAttributeType getPersonAttributeTypeByUuid(java.lang.String uuid)
Description copied from interface: PersonService
Gets a person attribute type with the given uuid.

Specified by:
getPersonAttributeTypeByUuid in interface PersonService
Parameters:
uuid - the universally unique identifier to lookup
Returns:
a person attribute type with the given uuid
See Also:
PersonService.getPersonAttributeTypeByUuid(java.lang.String)

getPersonByUuid

public Person getPersonByUuid(java.lang.String uuid)
                       throws APIException
Description copied from interface: PersonService
Get Person by its UUID

Specified by:
getPersonByUuid in interface PersonService
Returns:
Throws:
APIException
See Also:
PersonService.getPersonByUuid(java.lang.String)

getPersonAddressByUuid

public PersonAddress getPersonAddressByUuid(java.lang.String uuid)
                                     throws APIException
Description copied from interface: PersonService
Get PersonAddress by its UUID

Specified by:
getPersonAddressByUuid in interface PersonService
Returns:
Throws:
APIException

getPersonAttributeByUuid

public PersonAttribute getPersonAttributeByUuid(java.lang.String uuid)
                                         throws APIException
Description copied from interface: PersonService
Get PersonAttribute by its UUID

Specified by:
getPersonAttributeByUuid in interface PersonService
Returns:
Throws:
APIException

getPersonNameByUuid

public PersonName getPersonNameByUuid(java.lang.String uuid)
                               throws APIException
Description copied from interface: PersonService
Get PersonName by its UUID

Specified by:
getPersonNameByUuid in interface PersonService
Returns:
Throws:
APIException

getRelationshipByUuid

public Relationship getRelationshipByUuid(java.lang.String uuid)
                                   throws APIException
Description copied from interface: PersonService
Get Relationship by its UUID

Specified by:
getRelationshipByUuid in interface PersonService
Returns:
Throws:
APIException
See Also:
PersonService.getRelationshipByUuid(java.lang.String)

getRelationshipTypeByUuid

public RelationshipType getRelationshipTypeByUuid(java.lang.String uuid)
                                           throws APIException
Description copied from interface: PersonService
Gets the relationship type with the given uuid.

Specified by:
getRelationshipTypeByUuid in interface PersonService
Returns:
Throws:
APIException
See Also:
PersonService.getRelationshipTypeByUuid(java.lang.String)

getAllRelationshipTypes

public java.util.List<RelationshipType> getAllRelationshipTypes(boolean includeRetired)
                                                         throws APIException
Description copied from interface: PersonService
Get all relationshipTypes with the option of including the retired types

Specified by:
getAllRelationshipTypes in interface PersonService
Parameters:
includeRetired - boolean - include retired relationshipTypes as well?
Returns:
relationshipType list
Throws:
APIException
See Also:
PersonService.getAllRelationshipTypes(boolean)

retireRelationshipType

public RelationshipType retireRelationshipType(RelationshipType type,
                                               java.lang.String retiredReason)
                                        throws APIException
Description copied from interface: PersonService
Retire a Person Relationship Type

Specified by:
retireRelationshipType in interface PersonService
Throws:
APIException
See Also:
PersonService.retireRelationshipType(org.openmrs.RelationshipType, java.lang.String)

OpenMRS-1.7.x

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