org.openmrs.api
Interface PersonService

All Known Implementing Classes:
PersonServiceImpl

@Transactional
public interface PersonService

Contains methods pertaining to Persons in the system Use:

 List<Person> personObjects = Context.getPersonService().getAllPersons();
 

See Also:
Context, Patient

Nested Class Summary
static class PersonService.ATTR_VIEW_TYPE
          These enumerations are used when determining which person attr types to display.
 
Method Summary
 Person createPerson(Person person)
          Deprecated. replaced by #savePerson(Person)
 void createPersonAttributeType(PersonAttributeType type)
          Deprecated. savePersonAttributeType(PersonAttributeType)
 void createRelationship(Relationship relationship)
          Deprecated. replaced by #saveRelationship(Relationship)
 void createRelationshipType(RelationshipType relationshipType)
          Deprecated. replaced with #saveRelationshipType(RelationshipType)
 void deletePerson(Person person)
          Deprecated. replaced by #purgePerson(Person)
 void deletePersonAttributeType(java.lang.Integer attrTypeId)
          Deprecated. use (@link #purgePersonAttributeType(PersonAttributeType))
 void deletePersonAttributeType(PersonAttributeType type)
          Deprecated. replaced by #purgePersonAttributeType(PersonAttributeType)
 void deleteRelationship(Relationship relationship)
          Deprecated. replaced by #purgeRelationship(Relationship)
 void deleteRelationshipType(RelationshipType relationshipType)
          Deprecated. replaced by #purgeRelationshipType(RelationshipType)
 java.util.Set<Person> findPeople(java.lang.String searchPhrase, boolean includeVoided)
          Deprecated. @see #getPeople(...)
 java.util.Set<Person> findPeople(java.lang.String searchPhrase, boolean includeVoided, java.util.List<java.lang.String> roles)
          Deprecated. @see #getPeople(...)
 java.util.Set<Person> findPeople(java.lang.String searchPhrase, boolean includeVoided, java.lang.String roles)
          Deprecated. @see #getPeople(...)
 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 typeName)
          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 personType, java.lang.String viewType)
          Deprecated. use getPersonAttributeTypes(String, 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 relationshipType)
          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 relationshipType)
          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(...)
 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 nameSearch, 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. replaced by 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. replaced by #saveRelationship(Relationship)
 void updateRelationshipType(RelationshipType relationshipType)
          Deprecated. replaced by #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.
 

Method Detail

setPersonDAO

void setPersonDAO(PersonDAO dao)
Sets the DAO for this service. This is done through spring injection

Parameters:
dao - DAO for this service

getSimilarPeople

@Transactional(readOnly=true)
@Authorized(value="View People")
java.util.Set<Person> getSimilarPeople(java.lang.String nameSearch,
                                                                     java.lang.Integer birthyear,
                                                                     java.lang.String gender)
                                       throws APIException
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

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")
Returns:
Set object with all people matching criteria
Throws:
APIException
Expected behavior:
accept greater than three names, match single search to any name part, match two word search to any name part, match three word search to any name part, match search to familyName2

getSimilarPeople

@Deprecated
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)

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.

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
Since:
1.5
See Also:
#getSimilarPeople(String, Integer, String)}
Expected behavior:
limit personType equals Patient searches to only Patients, limit personType equals User searches to only Users, limit return all Persons with personType equals Person

getPeople

@Transactional(readOnly=true)
@Authorized(value="View People")
java.util.List<Person> getPeople(java.lang.String searchPhrase,
                                                               java.lang.Boolean dead)
                                 throws APIException
Find a person matching the searchPhrase search string

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
Expected behavior:
match search to familyName2

findPeople

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View People")
java.util.Set<Person> findPeople(java.lang.String searchPhrase,
                                                                          boolean includeVoided)
                                 throws APIException
Deprecated. @see #getPeople(...)

Throws:
APIException

findPeople

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View People")
java.util.Set<Person> findPeople(java.lang.String searchPhrase,
                                                                          boolean includeVoided,
                                                                          java.lang.String roles)
                                 throws APIException
Deprecated. @see #getPeople(...)

Throws:
APIException

findPeople

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View People")
java.util.Set<Person> findPeople(java.lang.String searchPhrase,
                                                                          boolean includeVoided,
                                                                          java.util.List<java.lang.String> roles)
                                 throws APIException
Deprecated. @see #getPeople(...)

Throws:
APIException

savePersonAttributeType

@Authorized(value="Manage Person Attribute Types")
PersonAttributeType savePersonAttributeType(PersonAttributeType type)
                                            throws APIException
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.

Parameters:
type -
Returns:
the saved person attribute type
Throws:
APIException
Expected behavior:
set the date created and creator on new, set the date changed and changed by on update, update any global property which reference this type

retirePersonAttributeType

@Authorized(value="Manage Person Attribute Types")
PersonAttributeType retirePersonAttributeType(PersonAttributeType type,
                                                              java.lang.String retiredReason)
                                              throws APIException
Retire a Person Attribute Type

Parameters:
attrTypeId, - retiredReason
Throws:
APIException

retireRelationshipType

@Authorized(value="Manage Relationship Types")
RelationshipType retireRelationshipType(RelationshipType type,
                                                        java.lang.String retiredReason)
                                        throws APIException
Retire a Person Relationship Type

Parameters:
relationshipType, - retiredReason
Throws:
APIException

createPersonAttributeType

@Deprecated
@Authorized(value="Manage Person Attribute Types")
void createPersonAttributeType(PersonAttributeType type)
                               throws APIException
Deprecated. savePersonAttributeType(PersonAttributeType)

Throws:
APIException

deletePersonAttributeType

@Deprecated
@Authorized(value="Purge Person Attribute Types")
void deletePersonAttributeType(PersonAttributeType type)
                               throws APIException
Deprecated. replaced by #purgePersonAttributeType(PersonAttributeType)

Throws:
APIException

purgePersonAttributeType

@Authorized(value="Purge Person Attribute Types")
void purgePersonAttributeType(PersonAttributeType type)
                              throws APIException
Purges a PersonAttribute type from the database (cannot be undone)

Parameters:
type - type to be purged from the database
Throws:
APIException
Expected behavior:
delete person attribute type from database

voidPerson

@Authorized(value="Edit People")
Person voidPerson(Person person,
                                  java.lang.String reason)
                  throws APIException
Effectively removes this person from the system. UserService.voidUser(person) and PatientService.voidPatient(person) are also called

Parameters:
person - person to be voided
reason - reason for voiding person
Returns:
the person that was voided
Throws:
APIException
Expected behavior:
return voided person with given reason

unvoidPerson

@Authorized(value="Edit People")
Person unvoidPerson(Person person)
                    throws APIException
Effectively resurrects this person in the db. Unvoids the associated Patient and User as well

Parameters:
person - person to be revived
Returns:
the person that was unvoided
Throws:
APIException
Expected behavior:
unvoid the given person

deletePersonAttributeType

@Deprecated
@Authorized(value="Manage Person Attribute Types")
void deletePersonAttributeType(java.lang.Integer attrTypeId)
                               throws APIException
Deprecated. use (@link #purgePersonAttributeType(PersonAttributeType))

Delete a Person Attribute Type

Parameters:
attrTypeId -
Throws:
APIException

updatePersonAttributeType

@Deprecated
@Authorized(value="Manage Person Attribute Types")
void updatePersonAttributeType(PersonAttributeType type)
                               throws APIException
Deprecated. use savePersonAttributeType(PersonAttributeType)

Throws:
APIException

getAllPersonAttributeTypes

@Transactional(readOnly=true)
@Authorized(value="View Person Attribute Types")
java.util.List<PersonAttributeType> getAllPersonAttributeTypes()
                                                               throws APIException
Get all PersonAttributeTypes in the database

Returns:
All person attribute types including the retired ones
Throws:
APIException
See Also:
getAllPersonAttributeTypes(boolean)
Expected behavior:
return all person attribute types including retired

getAllPersonAttributeTypes

@Transactional(readOnly=true)
@Authorized(value="View Person Attribute Types")
java.util.List<PersonAttributeType> getAllPersonAttributeTypes(boolean includeRetired)
                                                               throws APIException
Get all PersonAttributeTypes in the database with the option of including the retired types

Parameters:
includeRetired - boolean - include retired attribute types as well?
Returns:
List object of all PersonAttributeTypes, possibly including retired ones
Throws:
APIException
Expected behavior:
return all person attribute types including retired when include retired is true, return all person attribute types excluding retired when include retired is false

getPersonAttributeTypes

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Person Attribute Types")
java.util.List<PersonAttributeType> getPersonAttributeTypes()
                                                            throws APIException
Deprecated. use getAllPersonAttributeTypes()

Throws:
APIException

getPersonAttributeTypes

@Transactional(readOnly=true)
@Authorized(value="View Person Attribute Types")
java.util.List<PersonAttributeType> getPersonAttributeTypes(java.lang.String exactName,
                                                                                          java.lang.String format,
                                                                                          java.lang.Integer foreignKey,
                                                                                          java.lang.Boolean searchable)
                                                            throws APIException
Find person attribute types matching the given parameters. Retired types are included in the results

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
Expected behavior:
return person attribute types matching given parameters, return empty list when no person attribute types match given parameters

getPersonAttributeType

@Transactional(readOnly=true)
@Authorized(value="View Person Attribute Types")
PersonAttributeType getPersonAttributeType(java.lang.Integer typeId)
                                           throws APIException
Get the PersonAttributeType given the type's PersonAttributeTypeId

Parameters:
typeId - PersonAttributeType.personAttributeTypeId to match on
Returns:
the type matching this id or null if none was found
Throws:
APIException
Expected behavior:
return null when no person attribute with the given id exist

getPersonAttributeTypeByUuid

@Transactional(readOnly=true)
@Authorized(value="View Person Attribute Types")
PersonAttributeType getPersonAttributeTypeByUuid(java.lang.String uuid)
Gets a person attribute type with the given uuid.

Parameters:
uuid - the universally unique identifier to lookup
Returns:
a person attribute type with the given uuid
Expected behavior:
find object given valid uuid, return null if no object found with given uuid

getPersonAttribute

@Transactional(readOnly=true)
@Authorized(value="View Person Attribute Types")
PersonAttribute getPersonAttribute(java.lang.Integer id)
                                   throws APIException
Get a PersonAttribute from the database with the given PersonAttributeid

Parameters:
id - the PersonAttribute.personAttributeId to match on
Returns:
the matching PersonAttribute or null if none was found
Throws:
APIException
Expected behavior:
return null when PersonAttribute with given id does not exist, return person attribute when PersonAttribute with given id does exist

getPersonAttributeTypeByName

@Transactional(readOnly=true)
@Authorized(value="View Person Attribute Types")
PersonAttributeType getPersonAttributeTypeByName(java.lang.String typeName)
                                                 throws APIException
Get the PersonAttributeType given the type's name

Parameters:
typeName -
Returns:
the PersonAttributeType that has the given name or null if none found
Throws:
APIException
Expected behavior:
return person attribute type when name matches given typeName, return null when no person attribute type match given typeName

getPersonAttributeType

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Person Attribute Types")
PersonAttributeType getPersonAttributeType(java.lang.String typeName)
                                           throws APIException
Deprecated. use getPersonAttributeTypeByName(String)

Throws:
APIException

getRelationship

@Transactional(readOnly=true)
@Authorized(value="View Relationships")
Relationship getRelationship(java.lang.Integer relationshipId)
                             throws APIException
Get relationship by internal relationship identifier

Parameters:
relationshipId -
Returns:
Relationship the relationship to match on or null if none found
Throws:
APIException
Expected behavior:
return relationship with given id, return null when relationship with given id does not exist

getRelationshipByUuid

@Transactional(readOnly=true)
@Authorized(value="View Relationships")
Relationship getRelationshipByUuid(java.lang.String uuid)
                                   throws APIException
Get Relationship by its UUID

Parameters:
uuid -
Returns:
Throws:
APIException
Expected behavior:
find object given valid uuid, return null if no object found with given uuid

getAllRelationships

@Transactional(readOnly=true)
@Authorized(value="View Relationships")
java.util.List<Relationship> getAllRelationships()
                                                 throws APIException
Get list of relationships that are not voided

Returns:
non-voided Relationship list
Throws:
APIException
Expected behavior:
return all unvoided relationships

getAllRelationships

@Transactional(readOnly=true)
@Authorized(value="View Relationships")
java.util.List<Relationship> getAllRelationships(boolean includeVoided)
                                                 throws APIException
Get list of relationships optionally including the voided ones or not

Parameters:
includeVoided - true/false whether to include the voided relationships
Returns:
non-voided Relationship list
Throws:
APIException
Expected behavior:
return all relationship including voided when include voided equals true, return all relationship excluding voided when include voided equals false

getRelationships

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Relationships")
java.util.List<Relationship> getRelationships()
                                              throws APIException
Deprecated. use getAllRelationships()

Throws:
APIException

getRelationshipsByPerson

@Transactional(readOnly=true)
@Authorized(value="View Relationships")
java.util.List<Relationship> getRelationshipsByPerson(Person p)
                                                      throws APIException
Get list of relationships that include Person in person_id or relative_id Does not include voided relationships

Parameters:
p - person object listed on either side of the relationship
Returns:
Relationship list
Throws:
APIException
Expected behavior:
only get unvoided relationships, fetch relationships associated with the given person, fetch unvoided relationships only

getRelationships

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Relationships")
java.util.List<Relationship> getRelationships(Person p,
                                                                                       boolean showVoided)
                                              throws APIException
Deprecated. use getRelationshipsByPerson(Person)

Throws:
APIException

getRelationships

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Relationships")
java.util.List<Relationship> getRelationships(Person p)
                                              throws APIException
Deprecated. use getRelationshipsByPerson(Person)

Throws:
APIException

getRelationshipsTo

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Relationships")
java.util.List<Relationship> getRelationshipsTo(Person toPerson,
                                                                                         RelationshipType relType)
                                                throws APIException
Deprecated. use getRelationships(...)

Throws:
APIException

getRelationships

@Transactional(readOnly=true)
@Authorized(value="View Relationships")
java.util.List<Relationship> getRelationships(Person fromPerson,
                                                                            Person toPerson,
                                                                            RelationshipType relType)
                                              throws APIException
Get relationships stored in the database that

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
Expected behavior:
fetch relationships matching the given from person, fetch relationships matching the given to person, fetch relationships matching the given rel type, return empty list when no relationship matching given parameters exist

getAllRelationshipTypes

@Transactional(readOnly=true)
@Authorized(value="View Relationship Types")
java.util.List<RelationshipType> getAllRelationshipTypes()
                                                         throws APIException
Get all relationshipTypes Includes retired relationship types

Returns:
relationshipType list
Throws:
APIException
Expected behavior:
return all relationship types

getAllRelationshipTypes

@Transactional(readOnly=true)
@Authorized(value="View Relationship Types")
java.util.List<RelationshipType> getAllRelationshipTypes(boolean includeRetired)
                                                         throws APIException
Get all relationshipTypes with the option of including the retired types

Parameters:
includeRetired - boolean - include retired relationshipTypes as well?
Returns:
relationshipType list
Throws:
APIException

getRelationshipTypes

@Deprecated
@Transactional(readOnly=true)
java.util.List<RelationshipType> getRelationshipTypes()
                                                      throws APIException
Deprecated. use getAllRelationshipTypes()

Throws:
APIException

getRelationshipType

@Transactional(readOnly=true)
@Authorized(value="View Relationship Types")
RelationshipType getRelationshipType(java.lang.Integer relationshipTypeId)
                                     throws APIException
Get relationshipType by internal identifier

Parameters:
relationshipTypeId -
Returns:
relationshipType with given internal identifier or null if none found
Throws:
APIException
Expected behavior:
return relationship type with the given relationship type id, return null when no relationship type matches given relationship type id

getRelationshipTypeByUuid

@Transactional(readOnly=true)
@Authorized(value="View Relationship Types")
RelationshipType getRelationshipTypeByUuid(java.lang.String uuid)
                                           throws APIException
Gets the relationship type with the given uuid.

Parameters:
uuid -
Returns:
Throws:
APIException
Expected behavior:
find object given valid uuid, return null if no object found with given uuid

findRelationshipType

@Deprecated
@Transactional(readOnly=true)
RelationshipType findRelationshipType(java.lang.String relationshipTypeName)
                                      throws APIException
Deprecated. use getRelationshipTypeByName(String)

Throws:
APIException

getRelationshipTypeByName

@Transactional(readOnly=true)
@Authorized(value="View Relationship Types")
RelationshipType getRelationshipTypeByName(java.lang.String relationshipTypeName)
                                           throws APIException
Find relationshipType by exact name match

Parameters:
relationshipTypeName - name to match on
Returns:
RelationshipType with given name or null if none found
Throws:
APIException
Expected behavior:
return null when no relationship type match the given name

getRelationshipTypes

@Transactional(readOnly=true)
@Authorized(value="View Relationship Types")
java.util.List<RelationshipType> getRelationshipTypes(java.lang.String relationshipTypeName,
                                                                                    java.lang.Boolean preferred)
                                                      throws APIException
Find relationshipTypes by exact name match and/or preferred status

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
Expected behavior:
return list of preferred relationship type matching given name, return empty list when no preferred relationship type match the given name

getRelationshipTypes

@Transactional(readOnly=true)
@Authorized(value="View Relationship Types")
java.util.List<RelationshipType> getRelationshipTypes(java.lang.String searchString)
                                                      throws APIException
Get relationshipTypes by searching through the names and loosely matching to the given searchString

Parameters:
searchString - string to match to a relationship type name
Returns:
list of relationship types or empty list if none found
Throws:
APIException
Expected behavior:
return empty list when no relationship type match the search string

createRelationship

@Deprecated
@Authorized(value="Add Relationships")
void createRelationship(Relationship relationship)
                        throws APIException
Deprecated. replaced by #saveRelationship(Relationship)

Throws:
APIException

saveRelationship

@Authorized(value={"Add Relationships","Edit Relationships"})
Relationship saveRelationship(Relationship relationship)
                              throws APIException
Create or update a relationship between people. Saves the given relationship to the database

Parameters:
relationship - relationship to be created or updated
Returns:
relationship that was created or updated
Throws:
APIException
Expected behavior:
create new object when relationship id is null, update existing object when relationship id is not null

updateRelationship

@Deprecated
@Authorized(value="Edit Relationships")
void updateRelationship(Relationship relationship)
                        throws APIException
Deprecated. replaced by #saveRelationship(Relationship)

Throws:
APIException

deleteRelationship

@Deprecated
@Authorized(value="Purge Relationships")
void deleteRelationship(Relationship relationship)
                        throws APIException
Deprecated. replaced by #purgeRelationship(Relationship)

Throws:
APIException

purgeRelationship

@Authorized(value="Purge Relationships")
void purgeRelationship(Relationship relationship)
                       throws APIException
Purges a relationship from the database (cannot be undone)

Parameters:
relationship - relationship to be purged from the database
Throws:
APIException
Expected behavior:
delete relationship from the database

voidRelationship

@Authorized(value="Delete Relationships")
Relationship voidRelationship(Relationship relationship,
                                              java.lang.String voidReason)
                              throws APIException
Voids the given Relationship, effectively removing it from openmrs.

Parameters:
relationship - Relationship to void
voidReason - String reason the relationship is being voided.
Returns:
the newly saved relationship
Throws:
APIException
Expected behavior:
void relationship with the given reason

unvoidRelationship

@Authorized(value="Edit Relationships")
Relationship unvoidRelationship(Relationship relationship)
                                throws APIException
Unvoid Relationship in the database, effectively marking this as a valid relationship again

Parameters:
relationship - Relationship to unvoid
Returns:
the newly unvoided relationship
Throws:
APIException
Expected behavior:
unvoid voided relationship

createPerson

@Deprecated
@Authorized(value="Add People")
Person createPerson(Person person)
                    throws APIException
Deprecated. replaced by #savePerson(Person)

Throws:
APIException

savePerson

@Authorized(value={"Add People","Edit People"})
Person savePerson(Person person)
                  throws APIException
Creates or updates a Person in the database

Parameters:
person - person to be created or updated
Returns:
person who was created or updated
Throws:
APIException
Expected behavior:
create new object when person id is null, update existing object when person id is not null

updatePerson

@Deprecated
@Authorized(value="Edit People")
void updatePerson(Person person)
                  throws APIException
Deprecated. use savePerson(Person)

Throws:
APIException

deletePerson

@Deprecated
@Authorized(value="Purge People")
void deletePerson(Person person)
                  throws APIException
Deprecated. replaced by #purgePerson(Person)

Throws:
APIException

purgePerson

@Authorized(value="Purge People")
void purgePerson(Person person)
                 throws APIException
Purges a person from the database (cannot be undone)

Parameters:
person - person to be purged from the database
Throws:
APIException
Expected behavior:
delete person from the database

getPersonByUuid

@Transactional(readOnly=true)
@Authorized(value="View People")
Person getPersonByUuid(java.lang.String uuid)
                       throws APIException
Get Person by its UUID

Parameters:
uuid -
Returns:
Throws:
APIException
Expected behavior:
find object given valid uuid, return null if no object found with given uuid

getPersonAddressByUuid

@Transactional(readOnly=true)
@Authorized(value="View People")
PersonAddress getPersonAddressByUuid(java.lang.String uuid)
                                     throws APIException
Get PersonAddress by its UUID

Parameters:
uuid -
Returns:
Throws:
APIException
Expected behavior:
find object given valid uuid, return null if no object found with given uuid

getPersonAttributeByUuid

@Transactional(readOnly=true)
@Authorized(value="View People")
PersonAttribute getPersonAttributeByUuid(java.lang.String uuid)
                                         throws APIException
Get PersonAttribute by its UUID

Parameters:
uuid -
Returns:
Throws:
APIException
Expected behavior:
find object given valid uuid, return null if no object found with given uuid

getPersonNameByUuid

@Transactional(readOnly=true)
@Authorized(value="View People")
PersonName getPersonNameByUuid(java.lang.String uuid)
                               throws APIException
Get PersonName by its UUID

Parameters:
uuid -
Returns:
Throws:
APIException
Expected behavior:
find object given valid uuid, return null if no object found with given uuid

getPerson

@Transactional(readOnly=true)
@Authorized(value="View People")
Person getPerson(java.lang.Integer personId)
                 throws APIException
Gets a person by internal id

Parameters:
personId - internal identifier of person to get
Returns:
Person person with given internal identifier
Throws:
APIException
Expected behavior:
return null when no person has the given id

getPerson

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View People")
Person getPerson(Patient pat)
                 throws APIException
Deprecated. use getPerson(Integer)

Use either 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

Throws:
APIException

getPerson

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View People")
Person getPerson(User user)
                 throws APIException
Deprecated. use getPerson(Integer)

Use either 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

Throws:
APIException

createRelationshipType

@Deprecated
@Authorized(value="Manage Relationship Types")
void createRelationshipType(RelationshipType relationshipType)
                            throws APIException
Deprecated. replaced with #saveRelationshipType(RelationshipType)

Throws:
APIException

saveRelationshipType

@Authorized(value="Manage Relationship Types")
RelationshipType saveRelationshipType(RelationshipType relationshipType)
                                      throws APIException
Inserts or updates the given relationship type object in the database

Parameters:
relationshipType - type to be created or updated
Returns:
relationship type that was created or updated
Throws:
APIException
Expected behavior:
create new object when relationship type id is null, update existing object when relationship type id is not null

updateRelationshipType

@Deprecated
@Authorized(value="Manage Relationship Types")
void updateRelationshipType(RelationshipType relationshipType)
                            throws APIException
Deprecated. replaced by #saveRelationshipType(RelationshipType)

Throws:
APIException

deleteRelationshipType

@Deprecated
@Authorized(value="Purge Relationship Types")
void deleteRelationshipType(RelationshipType relationshipType)
                            throws APIException
Deprecated. replaced by #purgeRelationshipType(RelationshipType)

Throws:
APIException

purgeRelationshipType

@Authorized(value="Purge Relationship Types")
void purgeRelationshipType(RelationshipType relationshipType)
                           throws APIException
Purge relationship type from the database (cannot be undone)

Parameters:
relationshipType - relationship type to be purged
Throws:
APIException
Expected behavior:
delete relationship type from the database

getPersonAttributeTypes

@Transactional(readOnly=true)
@Authorized(value="View Person Attribute Types")
java.util.List<PersonAttributeType> getPersonAttributeTypes(OpenmrsConstants.PERSON_TYPE personType,
                                                                                          PersonService.ATTR_VIEW_TYPE viewType)
                                                            throws APIException
Gets the types defined for the given person type (person, user, patient) and the given type of view (one person vs many person objects)

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

getPersonAttributeTypes

@Deprecated
@Transactional(readOnly=true)
@Authorized(value="View Person Attribute Types")
java.util.List<PersonAttributeType> getPersonAttributeTypes(java.lang.String personType,
                                                                                                     java.lang.String viewType)
                                                            throws APIException
Deprecated. use getPersonAttributeTypes(String, String)

Throws:
APIException

splitPersonName

@Deprecated
PersonName splitPersonName(java.lang.String name)
Deprecated. replaced by parsePersonName(String)

Splits the name string into Given, Middle, and Family parts of a PersonName

Parameters:
name -
Returns:
fully formed PersonName object
See Also:
parsePersonName(String)

parsePersonName

PersonName parsePersonName(java.lang.String name)
                           throws APIException
Parses a name into a PersonName (separate Given, Middle, and Family names)

Parameters:
name - person name to be parsed
Returns:
parsed person name
Throws:
APIException
Expected behavior:
parse two person name with comma, parse two person name without comma, not fail when ending with whitespace, not fail when ending with a comma, parse four person name

getRelationshipMap

@Transactional(readOnly=true)
@Authorized(value="View Relationships")
java.util.Map<Person,java.util.List<Person>> getRelationshipMap(RelationshipType relationshipType)
                                                                throws APIException
Get all relationships for a given type of relationship mapped from the personA to all of the personB's

Parameters:
relationshipType - type of relationship for which to retrieve all relationships
Returns:
all relationships for the given type of relationship
Throws:
APIException
Expected behavior:
return empty map when no relationship has the matching relationship type

getRelationships

@Deprecated
@Transactional(readOnly=true)
java.util.Map<Person,java.util.List<Person>> getRelationships(RelationshipType relationshipType)
                                                              throws APIException
Deprecated. use getRelationshipMap(RelationshipType)

Throws:
APIException

OpenMRS-1.7.x

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