org.openmrs.api.db.hibernate
Class HibernateCohortDAO

java.lang.Object
  extended by org.openmrs.api.db.hibernate.HibernateCohortDAO
All Implemented Interfaces:
CohortDAO

public class HibernateCohortDAO
extends java.lang.Object
implements CohortDAO

Hibernate implementation of the CohortDAO

See Also:
CohortDAO, Context, CohortService

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
HibernateCohortDAO()
           
 
Method Summary
 Cohort deleteCohort(Cohort cohort)
          Removes a cohort from the database
 java.util.List<Cohort> getAllCohorts(boolean includeVoided)
          Gets all cohorts in the database
 Cohort getCohort(java.lang.Integer id)
          Finds the cohort with the given primary key
 Cohort getCohort(java.lang.String name)
          Finds a cohort by name
 Cohort getCohortByUuid(java.lang.String uuid)
          Auto generated method comment
 java.util.List<Cohort> getCohorts(java.lang.String nameFragment)
          Finds all Cohorts with matching names
 java.util.List<Cohort> getCohortsContainingPatientId(java.lang.Integer patientId)
          Finds all cohorts that contain the given patientId
 Cohort saveCohort(Cohort cohort)
          Saves a Cohort to the database
 void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
          Auto generated method comment
 
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

HibernateCohortDAO

public HibernateCohortDAO()
Method Detail

setSessionFactory

public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Auto generated method comment

Parameters:
sessionFactory -

getCohort

public Cohort getCohort(java.lang.Integer id)
                 throws DAOException
Description copied from interface: CohortDAO
Finds the cohort with the given primary key

Specified by:
getCohort in interface CohortDAO
Returns:
The cohort with the given cohortId, or null if none exists
Throws:
DAOException
See Also:
CohortDAO.getCohort(java.lang.Integer)

getCohortsContainingPatientId

public java.util.List<Cohort> getCohortsContainingPatientId(java.lang.Integer patientId)
                                                     throws DAOException
Description copied from interface: CohortDAO
Finds all cohorts that contain the given patientId

Specified by:
getCohortsContainingPatientId in interface CohortDAO
Returns:
List object of matching Cohorts
Throws:
DAOException
See Also:
CohortDAO.getCohortsContainingPatientId(java.lang.Integer)

getCohortByUuid

public Cohort getCohortByUuid(java.lang.String uuid)
Description copied from interface: CohortDAO
Auto generated method comment

Specified by:
getCohortByUuid in interface CohortDAO
Returns:
See Also:
CohortDAO.getCohortByUuid(java.lang.String)

deleteCohort

public Cohort deleteCohort(Cohort cohort)
                    throws DAOException
Description copied from interface: CohortDAO
Removes a cohort from the database

Specified by:
deleteCohort in interface CohortDAO
Returns:
the deleted Cohort
Throws:
DAOException
See Also:
CohortDAO.deleteCohort(org.openmrs.Cohort)

getCohorts

public java.util.List<Cohort> getCohorts(java.lang.String nameFragment)
                                  throws DAOException
Description copied from interface: CohortDAO
Finds all Cohorts with matching names

Specified by:
getCohorts in interface CohortDAO
Returns:
List object of matching Cohorts
Throws:
DAOException
See Also:
CohortDAO.getCohorts(java.lang.String)

getAllCohorts

public java.util.List<Cohort> getAllCohorts(boolean includeVoided)
                                     throws DAOException
Description copied from interface: CohortDAO
Gets all cohorts in the database

Specified by:
getAllCohorts in interface CohortDAO
Parameters:
includeVoided - whether to include voided cohorts
Returns:
All cohorts in the database, possibly including voided ones
Throws:
DAOException
See Also:
CohortDAO.getAllCohorts(boolean)

getCohort

public Cohort getCohort(java.lang.String name)
Description copied from interface: CohortDAO
Finds a cohort by name

Specified by:
getCohort in interface CohortDAO
Returns:
The Cohort with the given name, or null if none exists
See Also:
CohortDAO.getCohort(java.lang.String)

saveCohort

public Cohort saveCohort(Cohort cohort)
                  throws DAOException
Description copied from interface: CohortDAO
Saves a Cohort to the database

Specified by:
saveCohort in interface CohortDAO
Parameters:
cohort - Cohort to save
Returns:
the saved Cohort
Throws:
DAOException
See Also:
CohortDAO.saveCohort(org.openmrs.Cohort)

OpenMRS-1.7.x

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