@Transactional public class ProgramWorkflowServiceImpl extends BaseOpenmrsService implements ProgramWorkflowService
ProgramWorkflowService| Modifier and Type | Field and Description |
|---|---|
protected ProgramWorkflowDAO |
dao |
| Constructor and Description |
|---|
ProgramWorkflowServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
List<ConceptStateConversion> |
getAllConceptStateConversions()
Returns all conceptStateConversions
|
List<ProgramAttributeType> |
getAllProgramAttributeTypes() |
List<Program> |
getAllPrograms()
Returns all programs, includes retired programs.
|
List<Program> |
getAllPrograms(boolean includeRetired)
Returns all programs
|
ConceptStateConversion |
getConceptStateConversion(Integer id)
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(String uuid)
Get a concept state conversion by its uuid.
|
PatientProgram |
getPatientProgram(Integer patientProgramId)
Returns a PatientProgram given that PatientPrograms primary key
patientProgramId
A null value is returned if no PatientProgram exists with this patientProgramId. |
Map<Object,Object> |
getPatientProgramAttributeByAttributeName(List<Integer> patients,
String attributeName) |
PatientProgramAttribute |
getPatientProgramAttributeByUuid(String uuid) |
List<PatientProgram> |
getPatientProgramByAttributeNameAndValue(String attributeName,
String attributeValue) |
PatientProgram |
getPatientProgramByUuid(String uuid)
Get a patient program by its uuid.
|
List<PatientProgram> |
getPatientPrograms(Cohort cohort,
Collection<Program> programs) |
List<PatientProgram> |
getPatientPrograms(Patient patient,
Program program,
Date minEnrollmentDate,
Date maxEnrollmentDate,
Date minCompletionDate,
Date maxCompletionDate,
boolean includeVoided)
Returns PatientPrograms that match the input parameters.
|
PatientState |
getPatientStateByUuid(String uuid)
Get a program state by its uuid.
|
List<Concept> |
getPossibleOutcomes(Integer programId)
Get all possible outcome concepts for a program.
|
Program |
getProgram(Integer id)
Returns a program given that programs primary key
programId A null value is
returned if no program exists with this programId. |
Program |
getProgram(String name) |
ProgramAttributeType |
getProgramAttributeType(Integer id) |
ProgramAttributeType |
getProgramAttributeTypeByUuid(String uuid) |
Program |
getProgramByName(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(String uuid)
Get a program by its uuid.
|
List<Program> |
getPrograms(String nameFragment)
Returns programs that match the given string.
|
List<Program> |
getProgramsByConcept(Concept concept)
Returns a list of Programs that are using a particular concept.
|
List<ProgramWorkflow> |
getProgramWorkflowsByConcept(Concept concept)
Returns a list of ProgramWorkflows that are using a particular concept.
|
List<ProgramWorkflowState> |
getProgramWorkflowStatesByConcept(Concept concept)
Returns a list of ProgramWorkflowStates that are using a particular concept.
|
ProgramWorkflowState |
getState(Integer stateId)
Get
ProgramWorkflowState by internal identifier. |
ProgramWorkflowState |
getStateByUuid(String uuid)
Get a state by its uuid.
|
ProgramWorkflow |
getWorkflow(Integer workflowId)
Get
ProgramWorkflow by internal identifier. |
ProgramWorkflow |
getWorkflowByUuid(String uuid)
Get ProgramWorkflow by its UUID
|
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)
|
void |
purgeProgramAttributeType(ProgramAttributeType type) |
Program |
retireProgram(Program program,
String reason)
Retires the given program
|
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)
Save
program to database (create if new or update if changed) |
ProgramAttributeType |
saveProgramAttributeType(ProgramAttributeType type) |
void |
setProgramWorkflowDAO(ProgramWorkflowDAO dao)
Setter for the ProgramWorkflow DataAccessObject (DAO).
|
void |
triggerStateConversion(Patient patient,
Concept trigger,
Date dateConverted) |
Program |
unretireProgram(Program program)
Unretires the given program
|
PatientProgram |
unvoidPatientProgram(PatientProgram patientProgram)
Unvoids the given patientProgram
|
PatientProgram |
voidPatientProgram(PatientProgram patientProgram,
String reason)
Voids the given patientProgram
|
onShutdown, onStartupclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonShutdown, onStartupprotected ProgramWorkflowDAO dao
public void setProgramWorkflowDAO(ProgramWorkflowDAO dao)
ProgramWorkflowServicesetProgramWorkflowDAO in interface ProgramWorkflowServicedao - - The DAO for this serviceProgramWorkflowService.setProgramWorkflowDAO(org.openmrs.api.db.ProgramWorkflowDAO)public Program saveProgram(Program program) throws APIException
ProgramWorkflowServiceprogram to database (create if new or update if changed)saveProgram in interface ProgramWorkflowServiceprogram - is the Program to be saved to the databaseAPIException - Should create program workflows
Should save program successfully
Should save workflows associated with program
Should save states associated with program
Should update detached programProgramWorkflowService.saveProgram(org.openmrs.Program)@Transactional(readOnly=true) public Program getProgram(Integer id)
ProgramWorkflowServiceprogramId A null value is
returned if no program exists with this programId.getProgram in interface ProgramWorkflowServiceid - integer primary key of the program to findprogramId passed in.ProgramWorkflowService.getProgram(java.lang.Integer)@Transactional(readOnly=true) public Program getProgram(String name)
org.openmrs.api.ProgramWorkflowService#getProgram(java.lang.String)@Transactional(readOnly=true) public Program getProgramByName(String name) throws APIException
ProgramWorkflowServicename A null value is returned if
there is no program with this namegetProgramByName in interface ProgramWorkflowServicename - the exact name of the program to match onname to Program.nameAPIExceptionProgramNameDuplicatedException - when there are more than one program in the dB with
the given name.
Should return program when name matches
Should return null when program does not exist with given name
Should fail when two programs found with same nameorg.openmrs.api.ProgramWorkflowService#getProgram(java.lang.String)@Transactional(readOnly=true) public List<Program> getAllPrograms() throws APIException
ProgramWorkflowServicegetAllPrograms in interface ProgramWorkflowServiceAPIExceptionProgramWorkflowService.getAllPrograms()@Transactional(readOnly=true) public List<Program> getAllPrograms(boolean includeRetired) throws APIException
ProgramWorkflowServicegetAllPrograms in interface ProgramWorkflowServiceincludeRetired - whether or not to include retired programsAPIException - Should return all programs including retired when includeRetired equals true
Should return all programs excluding retired when includeRetired equals falseProgramWorkflowService.getAllPrograms(boolean)@Transactional(readOnly=true) public List<Program> getPrograms(String nameFragment) throws APIException
ProgramWorkflowServicenameFragmentgetPrograms in interface ProgramWorkflowServicenameFragment - is the string used to search for programsAPIException - Should return all programs with partial name match
Should return all programs when exact name match
Should return empty list when name does not match
Should not return a null list
Should return programs when nameFragment matches beginning of program name
Should return programs when nameFragment matches ending of program name
Should return programs when nameFragment matches middle of program name
Should return programs when nameFragment matches entire program name
Should return programs ordered by name
Should return empty list when nameFragment does not match anyProgramWorkflowService.getPrograms(String)public void purgeProgram(Program program) throws APIException
ProgramWorkflowServicepurgeProgram in interface ProgramWorkflowServiceprogram - the Program to clean out of the database.APIException - Should delete program successfullyProgramWorkflowService.purgeProgram(org.openmrs.Program)public void purgeProgram(Program program, boolean cascade) throws APIException
ProgramWorkflowServicepurgeProgram in interface ProgramWorkflowServicecascade - true to delete related contentAPIException - Should delete program successfully
Should not delete child associations when cascade equals false
Should throw APIException when given cascade equals true
Should purge program with patients enrolledProgramWorkflowService.purgeProgram(org.openmrs.Program, boolean)public Program retireProgram(Program program, String reason) throws APIException
ProgramWorkflowServiceretireProgram in interface ProgramWorkflowServiceprogram - Program to be retiredreason - String for retiring the programAPIException - Should retire program successfully
Should retire workflows associated with given program
Should retire states associated with given programProgramWorkflowService.retireProgram(org.openmrs.Program, java.lang.String)public Program unretireProgram(Program program) throws APIException
ProgramWorkflowServiceunretireProgram in interface ProgramWorkflowServiceprogram - Program to be unretiredAPIException - Should unretire program successfully
Should unretire workflows associated with given program
Should unretire states associated with given programProgramWorkflowService.unretireProgram(org.openmrs.Program)public PatientProgram savePatientProgram(PatientProgram patientProgram) throws APIException
ProgramWorkflowServicesavePatientProgram in interface ProgramWorkflowServicepatientProgram - is the PatientProgram to be saved to the databaseAPIException - Should update patient program
Should save patient program successfully
Should return patient program with assigned patient program idProgramWorkflowService.savePatientProgram(org.openmrs.PatientProgram)@Transactional(readOnly=true) public PatientProgram getPatientProgram(Integer patientProgramId)
ProgramWorkflowServicepatientProgramId
A null value is returned if no PatientProgram exists with this patientProgramId.getPatientProgram in interface ProgramWorkflowServicepatientProgramId - integer primary key of the PatientProgram to findpatientProgramId passed in.ProgramWorkflowService.getPatientProgram(java.lang.Integer)@Transactional(readOnly=true) public List<PatientProgram> getPatientPrograms(Patient patient, Program program, Date minEnrollmentDate, Date maxEnrollmentDate, Date minCompletionDate, Date maxCompletionDate, boolean includeVoided) throws APIException
ProgramWorkflowServicegetPatientPrograms in interface ProgramWorkflowServicepatient - if supplied all PatientPrograms returned will be for this Patientprogram - if supplied all PatientPrograms returned will be for this ProgramminEnrollmentDate - if supplied will limit PatientPrograms to those with enrollments on
or after this DatemaxEnrollmentDate - if supplied will limit PatientPrograms to those with enrollments on
or before this DateminCompletionDate - if supplied will limit PatientPrograms to those completed on or
after this Date OR not yet completedmaxCompletionDate - if supplied will limit PatientPrograms to those completed on or
before this DateincludeVoided - if true, will also include voided PatientProgramsAPIException - Should return patient programs for given patient
Should return patient programs for given program
Should return patient programs with dateEnrolled on or before minEnrollmentDate
Should return patient programs with dateEnrolled on or after maxEnrollmentDate
Should return patient programs with dateCompleted on or before minCompletionDate
Should return patient programs with dateCompleted on or after maxCompletionDate
Should return patient programs with dateCompleted
Should return patient programs not yet completed
Should return voided patient programs
Should return all patient programs when all parameters are null
Should return empty list when matches not foundProgramWorkflowService.getPatientPrograms(Patient, Program, Date, Date,
Date, Date, boolean)@Transactional(readOnly=true) public List<PatientProgram> getPatientPrograms(Cohort cohort, Collection<Program> programs)
getPatientPrograms in interface ProgramWorkflowServiceProgramWorkflowService.getPatientPrograms(Cohort, Collection)public void purgePatientProgram(PatientProgram patientProgram) throws APIException
ProgramWorkflowServicepurgePatientProgram in interface ProgramWorkflowServicepatientProgram - the PatientProgram to clean out of the database.APIException - Should delete patient program from database without cascadeProgramWorkflowService.purgePatientProgram(org.openmrs.PatientProgram)public void purgePatientProgram(PatientProgram patientProgram, boolean cascade) throws APIException
ProgramWorkflowServicepurgePatientProgram in interface ProgramWorkflowServicepatientProgram - the PatientProgram to clean out of the database.cascade - true to delete related contentAPIException - Should delete patient program from database
Should cascade delete patient program states when cascade equals true
Should not cascade delete patient program states when cascade equals falseProgramWorkflowService.purgePatientProgram(org.openmrs.PatientProgram,
boolean)public PatientProgram voidPatientProgram(PatientProgram patientProgram, String reason)
ProgramWorkflowServicevoidPatientProgram in interface ProgramWorkflowServicepatientProgram - patientProgram to be voidedreason - is the reason why the patientProgram is being voidedProgramWorkflowService.voidPatientProgram(org.openmrs.PatientProgram,
java.lang.String)public PatientProgram unvoidPatientProgram(PatientProgram patientProgram)
ProgramWorkflowServiceunvoidPatientProgram in interface ProgramWorkflowServicepatientProgram - patientProgram to be un-voidedProgramWorkflowService.voidPatientProgram(org.openmrs.PatientProgram,
java.lang.String)@Transactional(readOnly=true) public List<Concept> getPossibleOutcomes(Integer programId)
ProgramWorkflowServiceConcept.getAnswers() if they exist, then all concept set members
Concept.getSetMembers() if they exist, then empty List.getPossibleOutcomes in interface ProgramWorkflowServiceProgramWorkflowService.getPossibleOutcomes(Integer)public ConceptStateConversion saveConceptStateConversion(ConceptStateConversion csc) throws APIException
ProgramWorkflowServicesaveConceptStateConversion in interface ProgramWorkflowServicecsc - - The ConceptStateConversion to saveAPIException - Should save state conversionProgramWorkflowService.saveConceptStateConversion(org.openmrs.ConceptStateConversion)@Transactional(readOnly=true) public ConceptStateConversion getConceptStateConversion(Integer id)
ProgramWorkflowServiceconceptStateConversionId A null value is returned if no conceptStateConversion
exists with this conceptStateConversionId.getConceptStateConversion in interface ProgramWorkflowServiceid - integer primary key of the conceptStateConversion to findconceptStateConversionId passed in.ProgramWorkflowService.getConceptStateConversion(java.lang.Integer)@Transactional(readOnly=true) public List<ConceptStateConversion> getAllConceptStateConversions() throws APIException
ProgramWorkflowServicegetAllConceptStateConversions in interface ProgramWorkflowServiceAPIException - Should return all concept state conversionsProgramWorkflowService.getAllConceptStateConversions()public void purgeConceptStateConversion(ConceptStateConversion conceptStateConversion) throws APIException
ProgramWorkflowServicepurgeConceptStateConversion in interface ProgramWorkflowServiceconceptStateConversion - the ConceptStateConversion to clean out of the database.APIExceptionProgramWorkflowService.purgeConceptStateConversion(org.openmrs.ConceptStateConversion)public void purgeConceptStateConversion(ConceptStateConversion conceptStateConversion, boolean cascade) throws APIException
ProgramWorkflowServicepurgeConceptStateConversion in interface ProgramWorkflowServiceconceptStateConversion - the ConceptStateConversion to clean out of the database.cascade - true to delete related contentAPIException - Should cascade delete given concept state conversion when given cascade is true
Should not cascade delete given concept state conversion when given cascade is falseProgramWorkflowService.purgeConceptStateConversion(org.openmrs.ConceptStateConversion,
boolean)public void triggerStateConversion(Patient patient, Concept trigger, Date dateConverted)
org.openmrs.api.ProgramWorkflowService#triggerStateConversion(org.openmrs.Patient,
org.openmrs.Concept, java.util.Date)@Transactional(readOnly=true) public ConceptStateConversion getConceptStateConversion(ProgramWorkflow workflow, Concept trigger)
ProgramWorkflowServiceProgramWorkflow and
ConceptgetConceptStateConversion in interface ProgramWorkflowServiceworkflow - - the ProgramWorkflow to checktrigger - - the Concept to checkProgramWorkflow and
ConceptProgramWorkflowService.getConceptStateConversion(org.openmrs.ProgramWorkflow,
org.openmrs.Concept)@Transactional(readOnly=true) public List<Program> getProgramsByConcept(Concept concept)
ProgramWorkflowServicegetProgramsByConcept in interface ProgramWorkflowServiceconcept - - The Concept being used.ProgramWorkflowService.getProgramsByConcept(org.openmrs.Concept)@Transactional(readOnly=true) public List<ProgramWorkflow> getProgramWorkflowsByConcept(Concept concept)
ProgramWorkflowServicegetProgramWorkflowsByConcept in interface ProgramWorkflowServiceconcept - - The Concept being used.ProgramWorkflowService.getProgramWorkflowsByConcept(org.openmrs.Concept)@Transactional(readOnly=true) public List<ProgramWorkflowState> getProgramWorkflowStatesByConcept(Concept concept)
ProgramWorkflowServicegetProgramWorkflowStatesByConcept in interface ProgramWorkflowServiceconcept - - The Concept being used.ProgramWorkflowService.getProgramWorkflowStatesByConcept(org.openmrs.Concept)@Transactional(readOnly=true) public ConceptStateConversion getConceptStateConversionByUuid(String uuid)
ProgramWorkflowServicegetConceptStateConversionByUuid in interface ProgramWorkflowServiceuuid - the universally unique identifierProgramWorkflowService.getConceptStateConversionByUuid(java.lang.String)@Transactional(readOnly=true) public PatientProgram getPatientProgramByUuid(String uuid)
ProgramWorkflowServicegetPatientProgramByUuid in interface ProgramWorkflowServiceuuid - the universally unique identifierProgramWorkflowService.getPatientProgramByUuid(java.lang.String)@Transactional(readOnly=true) public Program getProgramByUuid(String uuid)
ProgramWorkflowServicegetProgramByUuid in interface ProgramWorkflowServiceuuid - the universally unique identifierProgramWorkflowService.getProgramByUuid(java.lang.String)@Transactional(readOnly=true) public ProgramWorkflowState getState(Integer stateId)
ProgramWorkflowServiceProgramWorkflowState by internal identifier.getState in interface ProgramWorkflowServicestateId - the primary key of the state to find, null not okProgramWorkflowService.getWorkflow(Integer)@Transactional(readOnly=true) public ProgramWorkflowState getStateByUuid(String uuid)
ProgramWorkflowServicegetStateByUuid in interface ProgramWorkflowServiceuuid - the universally unique identifierProgramWorkflowService.getStateByUuid(java.lang.String)@Transactional(readOnly=true) public PatientState getPatientStateByUuid(String uuid)
ProgramWorkflowServicegetPatientStateByUuid in interface ProgramWorkflowServiceuuid - the universally unique identifier@Transactional(readOnly=true) public ProgramWorkflow getWorkflow(Integer workflowId)
ProgramWorkflowServiceProgramWorkflow by internal identifier.getWorkflow in interface ProgramWorkflowServiceworkflowId - the primary key of the workflow to find, null not okProgramWorkflowService.getWorkflow(Integer)@Transactional(readOnly=true) public ProgramWorkflow getWorkflowByUuid(String uuid)
ProgramWorkflowServicegetWorkflowByUuid in interface ProgramWorkflowServiceProgramWorkflowService.getWorkflowByUuid(java.lang.String)public List<ProgramAttributeType> getAllProgramAttributeTypes()
getAllProgramAttributeTypes in interface ProgramWorkflowServicepublic ProgramAttributeType getProgramAttributeType(Integer id)
getProgramAttributeType in interface ProgramWorkflowServicepublic ProgramAttributeType getProgramAttributeTypeByUuid(String uuid)
getProgramAttributeTypeByUuid in interface ProgramWorkflowServicepublic ProgramAttributeType saveProgramAttributeType(ProgramAttributeType type)
saveProgramAttributeType in interface ProgramWorkflowServicepublic void purgeProgramAttributeType(ProgramAttributeType type)
purgeProgramAttributeType in interface ProgramWorkflowServicepublic PatientProgramAttribute getPatientProgramAttributeByUuid(String uuid)
getPatientProgramAttributeByUuid in interface ProgramWorkflowServicepublic Map<Object,Object> getPatientProgramAttributeByAttributeName(List<Integer> patients, String attributeName)
getPatientProgramAttributeByAttributeName in interface ProgramWorkflowServicepublic List<PatientProgram> getPatientProgramByAttributeNameAndValue(String attributeName, String attributeValue)
getPatientProgramByAttributeNameAndValue in interface ProgramWorkflowServiceCopyright © 2024 OpenMRS Inc.. All rights reserved.