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
 ConceptStateConversion getConceptStateConversionByUuid(java.lang.String uuid)
          Get a concept state conversion by its uuid.
 java.util.Collection<PatientProgram> getCurrentPrograms(Patient patient, java.util.Date onDate)
          Deprecated. use getPatientPrograms(Patient, Program, Date, Date, Date, Date, boolean)
 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.
 PatientProgram getPatientProgramByUuid(java.lang.String uuid)
          Get a patient program by its uuid.
 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, boolean)
 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)
 PatientState getPatientStateByUuid(java.lang.String uuid)
          Get a program state by its uuid.
 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
 Program getProgramByUuid(java.lang.String uuid)
          Get a program by its uuid.
 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
 ProgramWorkflowState getStateByUuid(java.lang.String uuid)
          Get a state by its uuid.
 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.getWorkflows()
 ProgramWorkflow getWorkflow(Program program, java.lang.String name)
          Deprecated. use Program.getWorkflowByName(String)
 ProgramWorkflow getWorkflowByUuid(java.lang.String uuid)
          Get ProgramWorkflow by its UUID
 boolean isInProgram(Patient patient, Program program, java.util.Date fromDate, java.util.Date toDate)
          Deprecated. use getPatientPrograms(Patient, Program, Date, Date, Date, Date, boolean)
 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, boolean) 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
Expected behavior:
create program workflows, save program successfully, save workflows associated with program, save states associated with program

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
Returns:
Program object that has program.programId = programId passed in.
Throws:
APIException
Expected behavior:
return program matching the given programId, return null when programId does not exist

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
Returns:
Program matching the name to Program.name
Throws:
APIException
Expected behavior:
return program when name matches, return null when program does not exist with given name, fail when two programs found with same name

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

Returns:
List of all existing programs, including retired programs
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
Expected behavior:
return all programs including retired when includeRetired equals true, return all programs excluding retired when includeRetired equals false

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
Expected behavior:
return all programs with partial name match, return all programs when exact name match, return empty list when name does not match, not return a null list, return programs when nameFragment matches beginning of program name, return programs when nameFragment matches ending of program name, return programs when nameFragment matches middle of program name, return programs when nameFragment matches entire program name, return programs ordered by name, return empty list when nameFragment does not match any

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
Expected behavior:
delete program successfully

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
Expected behavior:
delete program successfully, not delete child associations when cascade equals false, throw APIException when given cascade equals true

retireProgram

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

Parameters:
program - Program to be retired
Returns:
the Program which has been retired
Throws:
APIException
Expected behavior:
retire program successfully, retire workflows associated with given program, retire states associated with given program

unRetireProgram

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

Parameters:
program - Program to be unretired
Returns:
the Program which has been unretired
Throws:
APIException
Expected behavior:
unretire program successfully, unretire workflows associated with given program, unretire states associated with given program

getProgramByUuid

@Transactional(readOnly=true)
Program getProgramByUuid(java.lang.String uuid)
Get a program by its uuid. There should be only one of these in the database. If multiple are found, an error is thrown.

Parameters:
uuid - the universally unique identifier
Returns:
the program which matches the given uuid
Expected behavior:
find object given valid uuid, return null if no object found with given uuid, return program with given uuid, throw error when multiple programs with same uuid are found

getPatientStateByUuid

@Transactional(readOnly=true)
PatientState getPatientStateByUuid(java.lang.String uuid)
Get a program state by its uuid. There should be only one of these in the database. If multiple are found, an error is thrown.

Parameters:
uuid - the universally unique identifier
Returns:
the program which matches the given uuid
Expected behavior:
find object given valid uuid, return null if no object found with given uuid, return program state with the given uuid, throw error when multiple program states with same uuid are found

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
Expected behavior:
update patient program, save patient program successfully, return patient program with assigned patient program id

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
Returns:
PatientProgram object that has patientProgram.patientProgramId = patientProgramId passed in.
Throws:
APIException
Expected behavior:
return patient program with given patientProgramId, get patient program with given identifier, return null if program does not exist

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
Expected behavior:
return patient programs for given patient, return patient programs for given program, return patient programs with dateEnrolled on or before minEnrollmentDate, return patient programs with dateEnrolled on or after maxEnrollmentDate, return patient programs with dateCompleted on or before minCompletionDate, return patient programs with dateCompleted on or after maxCompletionDate, return patient programs with dateCompleted, return patient programs not yet completed, return voided patient programs, return all patient programs when all parameters are null, return empty list when matches not found

purgePatientProgram

@Authorized(value="Purge 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
Expected behavior:
delete patient program from database without cascade

purgePatientProgram

@Authorized(value="Purge 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
Expected behavior:
delete patient program from database, cascade delete patient program states when cascade equals true, not cascade delete patient program states when cascade equals false

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
Expected behavior:
void patient program when reason is valid, fail when reason is empty

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
Expected behavior:
void patient program when reason is valid

getWorkflowByUuid

@Transactional(readOnly=true)
ProgramWorkflow getWorkflowByUuid(java.lang.String uuid)
Get ProgramWorkflow by its UUID

Parameters:
uuid -
Returns:
Expected behavior:
find object given valid uuid, return null if no object found with given uuid

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
Expected behavior:
save state conversion

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
Returns:
ConceptStateConversion object that has conceptStateConversion.conceptStateConversionId = conceptStateConversionId passed in.
Throws:
APIException
Expected behavior:
return concept state conversion for given identifier

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
Expected behavior:
return all concept state conversions

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
Expected behavior:
cascade delete given concept state conversion when given cascade is true, not cascade delete given concept state conversion when given cascade is false

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
Expected behavior:
trigger state conversion successfully, fail if patient is invalid, fail if trigger is invalid, fail if date converted is invalid

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
Expected behavior:
return concept state conversion for given workflow and trigger

createOrUpdateProgram

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

Create a new program

Parameters:
program - 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.getWorkflows()

Returns a programWorkflow given that programWorkflows primary key programWorkflowId

Parameters:
id - integer primary key of the ProgramWorkflow to find
Returns:
ProgramWorkflow object that has an id that matches the input parameter
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

getStateByUuid

@Transactional(readOnly=true)
ProgramWorkflowState getStateByUuid(java.lang.String uuid)
Get a state by its uuid. There should be only one of these in the database. If multiple are found, an error is thrown.

Parameters:
uuid - the universally unique identifier
Returns:
the program workflow state which matches the given uuid
Expected behavior:
find object given valid uuid, return null if no object found with given uuid, return a state with the given uuid, throw an error when multiple states with same uuid are found

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
workflow - - 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, boolean)

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, boolean) 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, boolean)

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, boolean)

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

getPatientProgramByUuid

@Transactional(readOnly=true)
PatientProgram getPatientProgramByUuid(java.lang.String uuid)
Get a patient program by its uuid. There should be only one of these in the database. If multiple are found, an error is thrown.

Parameters:
uuid - the universally unique identifier
Returns:
the patient program which matches the given uuid
Expected behavior:
find object given valid uuid, return null if no object found with given uuid, return a patient program with the given uuid, throw an error when multiple patient programs with same uuid are found

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:
List for all Patients in the given Cohort that are in the given programs
Expected behavior:
return patient programs with patients in given cohort and programs, return patient programs with patients in given cohort, return patient programs with programs in given programs, return empty list when there is no match for given cohort and programs, not return null when there is no match for given cohort and program, not throw NullPointerException when given cohort and programs are null, not fail when given cohort is empty, not fail when given program is empty

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
finalState - - The ProgramWorkflowState you wish to change the ProgramWorkflow to
terminatedOn - - 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

getConceptStateConversionByUuid

@Transactional(readOnly=true)
ConceptStateConversion getConceptStateConversionByUuid(java.lang.String uuid)
Get a concept state conversion by its uuid. There should be only one of these in the database. If multiple are found, an error is thrown.

Parameters:
uuid - the universally unique identifier
Returns:
the concept state conversion which matches the given uuid
Expected behavior:
find object given valid uuid, return null if no object found with given uuid, return a program state with the given uuid, throw an error when multiple program states with same uuid are found

OpenMRS-1.7.x

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