org.openmrs.api.db.hibernate
Class HibernateProgramWorkflowDAO

java.lang.Object
  extended by org.openmrs.api.db.hibernate.HibernateProgramWorkflowDAO
All Implemented Interfaces:
ProgramWorkflowDAO

public class HibernateProgramWorkflowDAO
extends java.lang.Object
implements ProgramWorkflowDAO

Hibernate specific ProgramWorkflow related functions.

This class should not be used directly. All calls should go through the ProgramWorkflowService methods.

See Also:
ProgramWorkflowDAO, ProgramWorkflowService

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
HibernateProgramWorkflowDAO()
           
 
Method Summary
 void deleteConceptStateConversion(ConceptStateConversion csc)
          Completely remove a conceptStateConversion from the database (not reversible)
 void deletePatientProgram(PatientProgram patientProgram)
          Completely remove a patientProgram from the database (not reversible) This method delegates to #purgePatientProgram(patientProgram, boolean) method
 void deleteProgram(Program program)
          Completely remove a program from the database (not reversible) This method delegates to #purgeProgram(program, boolean) method
 java.util.List<Program> findPrograms(java.lang.String nameFragment)
          Returns programs that match the given string.
 java.util.List<ConceptStateConversion> getAllConceptStateConversions()
          Returns all conceptStateConversions
 java.util.List<Program> getAllPrograms(boolean includeRetired)
          Returns all programs
 ConceptStateConversion getConceptStateConversion(java.lang.Integer conceptStateConversionId)
          Returns a conceptStateConversion given that conceptStateConversions primary key conceptStateConversionId A null value is returned if no conceptStateConversion exists with this conceptStateConversionId.
 ConceptStateConversion getConceptStateConversion(ProgramWorkflow workflow, Concept trigger)
          Retrieves the ConceptStateConversion that matches the passed ProgramWorkflow and Concept
 ConceptStateConversion getConceptStateConversionByUuid(java.lang.String uuid)
          Auto generated method comment
 PatientProgram getPatientProgram(java.lang.Integer patientProgramId)
          Returns a PatientProgram given that PatientPrograms primary key patientProgramId A null value is returned if no PatientProgram exists with this patientProgramId.
 PatientProgram getPatientProgramByUuid(java.lang.String uuid)
          Auto generated method comment
 java.util.List<PatientProgram> getPatientPrograms(Cohort cohort, java.util.Collection<Program> programs)
          TODO: refactor this
 java.util.List<PatientProgram> getPatientPrograms(Patient patient, Program program, java.util.Date minEnrollmentDate, java.util.Date maxEnrollmentDate, java.util.Date minCompletionDate, java.util.Date maxCompletionDate, boolean includeVoided)
          Returns PatientPrograms that match the input parameters.
 PatientState getPatientStateByUuid(java.lang.String uuid)
           
 Program getProgram(java.lang.Integer programId)
          Retrieves a Program from the database by primary key programId
 Program getProgramByUuid(java.lang.String uuid)
          Auto generated method comment
 ProgramWorkflowState getStateByUuid(java.lang.String uuid)
          Auto generated method comment
 ProgramWorkflow getWorkflowByUuid(java.lang.String uuid)
          Auto generated method comment
 ConceptStateConversion saveConceptStateConversion(ConceptStateConversion csc)
          Save ConceptStateConversion to database (create if new or update if changed)
 PatientProgram savePatientProgram(PatientProgram patientProgram)
          Save patientProgram to database (create if new or update if changed)
 Program saveProgram(Program program)
          Saves a Program to the database
 void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
          Hibernate 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

HibernateProgramWorkflowDAO

public HibernateProgramWorkflowDAO()
Method Detail

setSessionFactory

public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Hibernate Session Factory

Parameters:
sessionFactory -

saveProgram

public Program saveProgram(Program program)
                    throws DAOException
Description copied from interface: ProgramWorkflowDAO
Saves a Program to the database

Specified by:
saveProgram in interface ProgramWorkflowDAO
Parameters:
program - - The Program to save
Returns:
The saved Program
Throws:
DAOException
See Also:
ProgramWorkflowDAO.saveProgram(org.openmrs.Program)

getProgram

public Program getProgram(java.lang.Integer programId)
                   throws DAOException
Description copied from interface: ProgramWorkflowDAO
Retrieves a Program from the database by primary key programId

Specified by:
getProgram in interface ProgramWorkflowDAO
Parameters:
programId - - The primary key programId to use to retrieve a Program
Returns:
Program - The Program matching the passed programId
Throws:
DAOException
See Also:
ProgramWorkflowDAO.getProgram(java.lang.Integer)

getAllPrograms

public java.util.List<Program> getAllPrograms(boolean includeRetired)
                                       throws DAOException
Description copied from interface: ProgramWorkflowDAO
Returns all programs

Specified by:
getAllPrograms in interface ProgramWorkflowDAO
Parameters:
includeRetired - whether or not to include retired programs
Returns:
List all existing programs, including retired based on the input parameter
Throws:
DAOException
See Also:
ProgramWorkflowDAO.getAllPrograms(boolean)

findPrograms

public java.util.List<Program> findPrograms(java.lang.String nameFragment)
                                     throws DAOException
Description copied from interface: ProgramWorkflowDAO
Returns programs that match the given string. A null list will never be returned. An empty list will be returned if there are no programs matching this nameFragment

Specified by:
findPrograms in interface ProgramWorkflowDAO
Parameters:
nameFragment - is the string used to search for programs
Returns:
List - list of Programs whose name matches the input parameter
Throws:
DAOException
See Also:
ProgramWorkflowDAO.findPrograms(java.lang.String)

deleteProgram

public void deleteProgram(Program program)
                   throws DAOException
Description copied from interface: ProgramWorkflowDAO
Completely remove a program from the database (not reversible) This method delegates to #purgeProgram(program, boolean) method

Specified by:
deleteProgram in interface ProgramWorkflowDAO
Parameters:
program - the Program to clean out of the database.
Throws:
DAOException
See Also:
ProgramWorkflowDAO.deleteProgram(org.openmrs.Program)

savePatientProgram

public PatientProgram savePatientProgram(PatientProgram patientProgram)
                                  throws DAOException
Description copied from interface: ProgramWorkflowDAO
Save patientProgram to database (create if new or update if changed)

Specified by:
savePatientProgram in interface ProgramWorkflowDAO
Parameters:
patientProgram - is the PatientProgram to be saved to the database
Returns:
PatientProgram - the saved PatientProgram
Throws:
DAOException
See Also:
ProgramWorkflowDAO.savePatientProgram(org.openmrs.PatientProgram)

getPatientProgram

public PatientProgram getPatientProgram(java.lang.Integer patientProgramId)
                                 throws DAOException
Description copied from interface: ProgramWorkflowDAO
Returns a PatientProgram given that PatientPrograms primary key patientProgramId A null value is returned if no PatientProgram exists with this patientProgramId.

Specified by:
getPatientProgram in interface ProgramWorkflowDAO
Parameters:
patientProgramId - integer primary key of the PatientProgram to find
Returns:
PatientProgram object that has patientProgram.patientProgramId = patientProgramId passed in.
Throws:
DAOException
See Also:
ProgramWorkflowDAO.getPatientProgram(java.lang.Integer)

getPatientPrograms

public java.util.List<PatientProgram> getPatientPrograms(Patient patient,
                                                         Program program,
                                                         java.util.Date minEnrollmentDate,
                                                         java.util.Date maxEnrollmentDate,
                                                         java.util.Date minCompletionDate,
                                                         java.util.Date maxCompletionDate,
                                                         boolean includeVoided)
                                                  throws DAOException
Description copied from interface: ProgramWorkflowDAO
Returns PatientPrograms that match the input parameters. If an input parameter is set to null, the parameter will not be used. Calling this method will all null parameters will return all PatientPrograms in the database A null list will never be returned. An empty list will be returned if there are no programs matching the input criteria

Specified by:
getPatientPrograms in interface ProgramWorkflowDAO
Parameters:
patient - - if supplied all PatientPrograms returned will be for this Patient
program - - if supplied all PatientPrograms returned will be for this Program
minEnrollmentDate - - if supplied will limit PatientPrograms to those with enrollments on or after this Date
maxEnrollmentDate - - if supplied will limit PatientPrograms to those with enrollments on or before this Date
minCompletionDate - - if supplied will limit PatientPrograms to those completed on or after this Date OR not yet completed
maxCompletionDate - - if supplied will limit PatientPrograms to those completed on or before this Date
includeVoided - - boolean, if true will return voided PatientPrograms as well. If false, will not return voided PatientPrograms
Returns:
List of PatientPrograms that match the passed input parameters
Throws:
DAOException
See Also:
ProgramWorkflowDAO.getPatientPrograms(Patient, Program, Date, Date, Date, Date, boolean)

getPatientPrograms

public java.util.List<PatientProgram> getPatientPrograms(Cohort cohort,
                                                         java.util.Collection<Program> programs)
TODO: refactor this

Specified by:
getPatientPrograms in interface ProgramWorkflowDAO
See Also:
ProgramWorkflowDAO.getPatientPrograms(org.openmrs.Cohort, java.util.Collection)

deletePatientProgram

public void deletePatientProgram(PatientProgram patientProgram)
                          throws DAOException
Description copied from interface: ProgramWorkflowDAO
Completely remove a patientProgram from the database (not reversible) This method delegates to #purgePatientProgram(patientProgram, boolean) method

Specified by:
deletePatientProgram in interface ProgramWorkflowDAO
Parameters:
patientProgram - the PatientProgram to clean out of the database.
Throws:
DAOException
See Also:
ProgramWorkflowDAO.deletePatientProgram(org.openmrs.PatientProgram)

saveConceptStateConversion

public ConceptStateConversion saveConceptStateConversion(ConceptStateConversion csc)
                                                  throws DAOException
Description copied from interface: ProgramWorkflowDAO
Save ConceptStateConversion to database (create if new or update if changed)

Specified by:
saveConceptStateConversion in interface ProgramWorkflowDAO
Parameters:
csc - The ConceptStateConversion to save
Returns:
The saved ConceptStateConversion
Throws:
DAOException
See Also:
ProgramWorkflowDAO.saveConceptStateConversion(org.openmrs.ConceptStateConversion)

getAllConceptStateConversions

public java.util.List<ConceptStateConversion> getAllConceptStateConversions()
                                                                     throws DAOException
Description copied from interface: ProgramWorkflowDAO
Returns all conceptStateConversions

Specified by:
getAllConceptStateConversions in interface ProgramWorkflowDAO
Returns:
List of all ConceptStateConversions that exist
Throws:
DAOException
See Also:
ProgramWorkflowDAO.getAllConceptStateConversions()

getConceptStateConversion

public ConceptStateConversion getConceptStateConversion(java.lang.Integer conceptStateConversionId)
Description copied from interface: ProgramWorkflowDAO
Returns a conceptStateConversion given that conceptStateConversions primary key conceptStateConversionId A null value is returned if no conceptStateConversion exists with this conceptStateConversionId.

Specified by:
getConceptStateConversion in interface ProgramWorkflowDAO
Parameters:
conceptStateConversionId - integer primary key of the conceptStateConversion to find
Returns:
ConceptStateConversion object that has conceptStateConversion.conceptStateConversionId = conceptStateConversionId passed in.
See Also:
ProgramWorkflowDAO.getConceptStateConversion(java.lang.Integer)

deleteConceptStateConversion

public void deleteConceptStateConversion(ConceptStateConversion csc)
Description copied from interface: ProgramWorkflowDAO
Completely remove a conceptStateConversion from the database (not reversible)

Specified by:
deleteConceptStateConversion in interface ProgramWorkflowDAO
Parameters:
csc - the ConceptStateConversion to clean out of the database.
See Also:
ProgramWorkflowDAO.deleteConceptStateConversion(org.openmrs.ConceptStateConversion)

getConceptStateConversion

public ConceptStateConversion getConceptStateConversion(ProgramWorkflow workflow,
                                                        Concept trigger)
Description copied from interface: ProgramWorkflowDAO
Retrieves the ConceptStateConversion that matches the passed ProgramWorkflow and Concept

Specified by:
getConceptStateConversion in interface ProgramWorkflowDAO
Parameters:
workflow - the ProgramWorkflow to check
trigger - the Concept to check
Returns:
ConceptStateConversion that matches the passed ProgramWorkflow and Concept
See Also:
ProgramWorkflowDAO.getConceptStateConversion(org.openmrs.ProgramWorkflow, org.openmrs.Concept)

getConceptStateConversionByUuid

public ConceptStateConversion getConceptStateConversionByUuid(java.lang.String uuid)
Description copied from interface: ProgramWorkflowDAO
Auto generated method comment

Specified by:
getConceptStateConversionByUuid in interface ProgramWorkflowDAO
Returns:
See Also:
ProgramWorkflowDAO.getConceptStateConversionByUuid(java.lang.String)

getPatientProgramByUuid

public PatientProgram getPatientProgramByUuid(java.lang.String uuid)
Description copied from interface: ProgramWorkflowDAO
Auto generated method comment

Specified by:
getPatientProgramByUuid in interface ProgramWorkflowDAO
Returns:
See Also:
ProgramWorkflowDAO.getPatientProgramByUuid(java.lang.String)

getProgramByUuid

public Program getProgramByUuid(java.lang.String uuid)
Description copied from interface: ProgramWorkflowDAO
Auto generated method comment

Specified by:
getProgramByUuid in interface ProgramWorkflowDAO
Returns:
See Also:
ProgramWorkflowDAO.getProgramByUuid(java.lang.String)

getStateByUuid

public ProgramWorkflowState getStateByUuid(java.lang.String uuid)
Description copied from interface: ProgramWorkflowDAO
Auto generated method comment

Specified by:
getStateByUuid in interface ProgramWorkflowDAO
Returns:
See Also:
ProgramWorkflowDAO.getStateByUuid(java.lang.String)

getPatientStateByUuid

public PatientState getPatientStateByUuid(java.lang.String uuid)
Specified by:
getPatientStateByUuid in interface ProgramWorkflowDAO

getWorkflowByUuid

public ProgramWorkflow getWorkflowByUuid(java.lang.String uuid)
Description copied from interface: ProgramWorkflowDAO
Auto generated method comment

Specified by:
getWorkflowByUuid in interface ProgramWorkflowDAO
Returns:
See Also:
ProgramWorkflowDAO.getWorkflowByUuid(java.lang.String)

OpenMRS-1.7.x

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