- Timestamp:
- 05/16/08 13:28:28 (4 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs/branches/api_refactoring/src/api/org/openmrs/api/db/ConceptDAO.java
r4231 r4240 26 26 import org.openmrs.ConceptWord; 27 27 import org.openmrs.Drug; 28 import org.openmrs.api.ConceptService; 28 29 29 30 /** 30 31 * Concept-related database functions 31 * @version 1.0 32 * 33 * @see ConceptService 32 34 */ 33 35 public interface ConceptDAO { 34 36 35 37 /** 36 * 37 * Creates or updates a concept 38 * @see ConceptService.createConcept() 39 * @param concept 40 * @throws DAOException 41 */ 42 public Concept saveConcept(Concept concept) throws DAOException; 43 44 /** 45 * Delete the given concept 46 * 47 * For super users only. If dereferencing concepts, use <code>voidConcept(org.openmrs.Concept)</code> 48 * 49 * @param Concept to be deleted 50 * @throws DAOException 51 */ 52 public void purgeConcept(Concept concept)throws DAOException; 53 54 /** 55 * 56 * purges a drug from the database. 57 * 58 * @param drug 59 * @throws DAOException 60 */ 61 public void purgeDrug(Drug drug) throws DAOException; 62 63 /** 64 * @param Drug to be created 65 * @throws DAOException 66 */ 67 public Drug saveDrug(Drug drug) throws DAOException; 68 69 /** 70 * Gets the concept with the given internal identifier 71 * @param conceptId 72 * @return Concept 73 * @throws DAOException 38 * @see org.openmrs.api.ConceptService#saveConcept(org.openmrs.Concept) 39 */ 40 public Concept saveConcept(Concept concept) throws DAOException; 41 42 /** 43 * @see org.openmrs.api.ConceptService#purgeConcept(org.openmrs.Concept) 44 */ 45 public void purgeConcept(Concept concept)throws DAOException; 46 47 /** 48 * @see org.openmrs.api.ConceptService#purgeDrug(org.openmrs.Drug) 49 */ 50 public void purgeDrug(Drug drug) throws DAOException; 51 52 /** 53 * @see org.openmrs.api.ConceptService#saveDrug(org.openmrs.Drug) 54 */ 55 public Drug saveDrug(Drug drug) throws DAOException; 56 57 /** 58 * @see org.openmrs.api.ConceptService#getConcept(java.lang.Integer) 74 59 */ 75 60 public Concept getConcept(Integer conceptId) throws DAOException; 76 61 77 78 /** 79 * 80 * Gets all concepts 81 * 82 * @param sortBy (the java class to sort by) 83 * @param asc true = asc false = desc 84 * @param includeRetired 85 * @throws DAOException 86 */ 87 public List<Concept> getConcepts(String sortBy, boolean asc, boolean includeRetired) throws DAOException; 88 89 /** 90 * 62 /** 63 * @see org.openmrs.api.ConceptService#getAllConcepts(java.lang.String, boolean, boolean) 64 */ 65 public List<Concept> getAllConcepts(String sortBy, boolean asc, boolean includeRetired) throws DAOException; 66 67 /** 91 68 * Returns a list of concepts based on the search criteria 92 69 * 93 70 * @param name 94 71 * @param loc 95 * @param includeRetired96 72 * @param searchOnPhrase This puts wildcard characters around the concept name search criteria 97 73 * @return List<Concept> 98 74 * @throws DAOException 99 75 */ 100 public List<Concept> getConcepts(String name, Locale loc, boolean includeRetired, boolean searchOnPhrase) throws DAOException; 101 102 /** 103 * 104 * Returns a List<ConceptWord> 105 * 106 * @param phrase 107 * @param locales 108 * @param includeRetired 109 * @param requireClasses 110 * @param excludeClasses 111 * @param requireDatatypes 112 * @param excludeDatatypes 113 * @param start 114 * @param size 115 * @return 116 */ 117 public List<ConceptWord> getConcepts(String phrase, List<Locale> locales, boolean includeRetired, 76 public List<Concept> getConcepts(String name, Locale loc, boolean searchOnPhrase, List<ConceptClass> classes, List<ConceptDatatype> datatypes) throws DAOException; 77 78 /** 79 * @see org.openmrs.api.ConceptService#getConceptWords(java.lang.String, java.util.Locale, boolean, java.util.List, java.util.List, java.util.List, java.util.List, Concept, int, int) 80 */ 81 public List<ConceptWord> getConceptWords(String phrase, List<Locale> locales, boolean includeRetired, 118 82 List<ConceptClass> requireClasses, List<ConceptClass> excludeClasses, 119 83 List<ConceptDatatype> requireDatatypes,List<ConceptDatatype> excludeDatatypes, 120 Integer start, Integer size); 121 122 123 /** 124 * 125 * returns concepts by conceptClass 126 * 127 * @param cc the concept class 128 * @param includeRetired 129 * @return a List of concepts 130 * @throws DAOException 131 */ 132 public List<Concept> getConcepts(ConceptClass cc, boolean includeRetired) throws DAOException; 133 134 /** 135 * Gets the conceptAnswer with the given internal identifier 136 * @param conceptAnswerId 137 * @return ConceptAnswer 138 * @throws DAOException 84 Concept answersToConcept, Integer start, Integer size) throws DAOException; 85 86 /** 87 * @see org.openmrs.api.ConceptService#getConceptAnswer(java.lang.Integer) 139 88 */ 140 89 public ConceptAnswer getConceptAnswer(Integer conceptAnswerId) throws DAOException; 141 90 142 143 144 /** 145 * Return drug object corresponding to the given id 146 * @return Drug 147 * @throws DAOException 91 /** 92 * @see org.openmrs.api.ConceptService#getDrug(java.lang.Integer) 148 93 */ 149 94 public Drug getDrug(Integer drugId) throws DAOException; 150 95 151 96 /** 152 *153 97 * DAO for retrieving a list of drugs based on the following criteria 154 98 * 155 99 * @param drugName 156 100 * @param concept 157 * @param include Voided101 * @param includeRetired 158 102 * @return List<Drug> 159 103 * @throws DAOException 160 104 */ 161 public List<Drug> getDrugs(String drugName, Concept concept, boolean includeVoided) throws DAOException; 162 163 /** 164 * 165 * Returns a list of drugs based on the search phrase 166 * 167 * @param phrase 168 * @param includeVoided 169 * @return List<Drug> 170 * @throws DAOException 171 */ 172 public List<Drug> getDrugs(String phrase, boolean includeVoided) throws DAOException; 173 174 175 /** 176 * Return a Concept class matching the given identifier 177 * @param i Integer 178 * @return ConceptClass 179 * @throws DAOException 105 public List<Drug> getDrugs(String drugName, Concept concept, boolean includeRetired) throws DAOException; 106 107 /** 108 * @see org.openmrs.api.ConceptService#getDrugs(java.lang.String) 109 */ 110 public List<Drug> getDrugs(String phrase) throws DAOException; 111 112 /** 113 * @see org.openmrs.api.ConceptService#getConceptClass(java.lang.Integer) 180 114 */ 181 115 public ConceptClass getConceptClass(Integer i) throws DAOException; 182 116 183 117 /** 184 * 185 * Returns a list of ConceptClasses optionally matching the name String; 186 * 187 * @param name 188 * @return a List of ConceptClasses 189 * @throws DAOException 118 * @see org.openmrs.api.ConceptService#getConceptClassByName(java.lang.String) 190 119 */ 191 120 public List<ConceptClass> getConceptClasses(String name) throws DAOException; 192 121 193 122 /** 194 * 195 * Creates or updates a ConceptClass 196 *197 * @param cc198 * @return ConceptClass199 * @ throws DAOException123 * @see org.openmrs.api.ConceptService#getAllConceptClasses(boolean) 124 */ 125 public List<ConceptClass> getAllConceptClasses(boolean includeRetired) throws DAOException; 126 127 /** 128 * @see org.openmrs.api.ConceptService#saveConceptClass(org.openmrs.ConceptClass) 200 129 */ 201 130 public ConceptClass saveConceptClass(ConceptClass cc) throws DAOException; 202 131 203 132 /** 204 * 205 * Purges a conceptClass 206 * 207 * @param cc 208 * @throws DAOException 133 * @see org.openmrs.api.ConceptService#purgeConceptClass(org.openmrs.ConceptClass) 209 134 */ 210 135 public void purgeConceptClass(ConceptClass cc) throws DAOException; 211 /** 212 * Return a list of concept datatypes currently in the database 213 * @return List of ConceptDatatypes 214 * @throws DAOException 215 */ 216 public List<ConceptDatatype> getConceptDatatypes() throws DAOException; 217 218 219 /** 220 * Return a ConceptDatatype matching the given identifier 221 * @return ConceptDatatype 222 * @throws DAOException 136 137 /** 138 * @see org.openmrs.api.ConceptService#getAllConceptDatatypes(boolean) 139 */ 140 public List<ConceptDatatype> getAllConceptDatatypes(boolean includeRetired) throws DAOException; 141 142 /** 143 * @see org.openmrs.api.ConceptService#getConceptDatatypes(java.lang.String) 144 */ 145 public List<ConceptDatatype> getConceptDatatypes(String name) throws DAOException; 146 147 /** 148 * @see org.openmrs.api.ConceptService#getConceptDatatype(java.lang.Integer) 223 149 */ 224 150 public ConceptDatatype getConceptDatatype(Integer i) throws DAOException; 225 151 226 152 /** 227 * 228 * DAO for saving a ConceptDatatype 229 * 230 * @param cd 231 * @return 232 * @throws DAOException 153 * @see org.openmrs.api.ConceptService#saveConceptDatatype(org.openmrs.ConceptDatatype) 233 154 */ 234 155 public ConceptDatatype saveConceptDatatype(ConceptDatatype cd) throws DAOException; 235 156 236 157 /** 237 * 238 * DAO for purging a ConceptDatatype 239 * 240 * @param cd 241 * @throws DAOException 158 * @see org.openmrs.api.ConceptService#purgeConceptDatatype(org.openmrs.ConceptDatatype) 242 159 */ 243 160 public void purgeConceptDatatype(ConceptDatatype cd) throws DAOException; 244 161 245 162 /** 246 * Updates the concept set derived business table for this concept (bursting the concept sets) 247 * @param concept 248 * @throws DAOException 163 * @see org.openmrs.api.ConceptService#updateConceptSetDerived(org.openmrs.Concept) 249 164 */ 250 165 public void updateConceptSetDerived(Concept concept) throws DAOException; 251 166 252 167 /** 253 * Iterates over all concepts calling updateConceptSetDerived(concept) 254 * @throws DAOException 168 * @see org.openmrs.api.ConceptService#updateConceptSetDerived() 255 169 */ 256 170 public void updateConceptSetDerived() throws DAOException; 257 171 258 172 /** 259 * Return a list of the concept sets with concept_set matching concept 260 * @return List 261 * @throws DAOException 262 */ 263 public List<ConceptSet> getConceptSets(Concept c) throws DAOException; 173 * @see org.openmrs.api.ConceptService#getConceptSetsByConcept(org.openmrs.Concept) 174 */ 175 public List<ConceptSet> getConceptSetsByConcept(Concept c) throws DAOException; 264 176 265 177 /** 266 178 * @see org.openmrs.api.ConceptService#getSetsContainingConcept(org.openmrs.Concept) 267 * @throws DAOException268 179 */ 269 180 public List<ConceptSet> getSetsContainingConcept(Concept concept) throws DAOException; 270 181 271 182 /** 272 * Return a concept numeric object given the concept id 273 * @return ConceptNumeric 274 * @throws DAOException 183 * @see org.openmrs.api.ConceptService#getConceptNumeric(java.lang.Integer) 275 184 */ 276 185 public ConceptNumeric getConceptNumeric(Integer conceptId) throws DAOException; 277 186 278 279 /** 280 * Searches on given phrase via the concept word table 281 * Restricts on answers to the given concept 282 * 283 * @param phrase/search/words String 284 * @param locale Locale 285 * @param Concept 286 * @param includeRetired boolean 287 * @return list of concept words 288 * @throws DAOException 289 */ 290 public List<ConceptWord> findConceptAnswers(String phrase, Locale locale, Concept concept, boolean includeRetired) throws DAOException; 291 292 /** 293 * Get the questions that have this concept as a possible answer 294 * 295 * @param concept Concept to get 296 * @return list of concepts 297 * @throws DAOException 187 /** 188 * @see org.openmrs.api.ConceptService#getConceptsByAnswer(org.openmrs.Concept) 298 189 */ 299 190 public List<Concept> getConceptsByAnswer(Concept concept)throws DAOException; 300 191 301 192 /** 302 * Finds the previous available concept via concept id 303 * @param c 304 * @param offset 305 * @return 306 * @throws DAOException 193 * @see org.openmrs.api.ConceptService#getPrevConcept(org.openmrs.Concept) 307 194 */ 308 195 public Concept getPrevConcept(Concept c) throws DAOException; 309 196 310 197 /** 311 * Finds the next available concept via concept id 312 * @param c 313 * @param offset 314 * @return 315 * @throws DAOException 198 * @see org.openmrs.api.ConceptService#getNextConcept(org.openmrs.Concept) 316 199 */ 317 200 public Concept getNextConcept(Concept c) throws DAOException; 318 201 319 320 /** 321 * 322 * Get all ConceptProposals 323 * 324 * @param includeComplete 325 * @return 326 * @throws DAOException 327 */ 328 public List<ConceptProposal> getConceptProposals(boolean includeComplete) throws DAOException ; 329 330 /** 331 * 332 * Get ConceptProposal by ID 333 * 334 * @param i 335 * @return 336 * @throws DAOException 202 /** 203 * @see org.openmrs.api.ConceptService#getAllConceptProposals(boolean) 204 */ 205 public List<ConceptProposal> getAllConceptProposals(boolean includeComplete) throws DAOException ; 206 207 /** 208 * @see org.openmrs.api.ConceptService#getConceptProposal(java.lang.Integer) 337 209 */ 338 210 public ConceptProposal getConceptProposal(Integer i) throws DAOException; 339 211 340 212 /** 341 * 342 * Gets a ConceptProposal by name 343 * 344 * @param text 345 * @return 346 * @throws DAOException 213 * @see org.openmrs.api.ConceptService#getConceptProposals(java.lang.String) 347 214 */ 348 215 public List<ConceptProposal> getConceptProposals(String text) throws DAOException; 349 216 350 217 /** 351 * 352 * Returns a List of Concepts that are referenced in the mappedConcept column of the concept_proposal table 353 * 354 * @param text 355 * @return 356 * @throws DAOException 218 * @see org.openmrs.api.ConceptService#getProposedConcepts(java.lang.String) 357 219 */ 358 220 public List<Concept> getProposedConcepts(String text) throws DAOException; 359 /** 360 * 361 * Propose or update a ConceptProposal 362 * 363 * @param cp 364 * @throws DAOException 365 */ 366 public ConceptProposal saveConceptProposal(ConceptProposal cp) throws DAOException; 367 368 /** 369 * 370 * Deletes a concept proposal from the database 371 * 372 * @param cp 373 * @throws DAOException 374 */ 375 public void purgeConceptProposal(ConceptProposal cp) throws DAOException; 376 /** 377 * 378 * DAO for getting the next available conceptId 379 * 380 * @return 381 * @throws DAOException 221 222 /** 223 * @see org.openmrs.api.ConceptService#saveConceptProposal(org.openmrs.ConceptProposal) 224 */ 225 public ConceptProposal saveConceptProposal(ConceptProposal cp) throws DAOException; 226 227 /** 228 * @see org.openmrs.api.ConceptService#purgeConceptProposal(org.openmrs.ConceptProposal) 229 */ 230 public void purgeConceptProposal(ConceptProposal cp) throws DAOException; 231 232 /** 233 * @see org.openmrs.api.ConceptService#getNextAvailableId() 382 234 */ 383 235 public Integer getNextAvailableId() throws DAOException; 384 236 385 386 /** 387 * 388 * Gets concepts with drugs in formulary 389 * @param boolean includeVoided include or exclude voided drugs 390 * @return A List of Concepts 391 * @throws DAOException 392 */ 393 public List<Concept> getConceptsWithDrugsInFormulary(boolean includeVoided) throws DAOException; 394 395 396 /** 397 * Iterates over the words in names and synonyms (for each locale) and updates the concept word business table 398 * @param concept 399 * @throws DAOException 237 /** 238 * @see org.openmrs.api.ConceptService#getConceptsWithDrugsInFormulary() 239 */ 240 public List<Concept> getConceptsWithDrugsInFormulary() throws DAOException; 241 242 /** 243 * @see org.openmrs.api.ConceptService#updateConceptWord(org.openmrs.Concept) 400 244 */ 401 245 public void updateConceptWord(Concept concept) throws DAOException; 402 246 403 404 405 247 }