Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2013
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.88 KB | None | 0 0
  1. /**
  2. * The contents of this file are subject to the OpenMRS Public License
  3. * Version 1.0 (the "License"); you may not use this file except in
  4. * compliance with the License. You may obtain a copy of the License at
  5. * http://license.openmrs.org
  6. *
  7. * Software distributed under the License is distributed on an "AS IS"
  8. * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  9. * License for the specific language governing rights and limitations
  10. * under the License.
  11. *
  12. * Copyright (C) OpenMRS, LLC. All Rights Reserved.
  13. */
  14. package org.openmrs.api.db;
  15.  
  16. import java.util.Collection;
  17. import java.util.Date;
  18. import java.util.List;
  19.  
  20. import org.openmrs.Cohort;
  21. import org.openmrs.Concept;
  22. import org.openmrs.ConceptStateConversion;
  23. import org.openmrs.Patient;
  24. import org.openmrs.PatientProgram;
  25. import org.openmrs.PatientState;
  26. import org.openmrs.Program;
  27. import org.openmrs.ProgramWorkflow;
  28. import org.openmrs.ProgramWorkflowState;
  29.  
  30. /**
  31. * Program- and PatientProgram- and ConceptStateConversion-related database functions
  32. *
  33. * @version 1.0
  34. */
  35. public interface ProgramWorkflowDAO {
  36.  
  37. // **************************
  38. // PROGRAM
  39. // **************************
  40.  
  41. /**
  42. * Saves a Program to the database
  43. *
  44. * @param program - The {@link Program} to save
  45. * @return The saved {@link Program}
  46. * @throws DAOException
  47. */
  48. public Program saveProgram(Program program) throws DAOException;
  49.  
  50. /**
  51. * Retrieves a {@link Program} from the database by primary key programId
  52. *
  53. * @param programId - The primary key programId to use to retrieve a {@link Program}
  54. * @return Program - The {@link Program} matching the passed programId
  55. * @throws DAOException
  56. */
  57. public Program getProgram(Integer programId) throws DAOException;
  58.  
  59. /**
  60. * Returns all programs
  61. *
  62. * @param includeRetired whether or not to include retired programs
  63. * @return List<Program> all existing programs, including retired based on the input parameter
  64. * @throws DAOException
  65. */
  66. public List<Program> getAllPrograms(boolean includeRetired) throws DAOException;
  67.  
  68. /**
  69. * Returns programs that match the given string. A null list will never be returned. An empty
  70. * list will be returned if there are no programs matching this <code>nameFragment</code>
  71. *
  72. * @param nameFragment is the string used to search for programs
  73. * @return List<Program> - list of Programs whose name matches the input parameter
  74. * @throws DAOException
  75. */
  76. public List<Program> findPrograms(String nameFragment) throws DAOException;
  77.  
  78. /**
  79. * Completely remove a program from the database (not reversible) This method delegates to
  80. * #purgeProgram(program, boolean) method
  81. *
  82. * @param program the Program to clean out of the database.
  83. * @throws DAOException
  84. */
  85. public void deleteProgram(Program program) throws DAOException;
  86.  
  87. // **************************
  88. // PATIENT PROGRAM
  89. // **************************
  90.  
  91. /**
  92. * Save patientProgram to database (create if new or update if changed)
  93. *
  94. * @param patientProgram is the PatientProgram to be saved to the database
  95. * @return PatientProgram - the saved PatientProgram
  96. * @throws DAOException
  97. */
  98. public PatientProgram savePatientProgram(PatientProgram patientProgram) throws DAOException;
  99.  
  100. /**
  101. * Returns a PatientProgram given that PatientPrograms primary key <code>patientProgramId</code>
  102. * A null value is returned if no PatientProgram exists with this patientProgramId.
  103. *
  104. * @param id integer primary key of the PatientProgram to find
  105. * @return PatientProgram object that has patientProgram.patientProgramId =
  106. * <code>patientProgramId</code> passed in.
  107. * @throws DAOException
  108. */
  109. public PatientProgram getPatientProgram(Integer id);
  110.  
  111. public List<PatientProgram> getPatientPrograms(Cohort cohort, Collection<Program> programs);
  112.  
  113. /**
  114. * Returns PatientPrograms that match the input parameters. If an input parameter is set to
  115. * null, the parameter will not be used. Calling this method will all null parameters will
  116. * return all PatientPrograms in the database A null list will never be returned. An empty list
  117. * will be returned if there are no programs matching the input criteria
  118. *
  119. * @param patient - if supplied all PatientPrograms returned will be for this Patient
  120. * @param program - if supplied all PatientPrograms returned will be for this Program
  121. * @param minEnrollmentDate - if supplied will limit PatientPrograms to those with enrollments
  122. * on or after this Date
  123. * @param maxEnrollmentDate - if supplied will limit PatientPrograms to those with enrollments
  124. * on or before this Date
  125. * @param minCompletionDate - if supplied will limit PatientPrograms to those completed on or
  126. * after this Date OR not yet completed
  127. * @param maxCompletionDate - if supplied will limit PatientPrograms to those completed on or
  128. * before this Date
  129. * @param includeVoided - boolean, if true will return voided PatientPrograms as well. If false,
  130. * will not return voided PatientPrograms
  131. * @return List<PatientProgram> of PatientPrograms that match the passed input parameters
  132. * @throws DAOException
  133. */
  134. public List<PatientProgram> getPatientPrograms(Patient patient, Program program, Date minEnrollmentDate,
  135. Date maxEnrollmentDate, Date minCompletionDate, Date maxCompletionDate, boolean includeVoided)
  136. throws DAOException;
  137.  
  138. /**
  139. * Completely remove a patientProgram from the database (not reversible) This method delegates
  140. * to #purgePatientProgram(patientProgram, boolean) method
  141. *
  142. * @param patientProgram the PatientProgram to clean out of the database.
  143. * @throws DAOException
  144. */
  145. public void deletePatientProgram(PatientProgram patientProgram) throws DAOException;
  146.  
  147. // **************************
  148. // CONCEPT STATE CONVERSION
  149. // **************************
  150.  
  151. /**
  152. * Save ConceptStateConversion to database (create if new or update if changed)
  153. *
  154. * @param csc The ConceptStateConversion to save
  155. * @return The saved ConceptStateConversion
  156. * @throws DAOException
  157. */
  158. public ConceptStateConversion saveConceptStateConversion(ConceptStateConversion csc) throws DAOException;
  159.  
  160. /**
  161. * Returns all conceptStateConversions
  162. *
  163. * @return List<ConceptStateConversion> of all ConceptStateConversions that exist
  164. * @throws DAOException
  165. */
  166. public List<ConceptStateConversion> getAllConceptStateConversions() throws DAOException;
  167.  
  168. /**
  169. * Returns a conceptStateConversion given that conceptStateConversions primary key
  170. * <code>conceptStateConversionId</code> A null value is returned if no conceptStateConversion
  171. * exists with this conceptStateConversionId.
  172. *
  173. * @param id integer primary key of the conceptStateConversion to find
  174. * @return ConceptStateConversion object that has
  175. * conceptStateConversion.conceptStateConversionId =
  176. * <code>conceptStateConversionId</code> passed in.
  177. * @throws DAOException
  178. */
  179. public ConceptStateConversion getConceptStateConversion(Integer id);
  180.  
  181. /**
  182. * Completely remove a conceptStateConversion from the database (not reversible)
  183. *
  184. * @param csc the ConceptStateConversion to clean out of the database.
  185. * @throws DAOException
  186. */
  187. public void deleteConceptStateConversion(ConceptStateConversion csc);
  188.  
  189. /**
  190. * Retrieves the ConceptStateConversion that matches the passed <code>ProgramWorkflow</code> and
  191. * <code>Concept</code>
  192. *
  193. * @param workflow the ProgramWorkflow to check
  194. * @param trigger the Concept to check
  195. * @return ConceptStateConversion that matches the passed <code>ProgramWorkflow</code> and
  196. * <code>Concept</code>
  197. * @throws DAOException
  198. */
  199. public ConceptStateConversion getConceptStateConversion(ProgramWorkflow workflow, Concept trigger);
  200.  
  201. /**
  202. * Auto generated method comment
  203. *
  204. * @param uuid
  205. * @return
  206. */
  207. public ConceptStateConversion getConceptStateConversionByUuid(String uuid);
  208.  
  209. /**
  210. * Auto generated method comment
  211. *
  212. * @param uuid
  213. * @return
  214. */
  215. public PatientProgram getPatientProgramByUuid(String uuid);
  216.  
  217. /**
  218. * Auto generated method comment
  219. *
  220. * @param uuid
  221. * @return
  222. */
  223. public Program getProgramByUuid(String uuid);
  224.  
  225. /**
  226. * Retrieves the Programs from the dB which have the given name.
  227. * @param name the name of the Programs to retrieve.
  228. * @param includeRetired whether to include retired programs or not
  229. * @should return an empty list when there is no program in the dB with given name
  230. * @should return only and exactly the programs with the given name
  231. * @return all Programs with the given name.
  232. */
  233. public List<Program> getProgramsByName(String name, boolean includeRetired);
  234.  
  235. /**
  236. * Auto generated method comment
  237. *
  238. * @param uuid
  239. * @return
  240. */
  241. public ProgramWorkflowState getStateByUuid(String uuid);
  242.  
  243. public PatientState getPatientStateByUuid(String uuid);
  244.  
  245. /**
  246. * Auto generated method comment
  247. *
  248. * @param uuid
  249. * @return
  250. */
  251. public ProgramWorkflow getWorkflowByUuid(String uuid);
  252.  
  253. /**
  254. * Returns a list of Programs that are using a particular concept.
  255. *
  256. * @param concept - The Concept being used.
  257. * @return - A List of Programs
  258. */
  259. public List<Program> getProgramsByConcept(Concept concept);
  260.  
  261. /**
  262. * Returns a list of ProgramWorkflows that are using a particular concept.
  263. *
  264. * @param concept - The Concept being used.
  265. * @return - A List of ProgramWorkflows
  266. */
  267. public List<ProgramWorkflow> getProgramWorkflowsByConcept(Concept concept);
  268.  
  269. /**
  270. * Returns a list of ProgramWorkflowStates that are using a particular concept.
  271. *
  272. * @param concept - The Concept being used.
  273. * @return - A List of ProgramWorkflowStates
  274. */
  275. public List<ProgramWorkflowState> getProgramWorkflowStatesByConcept(Concept concept);
  276.  
  277. public void deleteProgramWorkflowState(ProgramWorkflowState state);
  278. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement