org.openmrs.api.db.hibernate
Class HibernatePatientDAO

java.lang.Object
  extended by org.openmrs.api.db.hibernate.HibernatePatientDAO
All Implemented Interfaces:
PatientDAO

public class HibernatePatientDAO
extends java.lang.Object
implements PatientDAO

Hibernate specific database methods for the PatientService

See Also:
Context, PatientDAO, PatientService

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
HibernatePatientDAO()
           
 
Method Summary
 void deletePatient(Patient patient)
          Delete patient from database.
 void deletePatientIdentifier(PatientIdentifier patientIdentifier)
           
 void deletePatientIdentifierType(PatientIdentifierType patientIdentifierType)
           
 java.util.List<PatientIdentifierType> getAllPatientIdentifierTypes(boolean includeRetired)
           
 java.util.List<Patient> getAllPatients(boolean includeVoided)
           
 java.util.List<Patient> getDuplicatePatientsByAttributes(java.util.List<java.lang.String> attributes)
           
 Patient getPatient(java.lang.Integer patientId)
           
 Patient getPatientByUuid(java.lang.String uuid)
          Auto generated method comment
 PatientIdentifier getPatientIdentifier(java.lang.Integer patientIdentifierId)
           
 PatientIdentifier getPatientIdentifierByUuid(java.lang.String uuid)
           
 java.util.List<PatientIdentifier> getPatientIdentifiers(java.lang.String identifier, java.util.List<PatientIdentifierType> patientIdentifierTypes, java.util.List<Location> locations, java.util.List<Patient> patients, java.lang.Boolean isPreferred)
           
 PatientIdentifierType getPatientIdentifierType(java.lang.Integer patientIdentifierTypeId)
           
 PatientIdentifierType getPatientIdentifierTypeByUuid(java.lang.String uuid)
          Auto generated method comment
 java.util.List<PatientIdentifierType> getPatientIdentifierTypes(java.lang.String name, java.lang.String format, java.lang.Boolean required, java.lang.Boolean hasCheckDigit)
           
 java.util.List<Patient> getPatients(java.lang.String name, java.lang.String identifier, java.util.List<PatientIdentifierType> identifierTypes, boolean matchIdentifierExactly)
           
 boolean isIdentifierInUseByAnotherPatient(PatientIdentifier patientIdentifier)
          This method uses a SQL query and does not load anything into the hibernate session.
 Patient savePatient(Patient patient)
           
 PatientIdentifier savePatientIdentifier(PatientIdentifier patientIdentifier)
           
 PatientIdentifierType savePatientIdentifierType(PatientIdentifierType patientIdentifierType)
           
 void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
          Set session factory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log
Constructor Detail

HibernatePatientDAO

public HibernatePatientDAO()
Method Detail

setSessionFactory

public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Set session factory

Parameters:
sessionFactory -

getPatient

public Patient getPatient(java.lang.Integer patientId)
Specified by:
getPatient in interface PatientDAO
See Also:
PatientService.getPatient(java.lang.Integer)

savePatient

public Patient savePatient(Patient patient)
                    throws DAOException
Specified by:
savePatient in interface PatientDAO
Throws:
DAOException
See Also:
PatientDAO.savePatient(org.openmrs.Patient)

getPatients

public java.util.List<Patient> getPatients(java.lang.String name,
                                           java.lang.String identifier,
                                           java.util.List<PatientIdentifierType> identifierTypes,
                                           boolean matchIdentifierExactly)
                                    throws DAOException
Specified by:
getPatients in interface PatientDAO
Throws:
DAOException
See Also:
PatientDAO.getPatients(java.lang.String, java.lang.String, java.util.List, boolean)

getAllPatients

public java.util.List<Patient> getAllPatients(boolean includeVoided)
                                       throws DAOException
Specified by:
getAllPatients in interface PatientDAO
Throws:
DAOException
See Also:
PatientDAO.getAllPatients(boolean)

deletePatientIdentifierType

public void deletePatientIdentifierType(PatientIdentifierType patientIdentifierType)
                                 throws DAOException
Specified by:
deletePatientIdentifierType in interface PatientDAO
Throws:
DAOException
See Also:
PatientService.purgePatientIdentifierType(org.openmrs.PatientIdentifierType), PatientDAO.deletePatientIdentifierType(org.openmrs.PatientIdentifierType)

getPatientIdentifiers

public java.util.List<PatientIdentifier> getPatientIdentifiers(java.lang.String identifier,
                                                               java.util.List<PatientIdentifierType> patientIdentifierTypes,
                                                               java.util.List<Location> locations,
                                                               java.util.List<Patient> patients,
                                                               java.lang.Boolean isPreferred)
                                                        throws DAOException
Specified by:
getPatientIdentifiers in interface PatientDAO
Throws:
DAOException
See Also:
PatientDAO.getPatientIdentifiers(java.lang.String, java.util.List, java.util.List, java.util.List, java.lang.Boolean), PatientService.getPatientIdentifiers(java.lang.String, java.util.List, java.util.List, java.util.List, java.lang.Boolean)

savePatientIdentifierType

public PatientIdentifierType savePatientIdentifierType(PatientIdentifierType patientIdentifierType)
                                                throws DAOException
Specified by:
savePatientIdentifierType in interface PatientDAO
Throws:
DAOException
See Also:
PatientDAO.savePatientIdentifierType(org.openmrs.PatientIdentifierType)

deletePatient

public void deletePatient(Patient patient)
                   throws DAOException
Description copied from interface: PatientDAO
Delete patient from database. This should not be called except for testing and administration purposes. Use the void method instead

Specified by:
deletePatient in interface PatientDAO
Parameters:
patient - patient to be deleted
Throws:
DAOException
See Also:
PatientService.deletePatient(org.openmrs.Patient)

getPatientIdentifierType

public PatientIdentifierType getPatientIdentifierType(java.lang.Integer patientIdentifierTypeId)
                                               throws DAOException
Specified by:
getPatientIdentifierType in interface PatientDAO
Throws:
DAOException
See Also:
PatientService.getPatientIdentifierType(java.lang.Integer)

getAllPatientIdentifierTypes

public java.util.List<PatientIdentifierType> getAllPatientIdentifierTypes(boolean includeRetired)
                                                                   throws DAOException
Specified by:
getAllPatientIdentifierTypes in interface PatientDAO
Throws:
DAOException
See Also:
PatientDAO.getAllPatientIdentifierTypes(boolean)

getPatientIdentifierTypes

public java.util.List<PatientIdentifierType> getPatientIdentifierTypes(java.lang.String name,
                                                                       java.lang.String format,
                                                                       java.lang.Boolean required,
                                                                       java.lang.Boolean hasCheckDigit)
                                                                throws DAOException
Specified by:
getPatientIdentifierTypes in interface PatientDAO
Throws:
DAOException
See Also:
PatientDAO.getPatientIdentifierTypes(java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Boolean)

getDuplicatePatientsByAttributes

public java.util.List<Patient> getDuplicatePatientsByAttributes(java.util.List<java.lang.String> attributes)
Specified by:
getDuplicatePatientsByAttributes in interface PatientDAO
See Also:
PatientDAO.getDuplicatePatientsByAttributes(java.util.List)

getPatientByUuid

public Patient getPatientByUuid(java.lang.String uuid)
Description copied from interface: PatientDAO
Auto generated method comment

Specified by:
getPatientByUuid in interface PatientDAO
Returns:
See Also:
PatientDAO.getPatientByUuid(java.lang.String)

getPatientIdentifierByUuid

public PatientIdentifier getPatientIdentifierByUuid(java.lang.String uuid)
Specified by:
getPatientIdentifierByUuid in interface PatientDAO

getPatientIdentifierTypeByUuid

public PatientIdentifierType getPatientIdentifierTypeByUuid(java.lang.String uuid)
Description copied from interface: PatientDAO
Auto generated method comment

Specified by:
getPatientIdentifierTypeByUuid in interface PatientDAO
Returns:
See Also:
PatientDAO.getPatientIdentifierTypeByUuid(java.lang.String)

isIdentifierInUseByAnotherPatient

public boolean isIdentifierInUseByAnotherPatient(PatientIdentifier patientIdentifier)
This method uses a SQL query and does not load anything into the hibernate session. It exists because of ticket #1375.

Specified by:
isIdentifierInUseByAnotherPatient in interface PatientDAO
See Also:
PatientDAO.isIdentifierInUseByAnotherPatient(org.openmrs.PatientIdentifier)

getPatientIdentifier

public PatientIdentifier getPatientIdentifier(java.lang.Integer patientIdentifierId)
                                       throws DAOException
Specified by:
getPatientIdentifier in interface PatientDAO
Throws:
DAOException
See Also:
PatientDAO.getPatientIdentifier(java.lang.Integer)

savePatientIdentifier

public PatientIdentifier savePatientIdentifier(PatientIdentifier patientIdentifier)
Specified by:
savePatientIdentifier in interface PatientDAO
See Also:
PatientDAO.savePatientIdentifier(org.openmrs.PatientIdentifier)

deletePatientIdentifier

public void deletePatientIdentifier(PatientIdentifier patientIdentifier)
                             throws DAOException
Specified by:
deletePatientIdentifier in interface PatientDAO
Throws:
DAOException
See Also:
PatientService.purgePatientIdentifier(org.openmrs.PatientIdentifier), PatientDAO.deletePatientIdentifier(org.openmrs.PatientIdentifier)

OpenMRS-1.7.x

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