org.openmrs.api
Interface PersonService

All Known Implementing Classes:
PersonServiceImpl

@Transactional
public interface PersonService

Contains methods pertaining to Persons in the system Use:

   List 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)
          Delete a Person Attribute Type
 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 or without the retired ones
 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)
 PersonAttribute getPersonAttribute(java.lang.Integer id)
          Get a PersonAttribute from the database with the given PersonAttributeid
 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
 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(PERSON_TYPE, org.openmrs.api.PersonService.ATTR_VIEW_TYPE)
 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
 Relationship getRelationship(java.lang.Integer relationshipId)
          Get relationship by internal relationship identifier
 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
 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.
 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)
 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 setCollectionProperties(Person person)
          Deprecated. replaced by savePerson(Person)
 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 {@link #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:
Throws:
APIException

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

findPeople

@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

@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

@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

Parameters:
type -
Returns:
the saved person attribute type
Throws:
APIException

createPersonAttributeType

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

Throws:
APIException

deletePersonAttributeType

@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

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

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

deletePersonAttributeType

@Authorized(value="Manage Person Attribute Types")
void deletePersonAttributeType(java.lang.Integer attrTypeId)
                               throws APIException
Delete a Person Attribute Type

Parameters:
attrTypeId -
Throws:
APIException

updatePersonAttributeType

@Authorized(value="Manage Person Attribute Types")
void updatePersonAttributeType(PersonAttributeType type)
                               throws APIException
Deprecated. use {@link #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)

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 - true/false whether to include the person attribute types
Returns:
Throws:
APIException

getPersonAttributeTypes

@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

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

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

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

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

getPersonAttributeType

@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

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

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

getRelationships

@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:
person - object listed on either side of the relationship
Returns:
Relationship list
Throws:
APIException

getRelationships

@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

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

Throws:
APIException

getRelationshipsTo

@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

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

getAllRelationshipTypes

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

Parameters:
includeRetired - true/false whether or not to include the relationship types
Returns:
relationshipType list
Throws:
APIException

getRelationshipTypes

@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:
relationshipType - id
Returns:
relationshipType with given internal identifier or null if none found
Throws:
APIException

findRelationshipType

@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

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

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

createRelationship

@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

updateRelationship

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

Throws:
APIException

deleteRelationship

@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

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 - to void
Returns:
the newly saved relationship
Throws:
APIException

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 - to unvoid
Returns:
the newly unvoided relationship
Throws:
APIException

createPerson

@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

updatePerson

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

Throws:
APIException

deletePerson

@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

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

getPerson

@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

@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

@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

updateRelationshipType

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

Throws:
APIException

deleteRelationshipType

@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

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

@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(PERSON_TYPE, org.openmrs.api.PersonService.ATTR_VIEW_TYPE)

Throws:
APIException

setCollectionProperties

void setCollectionProperties(Person person)
Deprecated. replaced by savePerson(Person)

Iterates over Names/Addresses/Attributes to set dateCreated and creator properties if needed

Parameters:
person -

splitPersonName

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

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

getRelationships

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

Throws:
APIException

OpenMRS-trunk

Generated May 29 2008 02:01 AM. NOTE - these libraries are in active development and subject to change