@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, onStartup
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onShutdown, onStartup
protected ProgramWorkflowDAO dao
public void setProgramWorkflowDAO(ProgramWorkflowDAO dao)
ProgramWorkflowService
setProgramWorkflowDAO
in interface ProgramWorkflowService
dao
- - The DAO for this serviceProgramWorkflowService.setProgramWorkflowDAO(org.openmrs.api.db.ProgramWorkflowDAO)
public Program saveProgram(Program program) throws APIException
ProgramWorkflowService
program
to database (create if new or update if changed)saveProgram
in interface ProgramWorkflowService
program
- 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)
ProgramWorkflowService
programId
A null value is
returned if no program exists with this programId.getProgram
in interface ProgramWorkflowService
id
- 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
ProgramWorkflowService
name
A null value is returned if
there is no program with this namegetProgramByName
in interface ProgramWorkflowService
name
- the exact name of the program to match onname
to Program.nameAPIException
ProgramNameDuplicatedException
- 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
ProgramWorkflowService
getAllPrograms
in interface ProgramWorkflowService
APIException
ProgramWorkflowService.getAllPrograms()
@Transactional(readOnly=true) public List<Program> getAllPrograms(boolean includeRetired) throws APIException
ProgramWorkflowService
getAllPrograms
in interface ProgramWorkflowService
includeRetired
- 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
ProgramWorkflowService
nameFragment
getPrograms
in interface ProgramWorkflowService
nameFragment
- 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
ProgramWorkflowService
purgeProgram
in interface ProgramWorkflowService
program
- 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
ProgramWorkflowService
purgeProgram
in interface ProgramWorkflowService
cascade
- 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
ProgramWorkflowService
retireProgram
in interface ProgramWorkflowService
program
- 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
ProgramWorkflowService
unretireProgram
in interface ProgramWorkflowService
program
- 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
ProgramWorkflowService
savePatientProgram
in interface ProgramWorkflowService
patientProgram
- 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)
ProgramWorkflowService
patientProgramId
A null value is returned if no PatientProgram exists with this patientProgramId.getPatientProgram
in interface ProgramWorkflowService
patientProgramId
- 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
ProgramWorkflowService
getPatientPrograms
in interface ProgramWorkflowService
patient
- 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 ProgramWorkflowService
ProgramWorkflowService.getPatientPrograms(Cohort, Collection)
public void purgePatientProgram(PatientProgram patientProgram) throws APIException
ProgramWorkflowService
purgePatientProgram
in interface ProgramWorkflowService
patientProgram
- 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
ProgramWorkflowService
purgePatientProgram
in interface ProgramWorkflowService
patientProgram
- 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)
ProgramWorkflowService
voidPatientProgram
in interface ProgramWorkflowService
patientProgram
- 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)
ProgramWorkflowService
unvoidPatientProgram
in interface ProgramWorkflowService
patientProgram
- patientProgram to be un-voidedProgramWorkflowService.voidPatientProgram(org.openmrs.PatientProgram,
java.lang.String)
@Transactional(readOnly=true) public List<Concept> getPossibleOutcomes(Integer programId)
ProgramWorkflowService
Concept.getAnswers()
if they exist, then all concept set members
Concept.getSetMembers()
if they exist, then empty List.getPossibleOutcomes
in interface ProgramWorkflowService
ProgramWorkflowService.getPossibleOutcomes(Integer)
public ConceptStateConversion saveConceptStateConversion(ConceptStateConversion csc) throws APIException
ProgramWorkflowService
saveConceptStateConversion
in interface ProgramWorkflowService
csc
- - The ConceptStateConversion to saveAPIException
- Should save state conversionProgramWorkflowService.saveConceptStateConversion(org.openmrs.ConceptStateConversion)
@Transactional(readOnly=true) public ConceptStateConversion getConceptStateConversion(Integer id)
ProgramWorkflowService
conceptStateConversionId
A null value is returned if no conceptStateConversion
exists with this conceptStateConversionId.getConceptStateConversion
in interface ProgramWorkflowService
id
- integer primary key of the conceptStateConversion to findconceptStateConversionId
passed in.ProgramWorkflowService.getConceptStateConversion(java.lang.Integer)
@Transactional(readOnly=true) public List<ConceptStateConversion> getAllConceptStateConversions() throws APIException
ProgramWorkflowService
getAllConceptStateConversions
in interface ProgramWorkflowService
APIException
- Should return all concept state conversionsProgramWorkflowService.getAllConceptStateConversions()
public void purgeConceptStateConversion(ConceptStateConversion conceptStateConversion) throws APIException
ProgramWorkflowService
purgeConceptStateConversion
in interface ProgramWorkflowService
conceptStateConversion
- the ConceptStateConversion to clean out of the database.APIException
ProgramWorkflowService.purgeConceptStateConversion(org.openmrs.ConceptStateConversion)
public void purgeConceptStateConversion(ConceptStateConversion conceptStateConversion, boolean cascade) throws APIException
ProgramWorkflowService
purgeConceptStateConversion
in interface ProgramWorkflowService
conceptStateConversion
- 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)
ProgramWorkflowService
ProgramWorkflow
and
Concept
getConceptStateConversion
in interface ProgramWorkflowService
workflow
- - the ProgramWorkflow to checktrigger
- - the Concept to checkProgramWorkflow
and
Concept
ProgramWorkflowService.getConceptStateConversion(org.openmrs.ProgramWorkflow,
org.openmrs.Concept)
@Transactional(readOnly=true) public List<Program> getProgramsByConcept(Concept concept)
ProgramWorkflowService
getProgramsByConcept
in interface ProgramWorkflowService
concept
- - The Concept being used.ProgramWorkflowService.getProgramsByConcept(org.openmrs.Concept)
@Transactional(readOnly=true) public List<ProgramWorkflow> getProgramWorkflowsByConcept(Concept concept)
ProgramWorkflowService
getProgramWorkflowsByConcept
in interface ProgramWorkflowService
concept
- - The Concept being used.ProgramWorkflowService.getProgramWorkflowsByConcept(org.openmrs.Concept)
@Transactional(readOnly=true) public List<ProgramWorkflowState> getProgramWorkflowStatesByConcept(Concept concept)
ProgramWorkflowService
getProgramWorkflowStatesByConcept
in interface ProgramWorkflowService
concept
- - The Concept being used.ProgramWorkflowService.getProgramWorkflowStatesByConcept(org.openmrs.Concept)
@Transactional(readOnly=true) public ConceptStateConversion getConceptStateConversionByUuid(String uuid)
ProgramWorkflowService
getConceptStateConversionByUuid
in interface ProgramWorkflowService
uuid
- the universally unique identifierProgramWorkflowService.getConceptStateConversionByUuid(java.lang.String)
@Transactional(readOnly=true) public PatientProgram getPatientProgramByUuid(String uuid)
ProgramWorkflowService
getPatientProgramByUuid
in interface ProgramWorkflowService
uuid
- the universally unique identifierProgramWorkflowService.getPatientProgramByUuid(java.lang.String)
@Transactional(readOnly=true) public Program getProgramByUuid(String uuid)
ProgramWorkflowService
getProgramByUuid
in interface ProgramWorkflowService
uuid
- the universally unique identifierProgramWorkflowService.getProgramByUuid(java.lang.String)
@Transactional(readOnly=true) public ProgramWorkflowState getState(Integer stateId)
ProgramWorkflowService
ProgramWorkflowState
by internal identifier.getState
in interface ProgramWorkflowService
stateId
- the primary key of the state to find, null not okProgramWorkflowService.getWorkflow(Integer)
@Transactional(readOnly=true) public ProgramWorkflowState getStateByUuid(String uuid)
ProgramWorkflowService
getStateByUuid
in interface ProgramWorkflowService
uuid
- the universally unique identifierProgramWorkflowService.getStateByUuid(java.lang.String)
@Transactional(readOnly=true) public PatientState getPatientStateByUuid(String uuid)
ProgramWorkflowService
getPatientStateByUuid
in interface ProgramWorkflowService
uuid
- the universally unique identifier@Transactional(readOnly=true) public ProgramWorkflow getWorkflow(Integer workflowId)
ProgramWorkflowService
ProgramWorkflow
by internal identifier.getWorkflow
in interface ProgramWorkflowService
workflowId
- the primary key of the workflow to find, null not okProgramWorkflowService.getWorkflow(Integer)
@Transactional(readOnly=true) public ProgramWorkflow getWorkflowByUuid(String uuid)
ProgramWorkflowService
getWorkflowByUuid
in interface ProgramWorkflowService
ProgramWorkflowService.getWorkflowByUuid(java.lang.String)
public List<ProgramAttributeType> getAllProgramAttributeTypes()
getAllProgramAttributeTypes
in interface ProgramWorkflowService
public ProgramAttributeType getProgramAttributeType(Integer id)
getProgramAttributeType
in interface ProgramWorkflowService
public ProgramAttributeType getProgramAttributeTypeByUuid(String uuid)
getProgramAttributeTypeByUuid
in interface ProgramWorkflowService
public ProgramAttributeType saveProgramAttributeType(ProgramAttributeType type)
saveProgramAttributeType
in interface ProgramWorkflowService
public void purgeProgramAttributeType(ProgramAttributeType type)
purgeProgramAttributeType
in interface ProgramWorkflowService
public PatientProgramAttribute getPatientProgramAttributeByUuid(String uuid)
getPatientProgramAttributeByUuid
in interface ProgramWorkflowService
public Map<Object,Object> getPatientProgramAttributeByAttributeName(List<Integer> patients, String attributeName)
getPatientProgramAttributeByAttributeName
in interface ProgramWorkflowService
public List<PatientProgram> getPatientProgramByAttributeNameAndValue(String attributeName, String attributeValue)
getPatientProgramByAttributeNameAndValue
in interface ProgramWorkflowService
Copyright © 2024 OpenMRS Inc.. All rights reserved.