org.openmrs.api
Interface ProgramWorkflowService

All Superinterfaces:
OpenmrsService
All Known Implementing Classes:
ProgramWorkflowServiceImpl

@Transactional
public interface ProgramWorkflowService
extends OpenmrsService

Contains methods pertaining to management of Programs, ProgramWorkflows, ProgramWorkflowStates, PatientPrograms, PatientStates, and ConceptStateConversions Use:

   Program program = new Program();
   program.set___(___);
   ...etc
   Context.getProgramWorkflowService().saveProgram(program);
 


Method Summary
 void changeToState(PatientProgram patientProgram, ProgramWorkflow workflow, ProgramWorkflowState state, java.util.Date onDate)
          Deprecated. use PatientProgram.transitionToState(ProgramWorkflowState, Date)
 void createConceptStateConversion(ConceptStateConversion conceptStateConversion)
          Deprecated. use saveConceptStateConversion(ConceptStateConversion)
 void createOrUpdateProgram(Program program)
          Deprecated. use saveProgram(Program)
 void createPatientProgram(PatientProgram patientProgram)
          Deprecated. use savePatientProgram(PatientProgram)
 void createWorkflow(ProgramWorkflow programWorkflow)
          Deprecated. use followed by @link #saveProgram(Program)
 void deleteConceptStateConversion(ConceptStateConversion csc)
          Deprecated. use purgeConceptStateConversion(ConceptStateConversion)
 void enrollPatientInProgram(Patient patient, Program program, java.util.Date enrollmentDate, java.util.Date completionDate, User creator)
          Deprecated. use {new PatientProgram(...) followed by @link #savePatientProgram(PatientProgram)}
 java.util.List<ConceptStateConversion> getAllConceptStateConversions()
          Returns all conceptStateConversions
 java.util.List<ConceptStateConversion> getAllConversions()
          Deprecated. use getAllConceptStateConversions()
 java.util.List<Program> getAllPrograms()
          Returns all programs, includes retired programs.
 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
 java.util.Collection<PatientProgram> getCurrentPrograms(Patient patient, java.util.Date onDate)
          Deprecated. use getPatientPrograms(Patient, Program, Date, Date, Date, Date)
 java.util.Set<ProgramWorkflow> getCurrentWorkflowsByPatient(Patient patient)
          Deprecated. No current use outside of this service. Should be retrieved from Patient, PatientProgram, and PatientState
 java.util.Set<ProgramWorkflow> getCurrentWorkflowsByPatientProgram(PatientProgram program)
          Deprecated. No current use outside of this service. Should be retrieved from Patient, PatientProgram, and PatientState
 PatientState getLatestState(PatientProgram patientProgram, ProgramWorkflow programWorkflow)
          Deprecated. use PatientProgram.getCurrentState(ProgramWorkflow)
 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.
 java.util.List<PatientProgram> getPatientPrograms(Cohort cohort, java.util.Collection<Program> programs)
          TODO: refactor?
 java.util.Collection<PatientProgram> getPatientPrograms(Patient patient)
          Deprecated. use getPatientPrograms(Patient, Program, Date, Date, Date, Date)
 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 getPatientState(java.lang.Integer patientStateId)
          Deprecated. use PatientProgram.getPatientState(Integer)
 java.util.List<ProgramWorkflowState> getPossibleNextStates(PatientProgram patientProgram, ProgramWorkflow workflow)
          Deprecated. use ProgramWorkflow.getPossibleNextStates(PatientProgram)
 Program getProgram(java.lang.Integer programId)
          Returns a program given that programs primary key programId A null value is returned if no program exists with this programId.
 Program getProgram(java.lang.String name)
          Deprecated. use getProgramByName(String)
 Program getProgramByName(java.lang.String name)
          Returns a program given the program's exact name A null value is returned if there is no program with this name
 java.util.List<Program> getPrograms()
          Deprecated. use getAllPrograms()
 java.util.List<Program> getPrograms(java.lang.String nameFragment)
          Returns programs that match the given string.
 ProgramWorkflowState getState(java.lang.Integer id)
          Deprecated. ProgramWorkflowStates should be retrieved from the ProgramWorkflow they belong to
 ProgramWorkflowState getState(ProgramWorkflow programWorkflow, java.lang.String name)
          Deprecated. ProgramWorkflowStates should be retrieved from the ProgramWorkflow they belong to
 java.util.List<ProgramWorkflowState> getStates()
          Deprecated. ProgramWorkflowStates should be retrieved from the ProgramWorkflow they belong to
 java.util.List<ProgramWorkflowState> getStates(boolean includeVoided)
          Deprecated. ProgramWorkflowStates should be retrieved from the ProgramWorkflow they belong to
 ProgramWorkflow getWorkflow(java.lang.Integer id)
          Deprecated. ProgramWorkflows should not be retrieved directly, but rather through the programs they belong to: use Program#getWorkflow(Integer)
 ProgramWorkflow getWorkflow(Program program, java.lang.String name)
          Deprecated. use Program.getWorkflowByName(String)
 boolean isInProgram(Patient patient, Program program, java.util.Date fromDate, java.util.Date toDate)
          Deprecated. use getPatientPrograms(Patient, Program, Date, Date, Date, Date)
 boolean isLegalTransition(ProgramWorkflowState fromState, ProgramWorkflowState toState)
          Deprecated. use ProgramWorkflow.isLegalTransition(ProgramWorkflowState, ProgramWorkflowState)
 java.util.Collection<java.lang.Integer> patientsInProgram(Program program, java.util.Date fromDate, java.util.Date toDate)
          Deprecated. use getPatientPrograms(Patient, Program, Date, Date, Date, Date) which can be Iterated across to return collection of patient ids
 void purgeConceptStateConversion(ConceptStateConversion conceptStateConversion)
          Completely remove a conceptStateConversion from the database (not reversible) This method delegates to #purgeConceptStateConversion(conceptStateConversion, boolean) method
 void purgeConceptStateConversion(ConceptStateConversion conceptStateConversion, boolean cascade)
          Completely remove a conceptStateConversion from the database (not reversible)
 void purgePatientProgram(PatientProgram patientProgram)
          Completely remove a patientProgram from the database (not reversible) This method delegates to #purgePatientProgram(patientProgram, boolean) method
 void purgePatientProgram(PatientProgram patientProgram, boolean cascade)
          Completely remove a patientProgram from the database (not reversible)
 void purgeProgram(Program program)
          Completely remove a program from the database (not reversible) This method delegates to #purgeProgram(program, boolean) method
 void purgeProgram(Program program, boolean cascade)
          Completely remove a program from the database (not reversible)
 Program retireProgram(Program program)
          Retires the given program
 ConceptStateConversion saveConceptStateConversion(ConceptStateConversion conceptStateConversion)
          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)
          Save program to database (create if new or update if changed)
 void setProgramWorkflowDAO(ProgramWorkflowDAO dao)
          Setter for the ProgramWorkflow DataAccessObject (DAO).
 void terminatePatientProgram(PatientProgram patientProgram, ProgramWorkflowState finalState, java.util.Date terminatedOn)
          Deprecated. use PatientProgram.transitionToState(ProgramWorkflowState, Date)
 void triggerStateConversion(Patient patient, Concept reasonForExit, java.util.Date dateConverted)
          Triggers any ConceptStateConversion that exists for the passed reasonForExit concept and any ProgramWorkflow in the PatientPrograms for the patient
 Program unRetireProgram(Program program)
          Unretires the given program
 PatientProgram unvoidPatientProgram(PatientProgram patientProgram)
          Unvoids the given patientProgram
 void updateConceptStateConversion(ConceptStateConversion conceptStateConversion)
          Deprecated. use saveConceptStateConversion(ConceptStateConversion)
 void updatePatientProgram(PatientProgram patientProgram)
          Deprecated. use savePatientProgram(PatientProgram)
 void updateWorkflow(ProgramWorkflow programWorkflow)
          Deprecated. use to save changes to all ProgramWorkflows for the given Program
 void voidLastState(PatientProgram patientProgram, ProgramWorkflow wf, java.lang.String voidReason)
          Deprecated. use PatientProgram.voidLastState(ProgramWorkflow, User, Date, String)
 PatientProgram voidPatientProgram(PatientProgram patientProgram, java.lang.String reason)
          Voids the given patientProgram
 void voidWorkflow(ProgramWorkflow programWorkflow, java.lang.String reason)
          Deprecated. use followed by @link #saveProgram(Program)
 
Methods inherited from interface org.openmrs.api.OpenmrsService
onShutdown, onStartup
 

Method Detail

setProgramWorkflowDAO

void setProgramWorkflowDAO(ProgramWorkflowDAO dao)
Setter for the ProgramWorkflow DataAccessObject (DAO). The DAO is used for saving and retrieving from the database

Parameters:
dao - - The DAO for this service

saveProgram

@Authorized(value="Manage Programs")
Program saveProgram(Program program)
                    throws APIException
Save program to database (create if new or update if changed)

Parameters:
program - is the Program to be saved to the database
Returns:
The Program that was saved
Throws:
APIException

getProgram

@Authorized(value="View Programs")
@Transactional(readOnly=true)
Program getProgram(java.lang.Integer programId)
                   throws APIException
Returns a program given that programs primary key programId A null value is returned if no program exists with this programId.

Parameters:
programId - integer primary key of the program to find
Throws:
APIException

getProgram

@Transactional(readOnly=true)
Program getProgram(java.lang.String name)
Deprecated. use getProgramByName(String)


getProgramByName

@Authorized(value="View Programs")
@Transactional(readOnly=true)
Program getProgramByName(java.lang.String name)
                         throws APIException
Returns a program given the program's exact name A null value is returned if there is no program with this name

Parameters:
name - the exact name of the program to match on
Throws:
APIException

getAllPrograms

@Authorized(value="View Programs")
@Transactional(readOnly=true)
java.util.List<Program> getAllPrograms()
                                       throws APIException
Returns all programs, includes retired programs. This method delegates to the #getAllPrograms(boolean) method

Throws:
APIException

getAllPrograms

@Authorized(value="View Programs")
@Transactional(readOnly=true)
java.util.List<Program> getAllPrograms(boolean includeRetired)
                                       throws APIException
Returns all programs

Parameters:
includeRetired - whether or not to include retired programs
Returns:
List all existing programs, including retired based on the input parameter
Throws:
APIException

getPrograms

@Authorized(value="View Programs")
@Transactional(readOnly=true)
java.util.List<Program> getPrograms(java.lang.String nameFragment)
                                    throws APIException
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

Parameters:
nameFragment - is the string used to search for programs
Returns:
List - list of Programs whose name matches the input parameter
Throws:
APIException

purgeProgram

@Authorized(value="Manage Programs")
void purgeProgram(Program program)
                  throws APIException
Completely remove a program from the database (not reversible) This method delegates to #purgeProgram(program, boolean) method

Parameters:
program - the Program to clean out of the database.
Throws:
APIException

purgeProgram

@Authorized(value="Manage Programs")
void purgeProgram(Program program,
                                  boolean cascade)
                  throws APIException
Completely remove a program from the database (not reversible)

Parameters:
cascade - true to delete related content
Throws:
APIException

retireProgram

@Authorized(value="Manage Programs")
Program retireProgram(Program program)
                      throws APIException
Retires the given program

Parameters:
program - program to be retired
Throws:
APIException

unRetireProgram

@Authorized(value="Manage Programs")
Program unRetireProgram(Program program)
                        throws APIException
Unretires the given program

Parameters:
program - program to be unretired
Throws:
APIException

savePatientProgram

@Authorized(value={"Add Patient Programs","Edit Patient Programs"})
PatientProgram savePatientProgram(PatientProgram patientProgram)
                                  throws APIException
Save patientProgram to database (create if new or update if changed)

Parameters:
patientProgram - is the PatientProgram to be saved to the database
Returns:
PatientProgram - the saved PatientProgram
Throws:
APIException

getPatientProgram

@Authorized(value="View Patient Programs")
@Transactional(readOnly=true)
PatientProgram getPatientProgram(java.lang.Integer patientProgramId)
                                 throws APIException
Returns a PatientProgram given that PatientPrograms primary key patientProgramId A null value is returned if no PatientProgram exists with this patientProgramId.

Parameters:
patientProgramId - integer primary key of the PatientProgram to find
Throws:
APIException

getPatientPrograms

@Authorized(value="View Patient Programs")
@Transactional(readOnly=true)
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 APIException
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

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 - - if true, will also include voided PatientPrograms
Returns:
List of PatientPrograms that match the passed input parameters
Throws:
APIException

purgePatientProgram

@Authorized(value="Add Patient Programs")
void purgePatientProgram(PatientProgram patientProgram)
                         throws APIException
Completely remove a patientProgram from the database (not reversible) This method delegates to #purgePatientProgram(patientProgram, boolean) method

Parameters:
patientProgram - the PatientProgram to clean out of the database.
Throws:
APIException

purgePatientProgram

@Authorized(value="Add Patient Programs")
void purgePatientProgram(PatientProgram patientProgram,
                                         boolean cascade)
                         throws APIException
Completely remove a patientProgram from the database (not reversible)

Parameters:
patientProgram - the PatientProgram to clean out of the database.
cascade - true to delete related content
Throws:
APIException

voidPatientProgram

@Authorized(value="Delete Patient Programs")
PatientProgram voidPatientProgram(PatientProgram patientProgram,
                                                  java.lang.String reason)
                                  throws APIException
Voids the given patientProgram

Parameters:
patientProgram - patientProgram to be voided
reason - is the reason why the patientProgram is being voided
Returns:
the voided PatientProgram
Throws:
APIException

unvoidPatientProgram

@Authorized(value="Delete Patient Programs")
PatientProgram unvoidPatientProgram(PatientProgram patientProgram)
                                    throws APIException
Unvoids the given patientProgram

Parameters:
patientProgram - patientProgram to be un-voided
Returns:
the voided PatientProgram
Throws:
APIException

saveConceptStateConversion

@Authorized(value={"Add Patient Programs","Edit Patient Programs"})
ConceptStateConversion saveConceptStateConversion(ConceptStateConversion conceptStateConversion)
                                                  throws APIException
Save ConceptStateConversion to database (create if new or update if changed)

Parameters:
conceptStateConversion - - The ConceptStateConversion to save
Returns:
ConceptStateConversion - The saved ConceptStateConversion
Throws:
APIException

getConceptStateConversion

@Authorized(value="View Programs")
@Transactional(readOnly=true)
ConceptStateConversion getConceptStateConversion(java.lang.Integer conceptStateConversionId)
                                                 throws APIException
Returns a conceptStateConversion given that conceptStateConversions primary key conceptStateConversionId A null value is returned if no conceptStateConversion exists with this conceptStateConversionId.

Parameters:
conceptStateConversionId - integer primary key of the conceptStateConversion to find
Throws:
APIException

getAllConceptStateConversions

@Authorized(value="View Programs")
@Transactional(readOnly=true)
java.util.List<ConceptStateConversion> getAllConceptStateConversions()
                                                                     throws APIException
Returns all conceptStateConversions

Returns:
List of all ConceptStateConversions that exist
Throws:
APIException

purgeConceptStateConversion

@Authorized(value="Manage Programs")
void purgeConceptStateConversion(ConceptStateConversion conceptStateConversion)
                                 throws APIException
Completely remove a conceptStateConversion from the database (not reversible) This method delegates to #purgeConceptStateConversion(conceptStateConversion, boolean) method

Parameters:
conceptStateConversion - the ConceptStateConversion to clean out of the database.
Throws:
APIException

purgeConceptStateConversion

@Authorized(value="Manage Programs")
void purgeConceptStateConversion(ConceptStateConversion conceptStateConversion,
                                                 boolean cascade)
                                 throws APIException
Completely remove a conceptStateConversion from the database (not reversible)

Parameters:
conceptStateConversion - the ConceptStateConversion to clean out of the database.
cascade - true to delete related content
Throws:
APIException

triggerStateConversion

void triggerStateConversion(Patient patient,
                            Concept reasonForExit,
                            java.util.Date dateConverted)
                            throws APIException
Triggers any ConceptStateConversion that exists for the passed reasonForExit concept and any ProgramWorkflow in the PatientPrograms for the patient

Parameters:
patient - - the Patient to trigger the ConceptStateConversion on
reasonForExit - - the Concept to trigger the ConceptStateConversion
dateConverted - - the Date of the ConceptStateConversion
Throws:
APIException

getConceptStateConversion

@Transactional(readOnly=true)
ConceptStateConversion getConceptStateConversion(ProgramWorkflow workflow,
                                                               Concept trigger)
                                                 throws APIException
Retrieves the ConceptStateConversion that matches the passed ProgramWorkflow and Concept

Parameters:
workflow - - the ProgramWorkflow to check
trigger - - the Concept to check
Returns:
ConceptStateConversion that matches the passed ProgramWorkflow and Concept
Throws:
APIException

createOrUpdateProgram

@Authorized(value="Manage Programs")
void createOrUpdateProgram(Program program)
                           throws APIException
Deprecated. use saveProgram(Program)

Create a new program

Parameters:
Program - to create
Throws:
APIException

getPrograms

@Authorized(value="View Programs")
@Transactional(readOnly=true)
java.util.List<Program> getPrograms()
                                    throws APIException
Deprecated. use getAllPrograms()

Returns all programs, includes retired programs.

Returns:
List of all existing programs
Throws:
APIException

createWorkflow

@Authorized(value="Manage Programs")
void createWorkflow(ProgramWorkflow programWorkflow)
                    throws APIException
Deprecated. use followed by @link #saveProgram(Program)

Create a new programWorkflow

Parameters:
programWorkflow - - The ProgramWorkflow to create
Throws:
APIException

updateWorkflow

@Authorized(value="Manage Programs")
void updateWorkflow(ProgramWorkflow programWorkflow)
                    throws APIException
Deprecated. use to save changes to all ProgramWorkflows for the given Program

Update a programWorkflow

Parameters:
programWorkflow - - The ProgramWorkflow to update
Throws:
APIException

getWorkflow

@Authorized(value="View Programs")
@Transactional(readOnly=true)
ProgramWorkflow getWorkflow(java.lang.Integer id)
                            throws APIException
Deprecated. ProgramWorkflows should not be retrieved directly, but rather through the programs they belong to: use Program#getWorkflow(Integer)

Returns a programWorkflow given that programWorkflows primary key programWorkflowId

Parameters:
Id - integer primary key of the ProgramWorkflow to find
Throws:
APIException

getWorkflow

@Authorized(value="View Programs")
@Transactional(readOnly=true)
ProgramWorkflow getWorkflow(Program program,
                                                          java.lang.String name)
                            throws APIException
Deprecated. use Program.getWorkflowByName(String)

Returns a programWorkflow with the given name within the given Program

Parameters:
program - - The Program of the ProgramWorkflow to return
name - - The name of the ProgramWorkflow to return
Returns:
ProgramWorkflow - The ProgramWorkflow that matches the passed Program and name
Throws:
APIException

voidWorkflow

@Authorized(value="Manage Programs")
void voidWorkflow(ProgramWorkflow programWorkflow,
                                  java.lang.String reason)
                  throws APIException
Deprecated. use followed by @link #saveProgram(Program)

Retires the given programWorkflow

Parameters:
programWorkflow - - The ProgramWorkflow to retire
reason - - The reason for retiring the ProgramWorkflow
Throws:
APIException

getStates

@Authorized(value="View Programs")
@Transactional(readOnly=true)
java.util.List<ProgramWorkflowState> getStates()
                                               throws APIException
Deprecated. ProgramWorkflowStates should be retrieved from the ProgramWorkflow they belong to

Returns all ProgramWorkflowStates

Returns:
List - all ProgramWorkflowStates that exist
Throws:
APIException
See Also:
ProgramWorkflow#getStates()}

getStates

@Authorized(value="View Programs")
@Transactional(readOnly=true)
java.util.List<ProgramWorkflowState> getStates(boolean includeVoided)
                                               throws APIException
Deprecated. ProgramWorkflowStates should be retrieved from the ProgramWorkflow they belong to

Returns all ProgramWorkflowStates

Parameters:
includeVoided - - if false, only returns non-voided ProgramWorkflowStates
Returns:
List - all ProgramWorkflowStates that exist, including voided based on the input parameter
Throws:
APIException
See Also:
ProgramWorkflow#getStates(boolean)}

getState

@Authorized(value="View Programs")
@Transactional(readOnly=true)
ProgramWorkflowState getState(java.lang.Integer id)
                              throws APIException
Deprecated. ProgramWorkflowStates should be retrieved from the ProgramWorkflow they belong to

Returns ProgramWorkflowState with the passed primary key id

Parameters:
id - - The primary key id of the ProgramWorkflowState to return
Returns:
ProgramWorkflowState - returns ProgramWorkflowState whose primary key id matches the passed id
Throws:
APIException
See Also:
ProgramWorkflow#getState(Integer)}

getState

@Authorized(value="View Programs")
@Transactional(readOnly=true)
ProgramWorkflowState getState(ProgramWorkflow programWorkflow,
                                                            java.lang.String name)
                              throws APIException
Deprecated. ProgramWorkflowStates should be retrieved from the ProgramWorkflow they belong to

Returns ProgramWorkflowState with the passed name in the passed programWorkflow

Parameters:
programWorkflow - - The programWorkflow to check for ProgramWorkflowState
name - - the name of the programWorkflowState to look for
Returns:
ProgramWorkflowState - the ProgramWorkflowState with the passed name in the passed programWorkflow
Throws:
APIException
See Also:
ProgramWorkflow#getStateByName(String)}

getPossibleNextStates

@Authorized(value="View Programs")
@Transactional(readOnly=true)
java.util.List<ProgramWorkflowState> getPossibleNextStates(PatientProgram patientProgram,
                                                                                         ProgramWorkflow workflow)
                                                           throws APIException
Deprecated. use ProgramWorkflow.getPossibleNextStates(PatientProgram)

Returns List of ProgramWorkflowStates that a patient is allowed to transition into given their current program

Parameters:
patientProgram - - the PatientProgram to retrieve possible next transitions from
programWorkflow - - the ProgramWorkflow to retrieve possible next transitions from
Returns:
List - returns List that a patient with the given PatientProgram and ProgramWorkflow is allowed to transition into
Throws:
APIException

isLegalTransition

@Authorized(value="View Programs")
@Transactional(readOnly=true)
boolean isLegalTransition(ProgramWorkflowState fromState,
                                                        ProgramWorkflowState toState)
                          throws APIException
Deprecated. use ProgramWorkflow.isLegalTransition(ProgramWorkflowState, ProgramWorkflowState)

Returns boolean indicating whether it is legal to transition from one ProgramWorkflowState to another

Parameters:
fromState - - the ProgramWorkflowState to use as the state to check transitions from
toState - - the ProgramWorkflowState to use as the state to check transitions into from fromState
Returns:
boolean - returns true if a legal transition exists from fromState to toState
Throws:
APIException

createPatientProgram

@Authorized(value="Add Patient Programs")
void createPatientProgram(PatientProgram patientProgram)
                          throws APIException
Deprecated. use savePatientProgram(PatientProgram)

Create a new patientProgram

Parameters:
patientProgram - - The PatientProgram to create
Throws:
APIException

updatePatientProgram

@Authorized(value="Edit Patient Programs")
void updatePatientProgram(PatientProgram patientProgram)
                          throws APIException
Deprecated. use savePatientProgram(PatientProgram)

Update a patientProgram

Parameters:
patientProgram - - The PatientProgram to update
Throws:
APIException

enrollPatientInProgram

@Authorized(value="Add Patient Programs")
void enrollPatientInProgram(Patient patient,
                                            Program program,
                                            java.util.Date enrollmentDate,
                                            java.util.Date completionDate,
                                            User creator)
                            throws APIException
Deprecated. use {new PatientProgram(...) followed by @link #savePatientProgram(PatientProgram)}

Create a new PatientProgram

Parameters:
patient - - The Patient to enroll
program - - The Program to enroll the patient into
enrollmentDate - - The Date to use as the enrollment date in the program for the patient
completionDate - - The Date to use as the completion date in the program for the patient
creator - - The User who is enrolling this patient
Throws:
APIException

getPatientPrograms

@Authorized(value="View Patient Programs")
@Transactional(readOnly=true)
java.util.Collection<PatientProgram> getPatientPrograms(Patient patient)
                                                        throws APIException
Deprecated. use getPatientPrograms(Patient, Program, Date, Date, Date, Date)

Returns a Collection of all PatientPrograms for the passed patient

Parameters:
patient - - The Patient to retrieve all PatientPrograms for
Returns:
Collection of all PatientPrograms for the passed patient
Throws:
APIException

patientsInProgram

@Authorized(value="View Patient Programs")
@Transactional(readOnly=true)
java.util.Collection<java.lang.Integer> patientsInProgram(Program program,
                                                                                        java.util.Date fromDate,
                                                                                        java.util.Date toDate)
                                                          throws APIException
Deprecated. use getPatientPrograms(Patient, Program, Date, Date, Date, Date) which can be Iterated across to return collection of patient ids

Get Collection of PatientIds for patients who are enrolled in program between fromDate and toDate

Parameters:
program - - The Program to check for patient enrollment
fromDate - - Used to check whether patients were enrolled in the program on or after this Date
toDate - - Used to check whether patients were enrolled in the program on or before this Date
Returns:
Collection containing all patientIds for patients who were enrolled in the program between fromDate and toDate
Throws:
APIException

getCurrentPrograms

@Authorized(value="View Patient Programs")
@Transactional(readOnly=true)
java.util.Collection<PatientProgram> getCurrentPrograms(Patient patient,
                                                                                      java.util.Date onDate)
                                                        throws APIException
Deprecated. use getPatientPrograms(Patient, Program, Date, Date, Date, Date)

Get Collection of PatientPrograms for patients that are current as of the passed Date

Parameters:
patient - - The Patient to check for program enrollment
onDate - - Specifies only to return programs that the patient is in as of this Date
Returns:
Collection that contains all PatientPrograms are current for the patient as of onDate
Throws:
APIException

isInProgram

@Authorized(value="View Patient Programs")
@Transactional(readOnly=true)
boolean isInProgram(Patient patient,
                                                  Program program,
                                                  java.util.Date fromDate,
                                                  java.util.Date toDate)
                    throws APIException
Deprecated. use getPatientPrograms(Patient, Program, Date, Date, Date, Date)

Return boolean indicating if Patient was enrolled into the Program between Date and Date

Parameters:
patient - - The Patient to check for enrollment
program - - The Program to check for enrollment
fromDate - - Used to check whether patients were enrolled in the program on or after this Date
toDate - - Used to check whether patients were enrolled in the program on or before this Date
Returns:
boolean - Returns true if the patient was enrolled in the program between fromDate and toDate
Throws:
APIException

getPatientState

@Authorized(value="View Patient Programs")
@Transactional(readOnly=true)
PatientState getPatientState(java.lang.Integer patientStateId)
                             throws APIException
Deprecated. use PatientProgram.getPatientState(Integer)

Get a PatientState by patientStateId

Parameters:
patientStateId - - The primary key id of the PatientState to return
Returns:
The PatientState whose primary key id matches the input patientStateId
Throws:
APIException
See Also:
PatientProgram

getLatestState

@Authorized(value="View Patient Programs")
@Transactional(readOnly=true)
PatientState getLatestState(PatientProgram patientProgram,
                                                          ProgramWorkflow programWorkflow)
                            throws APIException
Deprecated. use PatientProgram.getCurrentState(ProgramWorkflow)

Get the most recent PatientState for a given PatientProgram and ProgramWorkflow

Parameters:
patientProgram - - The PatientProgram whose states to check
programWorkflow - - The ProgramWorkflow whose current state to check within the given patientProgram
Returns:
PatientState - The PatientState that is most recent for the programWorkflow within the given patientProgram
Throws:
APIException

getCurrentWorkflowsByPatient

@Authorized(value="View Patient Programs")
@Transactional(readOnly=true)
java.util.Set<ProgramWorkflow> getCurrentWorkflowsByPatient(Patient patient)
                                                            throws APIException
Deprecated. No current use outside of this service. Should be retrieved from Patient, PatientProgram, and PatientState

Returns a Set of current ProgramWorkflows for the given Patient

Parameters:
patient - - The Patient to check
Returns:
Set containing all of the current ProgramWorkflows for the patient
Throws:
APIException

getCurrentWorkflowsByPatientProgram

@Authorized(value="View Patient Programs")
@Transactional(readOnly=true)
java.util.Set<ProgramWorkflow> getCurrentWorkflowsByPatientProgram(PatientProgram program)
                                                                   throws APIException
Deprecated. No current use outside of this service. Should be retrieved from Patient, PatientProgram, and PatientState

Returns a Set of current ProgramWorkflows for the given PatientProgram

Parameters:
program - - The PatientProgram to check
Returns:
Set containing all of the current ProgramWorkflows for the program
Throws:
APIException

changeToState

@Authorized(value={"Add Patient Programs","Edit Patient Programs"})
void changeToState(PatientProgram patientProgram,
                                   ProgramWorkflow workflow,
                                   ProgramWorkflowState state,
                                   java.util.Date onDate)
                   throws APIException
Deprecated. use PatientProgram.transitionToState(ProgramWorkflowState, Date)

Change the state of the passed PatientPrograms ProgramWorkflow to the passed ProgramWorkflowState on the passed Date

Parameters:
patientProgram - - The PatientProgram whose state you wish to change
workflow - - The ProgramWorkflow whose within the patientProgram whose state you wish to change
state - - The ProgramWorkflowState you wish to change the ProgramWorkflow to
onDate - - The Date that you wish the State change to take place
Throws:
APIException

getPatientPrograms

@Transactional(readOnly=true)
@Authorized(value="View Patient Programs")
java.util.List<PatientProgram> getPatientPrograms(Cohort cohort,
                                                                                java.util.Collection<Program> programs)
TODO: refactor?

Parameters:
cohort -
programs -
Returns:

terminatePatientProgram

@Authorized(value={"Add Patient Programs","Edit Patient Programs"})
void terminatePatientProgram(PatientProgram patientProgram,
                                             ProgramWorkflowState finalState,
                                             java.util.Date terminatedOn)
Deprecated. use PatientProgram.transitionToState(ProgramWorkflowState, Date)

Terminatate the passed PatientPrograms ProgramWorkflow to the passed ProgramWorkflowState on the passed Date

Parameters:
patientProgram - - The PatientProgram whose state you wish to change
state - - The ProgramWorkflowState you wish to change the ProgramWorkflow to
onDate - - The Date that you wish the State change to take place
Throws:
APIException

voidLastState

@Authorized(value="Edit Patient Programs")
void voidLastState(PatientProgram patientProgram,
                                   ProgramWorkflow wf,
                                   java.lang.String voidReason)
                   throws APIException
Deprecated. use PatientProgram.voidLastState(ProgramWorkflow, User, Date, String)

Voids the last non-voided ProgramWorkflowState in the given ProgramWorkflow for the given PatientProgram, and clears the endDate of the next-to-last non-voided state.

Parameters:
patientProgram - - The patientProgram to check
wf - - The ProgramWorkflow to check
voidReason - - The reason for voiding
Throws:
APIException

createConceptStateConversion

@Authorized(value="Add Patient Programs")
void createConceptStateConversion(ConceptStateConversion conceptStateConversion)
                                  throws APIException
Deprecated. use saveConceptStateConversion(ConceptStateConversion)

Create a new ConceptStateConversion

Parameters:
conceptStateConversion - - The ConceptStateConversion to create
Throws:
APIException

updateConceptStateConversion

@Authorized(value="Edit Patient Programs")
void updateConceptStateConversion(ConceptStateConversion conceptStateConversion)
                                  throws APIException
Deprecated. use saveConceptStateConversion(ConceptStateConversion)

Update a ConceptStateConversion

Parameters:
conceptStateConversion - - The ConceptStateConversion to update
Throws:
APIException

getAllConversions

@Authorized(value="View Programs")
@Transactional(readOnly=true)
java.util.List<ConceptStateConversion> getAllConversions()
                                                         throws APIException
Deprecated. use getAllConceptStateConversions()

Returns all conceptStateConversions, includes retired conceptStateConversions.

Returns:
List of all ConceptStateConversions that exist, including retired
Throws:
APIException
See Also:
getAllConceptStateConversions()

deleteConceptStateConversion

void deleteConceptStateConversion(ConceptStateConversion csc)
                                  throws APIException
Deprecated. use purgeConceptStateConversion(ConceptStateConversion)

Delete a ConceptStateConversion

Parameters:
csc - - The ConceptStateConversion to delete from the database
Throws:
APIException

OpenMRS-trunk

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