Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
05/28/08 05:16:52 (8 months ago)
Author:
bmckown
Message:

complex_obs branch: Merging trunk to complex-obs [3891] [4378] TODO: sqldiff.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs/branches/complex-obs/src/api/org/openmrs/api/ConceptService.java

    • Property svn:eol-style set to CRLF
    r4239 r4417  
    2929import org.openmrs.annotation.Authorized; 
    3030import org.openmrs.api.db.ConceptDAO; 
     31import org.openmrs.util.OpenmrsConstants; 
    3132import org.springframework.transaction.annotation.Transactional; 
    3233 
     34/** 
     35 * Contains methods pertaining to creating/updating/deleting/retiring  
     36 * Concepts, Drugs, Concept Proposals, and all other things 'Concept' 
     37 *  
     38 * Use: 
     39 * <code> 
     40 *   List<Concept> concepts = Context.getConceptService().getAllConcepts(); 
     41 * </code> 
     42 *  
     43 * @see org.openmrs.api.context.Context 
     44 */ 
    3345@Transactional 
    34 public interface ConceptService { 
    35  
     46public interface ConceptService extends OpenmrsService { 
     47         
     48        /** 
     49         * Sets the data access object for Concepts.  The dao is used for  
     50         * saving and getting concepts to/from the database 
     51         *  
     52         * @param dao The data access object to use 
     53         */ 
    3654        public void setConceptDAO(ConceptDAO dao); 
    3755 
    3856        /** 
    39          * @param concept 
    40          *            to be created 
    41          */ 
    42         @Authorized({"Add Concepts"}) 
    43         public void createConcept(Concept concept); 
    44  
    45         /** 
    46          * @param numeric 
    47          *            concept to be created 
    48          */ 
    49         @Authorized({"Add Concepts"}) 
    50         public void createConcept(ConceptNumeric concept); 
    51          
    52         /** 
    53          * Save a ComplexConcept that is new or has been edited.  
    54          * TODO: Annotation tags. 
    55          *  
    56          * @param concept 
    57          */ 
    58         public void saveConcept(ConceptComplex concept); 
    59          
    60         /** 
    61          * Get a ComplexConcept for the conceptId 
    62          *  
    63          * @param conceptId of the ComplexConcept 
     57         * @deprecated use #saveConcept(Concept) 
     58         */ 
     59        @Authorized({OpenmrsConstants.PRIV_MANAGE_CONCEPTS}) 
     60        public void createConcept(Concept concept) throws APIException; 
     61 
     62        /** 
     63         * @deprecated use #saveConcept(Concept) 
     64         */ 
     65        @Authorized({OpenmrsConstants.PRIV_MANAGE_CONCEPTS}) 
     66        public void createConcept(ConceptNumeric concept) throws APIException; 
     67 
     68        /** 
     69         * @deprecated use #saveConcept(Concept) 
     70         */ 
     71        @Authorized({OpenmrsConstants.PRIV_MANAGE_CONCEPTS}) 
     72        public void updateConcept(Concept concept) throws APIException; 
     73 
     74        /** 
     75         * @deprecated use #saveConcept(Concept) 
     76         */ 
     77        @Authorized({OpenmrsConstants.PRIV_MANAGE_CONCEPTS}) 
     78        public void updateConcept(ConceptNumeric concept) throws APIException; 
     79         
     80        /** 
     81         * @deprecated use #saveDrug(Drug) 
     82         */ 
     83        @Authorized({OpenmrsConstants.PRIV_MANAGE_CONCEPTS}) 
     84        public void createDrug(Drug drug) throws APIException; 
     85 
     86        /** 
     87         * @deprecated use #saveDrug(Drug) 
     88         */ 
     89        @Authorized({OpenmrsConstants.PRIV_MANAGE_CONCEPTS}) 
     90        public void updateDrug(Drug drug) throws APIException; 
     91         
     92        /** 
     93         * @deprecated use #purgeConcept(Concept concept) 
     94         */ 
     95        @Authorized({OpenmrsConstants.PRIV_PURGE_CONCEPTS}) 
     96        public void deleteConcept(Concept concept) throws APIException; 
     97         
     98        /** 
     99         * @deprecated use {@link #retireConcept(Concept, String)}            
     100         */ 
     101        @Authorized({OpenmrsConstants.PRIV_MANAGE_CONCEPTS}) 
     102        public void voidConcept(Concept concept, String reason) throws APIException; 
     103         
     104        /** 
     105         * Save or update the given <code>Concept</code> or <code>ConceptNumeric</code> in the database 
     106         *  
     107         * @param Concept concept The <code>Concept</code> or <code>ConceptNumeric</code> to save or update 
     108         * @return the <code>Concept</code> or <code>ConceptNumeric</code> that was saved or updated 
     109         * @throws APIException 
     110         */ 
     111        @Authorized({OpenmrsConstants.PRIV_MANAGE_CONCEPTS}) 
     112        public Concept saveConcept(Concept concept) throws APIException; 
     113         
     114        /** 
     115         * Save or update the given <code>Drug</code> in the database 
     116         *  
     117         * @param Drug drug The Drug to save or update 
     118         * @return the Drug that was saved or updated 
     119         * @throws APIException 
     120         */ 
     121        @Authorized({OpenmrsConstants.PRIV_MANAGE_CONCEPTS}) 
     122        public Drug saveDrug(Drug drug) throws APIException; 
     123         
     124        /** 
     125         * Completely purge a <code>Concept</code> or <code>ConceptNumeric</code> from the database.   
     126         * This should not typically be used unless desperately needed.  Most should just be retired. 
     127         * See {@link #retireConcept(Concept, String)} 
     128         *  
     129         * @param Object conceptOrConceptNumeric The <code>Concept</code> or <code>ConceptNumeric</code> to remove from the system 
     130         * @throws APIException 
     131         */ 
     132        @Authorized(OpenmrsConstants.PRIV_PURGE_CONCEPTS) 
     133        public void purgeConcept(Concept conceptOrConceptNumeric) throws APIException; 
     134         
     135        /** 
     136         * Retiring a concept essentially removes it from circulation 
     137         *  
     138         * @param Concept conceptOrConceptNumeric The <code>Concept</code> or <code>ConceptNumeric</code> to retire 
     139         * @param String reason The retire reason 
     140         * @return the retired <code>Concept</code> or <code>ConceptNumeric</code> 
     141         * @throws APIException 
     142         */ 
     143        @Authorized(OpenmrsConstants.PRIV_MANAGE_CONCEPTS) 
     144        public Concept retireConcept(Concept conceptOrConceptNumeric, String reason) throws APIException; 
     145         
     146        /** 
     147         * Retiring a Drug essentially removes it from circulation 
     148         *  
     149         * @param Drug drug The Drug to retire 
     150         * @param String reason The retire reason 
     151         * @throws APIException 
     152         * @return the retired Drug 
     153         */ 
     154        @Authorized(OpenmrsConstants.PRIV_MANAGE_CONCEPTS) 
     155        public Drug retireDrug(Drug drug, String reason) throws APIException; 
     156         
     157        /** 
     158         * Completely purge a Drug from the database.  This should not typically 
     159         * be used unless desperately needed.  Most Drugs should just be retired. 
     160         *  
     161         * @param Drug drug The Drug to remove from the system 
     162         * @throws APIException 
     163         */ 
     164        @Authorized(OpenmrsConstants.PRIV_PURGE_CONCEPTS) 
     165        public void purgeDrug(Drug drug) throws APIException; 
     166         
     167        /** 
     168         * Gets the concept with the given id 
     169         *  
     170         * @param Integer conceptId 
     171         * @return the matching Concept object 
     172         * @throws APIException 
     173         */ 
     174        @Transactional(readOnly=true) 
     175        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     176        public Concept getConcept(Integer conceptId) throws APIException; 
     177 
     178        /** 
     179         * Gets the ConceptAnswer with the given id 
     180         *  
     181         * @param Integer conceptAnswerId 
     182         * @return the matching ConceptAnswer object 
     183         * @throws APIException 
     184         */ 
     185        @Transactional(readOnly=true) 
     186        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     187        public ConceptAnswer getConceptAnswer(Integer conceptAnswerId) throws APIException; 
     188 
     189        /** 
     190         * Get the Drug with the given id 
     191         *  
     192         * @param Integer drugId  
     193         * @return the matching Drug object 
     194         * @throws APIException 
     195         */ 
     196        @Transactional(readOnly=true) 
     197        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     198        public Drug getDrug(Integer drugId) throws APIException; 
     199         
     200        /** 
     201         * Get the ConceptNumeric with the given id 
     202         *  
     203         * @param Integer conceptId The ConceptNumeric id 
     204         * @return the matching ConceptNumeric object 
     205         * @throws APIException 
     206         */ 
     207        @Transactional(readOnly=true) 
     208        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     209        public ConceptNumeric getConceptNumeric(Integer conceptId) throws APIException; 
     210         
     211        /** 
     212         * Return a Concept class matching the given identifier 
     213         * @throws APIException 
     214         * @param i the concept class identifier 
     215         * @return the matching ConceptClass 
     216         */ 
     217        @Transactional(readOnly=true) 
     218        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     219        public ConceptClass getConceptClass(Integer conceptClassId) throws APIException; 
     220         
     221        /** 
     222         * Return a list of unretired concepts sorted by concept id ascending and  
     223         *  
     224         * @return a List<Concept> object containing all of the sorted concepts 
     225         * @throws APIException 
     226         */ 
     227        @Transactional(readOnly=true) 
     228        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     229        public List<Concept> getAllConcepts() throws APIException; 
     230         
     231        /** 
     232         * Return a list of concepts sorted on sortBy in dir direction (asc/desc) 
     233         * 
     234         * @param sortBy The property name to sort by; if null or invalid, concept_id is used. 
     235         * @param boolean asc true = sort ascending; false = sort descending 
     236         * @param boolean includeRetired If <code>true</code>, retired concepts will also be returned 
     237         * @return a List<Concept> object containing all of the sorted concepts 
     238         * @throws APIException 
     239         */ 
     240        @Transactional(readOnly=true) 
     241        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     242        public List<Concept> getAllConcepts(String sortBy, boolean asc, boolean includeRetired) throws APIException; 
     243                 
     244        /** 
     245         * @deprecated use {@link #getAllConcepts(String, boolean, boolean)} 
     246         */ 
     247        @Transactional(readOnly=true) 
     248        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     249        public List<Concept> getConcepts(String sortBy, String dir) throws APIException; 
     250 
     251        /** 
     252         * Returns a list of concepts matching any part of a concept name 
     253         * @param String name The search string 
     254         * @throws APIException 
     255         * @return a List<Concept> object containing all of the matching concepts 
     256         */ 
     257        @Transactional(readOnly=true) 
     258        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     259        public List<Concept> getConceptsByName(String name) throws APIException; 
     260 
     261        /** 
     262         * Return a Concept that matches the name exactly 
     263         * @param String name The search string 
     264         * @throws APIException 
     265         * @return the found Concept 
     266         */ 
     267        @Transactional(readOnly=true) 
     268        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     269        public Concept getConceptByName(String name) throws APIException; 
     270 
     271        /** 
     272         * Get Concepts by id or name 
     273         * Note: this just calls other impl methods; no DAO of its own 
     274         *  
     275         * @param String idOrName 
     276         * @return the found Concept 
     277         * @deprecated use {@link #getConceptByName(String)} 
     278         * @throws APIException 
     279         */ 
     280        @Transactional(readOnly=true) 
     281        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     282        public Concept getConceptByIdOrName(String idOrName) throws APIException; 
     283         
     284        /** 
     285         * Get Concept by id or name convenience method 
     286         *  
     287         * @param String conceptIdOrName 
     288         * @return the found Concept 
     289         * @throws APIException 
     290         */ 
     291        @Transactional(readOnly=true) 
     292        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     293        public Concept getConcept(String conceptIdOrName) throws APIException; 
     294         
     295        /** 
     296         * Searches for concepts by the given parameters via the ConceptWord table 
     297         *  
     298         * @param String phrase  
     299         * @param List<Locale> locales 
     300         * @param boolean includeRetired  
     301         * @param List<ConceptClass> requireClasses 
     302         * @param List<ConceptClass> excludeClasses 
     303         * @param List<ConceptDatatype> requireDatatypes 
     304         * @param List<ConceptDatatype> excludeDatatypes 
     305         * @param answersToConcept all results will be a possible answer to this concept 
     306         * @param int start 
     307         * @param int size 
     308         * @return A List<ConceptWord> object containing all matching ConceptWords 
     309         * @throws APIException 
     310         */ 
     311        @Transactional(readOnly=true) 
     312        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     313        public List<ConceptWord> getConceptWords(String phrase, List<Locale> locales, boolean includeRetired,  
     314                        List<ConceptClass> requireClasses, List<ConceptClass> excludeClasses, 
     315                        List<ConceptDatatype> requireDatatypes,List<ConceptDatatype> excludeDatatypes, 
     316                        Concept answersToConcept, Integer start, Integer size) throws APIException; 
     317         
     318        /** 
     319         * Convenience method for {@link #getConceptWords(String, List, boolean, List, List, List, List, Integer, Integer)} 
     320         *  
     321         * @param phrase search string 
     322         * @param locale 
    64323         * @return 
    65          */ 
    66         public ConceptComplex getConceptComplex(Integer conceptId); 
    67                  
    68         /** 
    69          * Gets the concept with the given internal identifier 
    70          *  
    71          * @param conceptId 
    72          * @return Concept 
    73          */ 
    74         @Transactional(readOnly=true) 
    75         @Authorized({"View Concepts"}) 
    76         public Concept getConcept(Integer conceptId); 
    77  
    78         /** 
    79          * Gets the conceptAnswer with the given internal identifier 
    80          *  
    81          * @param conceptAnswerId 
    82          * @return ConceptAnswer 
    83          */ 
    84         @Transactional(readOnly=true) 
    85         @Authorized({"View Concepts"}) 
    86         public ConceptAnswer getConceptAnswer(Integer conceptAnswerId); 
    87  
    88         /** 
    89          * Return a list of concepts sorted on sortBy in dir direction (asc/desc) 
    90          *  
    91          * @param sortBy 
    92          * @param dir 
    93          * @return List of concepts 
    94          */ 
    95         @Transactional(readOnly=true) 
    96         @Authorized({"View Concepts"}) 
    97         public List<Concept> getConcepts(String sortBy, String dir); 
    98  
    99         /** 
    100          * Update the given concept 
    101          *  
    102          * @param concept 
    103          *            to be updated 
    104          */ 
    105         @Authorized({"Edit Concepts"}) 
    106         public void updateConcept(Concept concept); 
    107  
    108         /** 
    109          * Update the given numeric concept 
    110          *  
    111          * @param numeric 
    112          *            concept to be updated 
    113          */ 
    114         @Authorized({"Edit Concepts"}) 
    115         public void updateConcept(ConceptNumeric concept); 
    116  
    117         /** 
    118          * Delete the given concept 
    119          *  
    120          * For super users only. If dereferencing concepts, use 
    121          * <code>voidConcept(org.openmrs.Concept)</code> 
    122          *  
    123          * @param Concept 
    124          *            to be deleted 
    125          */ 
    126         @Authorized({"Delete Concepts"}) 
    127         public void deleteConcept(Concept concept); 
    128  
    129         /** 
    130          * Voiding a concept essentially removes it from circulation 
    131          *  
    132          * @param Concept 
    133          *            concept 
    134          * @param String 
    135          *            reason 
    136          */ 
    137         @Authorized({"Edit Concepts"}) 
    138         public void voidConcept(Concept concept, String reason); 
    139  
    140         /** 
    141          * @param drug 
    142          *            to be created 
    143          */ 
    144         @Authorized({"Add Concepts"}) 
    145         public void createDrug(Drug drug); 
    146  
    147         /** 
    148          * Update the given drug 
    149          *  
    150          * @param drug 
    151          *            to be updated 
    152          */ 
    153         @Authorized({"Edit Concepts"}) 
    154         public void updateDrug(Drug drug); 
    155  
    156         /** 
    157          * Return a list of concepts matching "name" anywhere in the name 
    158          *  
    159          * @param name 
    160          * @return List of concepts 
    161          */ 
    162         @Transactional(readOnly=true) 
    163         @Authorized({"View Concepts"}) 
    164         public List<Concept> getConceptsByName(String name); 
    165  
    166         /** 
    167          * Return a Concept that matches the name exactly 
    168          *  
    169          * @param name 
    170          * @return Concept with matching name 
    171          */ 
    172         @Transactional(readOnly=true) 
    173         @Authorized({"View Concepts"}) 
    174         public Concept getConceptByName(String name); 
    175  
    176         /** 
    177          * Return the drug object corresponding to the given id 
    178          *  
     324         * @throws APIException 
     325         */ 
     326        @Transactional(readOnly=true) 
     327        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     328        public List<ConceptWord> getConceptWords(String phrase, Locale locale) throws APIException; 
     329         
     330        /** 
     331         * @deprecated Use {@link #getConceptWords(String, List, boolean, List, List, List, List, Integer, Integer) 
     332         */ 
     333        @Transactional(readOnly=true) 
     334        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     335        public List<ConceptWord> findConcepts(String phrase, Locale locale, 
     336                        boolean includeRetired) throws APIException; 
     337         
     338        /** 
     339         * @deprecated Use {@link #getConceptWords(String, List, boolean, List, List, List, List, Integer, Integer)} 
     340         */ 
     341        @Transactional(readOnly=true) 
     342        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     343        public List<ConceptWord> findConcepts(String phrase, Locale locale, boolean includeRetired,  
     344                        List<ConceptClass> requireClasses, List<ConceptClass> excludeClasses, 
     345                        List<ConceptDatatype> requireDatatypes,List<ConceptDatatype> excludeDatatypes) throws APIException; 
     346 
     347        /** 
     348         * @deprecated Use {@link #getConceptWords(String, List, boolean, List, List, List, List, Integer, Integer) 
     349         */ 
     350        @Transactional(readOnly=true) 
     351        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     352        public List<ConceptWord> findConcepts(String phrase, Locale locale, 
     353                        boolean includeRetired, int start, int size) throws APIException; 
     354         
     355        /** 
     356         * Return the drug object corresponding to the given name or drugId 
     357         *  
     358         * @param drugNameOrId name or drugId to match exactly on 
    179359         * @return Drug 
    180          */ 
    181         @Transactional(readOnly=true) 
    182         @Authorized({"View Concepts"}) 
    183         public Drug getDrug(Integer drugId); 
    184  
    185         /** 
    186          * Return the drug object corresponding to the given name 
    187          *  
     360         * @throws APIException 
     361         */ 
     362        @Transactional(readOnly=true) 
     363        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     364        public Drug getDrug(String drugNameOrId) throws APIException; 
     365         
     366        /** 
     367         * Return the drug object corresponding to the given name or drugId 
     368         * @param String drugId 
     369         * @throws APIException 
    188370         * @return Drug 
    189371         */ 
    190372        @Transactional(readOnly=true) 
    191         @Authorized({"View Concepts"}) 
    192         public Drug getDrug(String drugName); 
    193  
    194         @Transactional(readOnly=true) 
    195         @Authorized({"View Concepts"}) 
    196         public Drug getDrugByNameOrId(String drugId); 
    197  
    198  
    199         /** 
    200          * Return a list of drugs currently in the database 
    201          *  
    202          * @return List of Drugs 
    203          */ 
    204         @Transactional(readOnly=true) 
    205         @Authorized({"View Concepts"}) 
    206         public List<Drug> getDrugs(); 
    207  
     373        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     374        public Drug getDrugByNameOrId(String drugId) throws APIException; 
     375         
     376        /** 
     377         * @deprecated use {@link ConceptService#getAllDrugs()} 
     378         */ 
     379        @Transactional(readOnly=true) 
     380        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     381        public List<Drug> getDrugs() throws APIException; 
     382         
     383        /** 
     384         * Return a list of drugs currently in the database that are 
     385         * not retired 
     386         *  
     387         * @throws APIException 
     388         * @return a List<Drug> object containing all drugs 
     389         */ 
     390        @Transactional(readOnly=true) 
     391        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     392        public List<Drug> getAllDrugs() throws APIException; 
     393         
     394        /** 
     395         * @deprecated Use {@link #getDrugsByConcept(Concept)} 
     396         */ 
     397        @Transactional(readOnly=true) 
     398        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     399        public List<Drug> getDrugs(Concept concept) throws APIException; 
     400         
     401        /** 
     402         * Return a list of drugs associated with the given concept 
     403         * @throws APIException 
     404         * @param Concept concept 
     405         * @return a List<Drug> object containing all matching drugs 
     406         */ 
     407        @Transactional(readOnly=true) 
     408        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     409        public List<Drug> getDrugsByConcept(Concept concept) throws APIException; 
     410         
     411        /** 
     412         * Get drugs by concept.   
     413         * This method is the utility method that should be used to generically retrieve all Drugs in the system. 
     414         *  
     415         * @param includeRetired If <code>true</code> then the search will include voided Drugs 
     416         * @return A List<Drug> object containing all matching Drugs 
     417         */ 
     418        @Transactional(readOnly=true) 
     419        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     420        public List<Drug> getAllDrugs(boolean includeRetired); 
     421         
     422        /** 
     423         * @deprecated Use {@link #getDrugs(String)} 
     424         */ 
     425        @Transactional(readOnly=true) 
     426        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     427        public List<Drug> findDrugs(String phrase, boolean includeVoided) throws APIException; 
     428         
    208429        /** 
    209430         * Find drugs in the system. The string search can match either drug.name or 
    210431         * drug.concept.name 
    211432         *  
    212          * @param phrase 
    213          * @param includeRetired 
    214          * @return List of Drugs 
    215          */ 
    216         @Transactional(readOnly=true) 
    217         @Authorized({"View Concepts"}
    218         public List<Drug> findDrugs(String phrase, boolean includeRetired); 
    219  
    220         /** 
    221         * Return a list of drugs associated with the given concept 
    222          *  
    223          * @param Concept 
    224          * @return List of Drugs 
    225          */ 
    226         @Transactional(readOnly=true) 
    227         @Authorized({"View Concepts"}
    228         public List<Drug> getDrugs(Concept concept)
    229  
     433         * @param String phrase  
     434         * @param Locale locale 
     435         * @throws APIException 
     436         * @return A List<Drug> object containing all Drug matches 
     437        */ 
     438        @Transactional(readOnly=true
     439        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     440        public List<Drug> getDrugs(String phrase) throws APIException; 
     441         
     442        /** 
     443         * @param ConceptClass cc 
     444         * @return Returns all concepts in a given class 
     445         * @throws APIException  
     446         */ 
     447        @Transactional(readOnly=true) 
     448        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS
     449        public List<Concept> getConceptsByClass(ConceptClass cc) throws APIException
     450         
    230451        /** 
    231452         * Return a list of concept classes currently in the database 
    232          *  
    233          * @return List of Concept class objects 
    234          */ 
    235         @Transactional(readOnly=true) 
    236         @Authorized({"View Concepts"}) 
    237         public List<ConceptClass> getConceptClasses(); 
    238  
    239         /** 
    240          * Return a Concept class matching the given identifier 
    241          *  
    242          * @param i Integer 
     453         * @throws APIException 
     454         * @return List<ConceptClass> object with all ConceptClass objects 
     455         * @deprecated use #getAllConceptClasses(boolean) 
     456         */ 
     457        @Transactional(readOnly=true) 
     458        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_CLASSES) 
     459        public List<ConceptClass> getConceptClasses() throws APIException; 
     460         
     461        /** 
     462         * Return a Concept class matching the given name 
     463         *  
     464         * @param String name 
    243465         * @return ConceptClass 
    244          */ 
    245         @Transactional(readOnly=true) 
    246         @Authorized({"View Concepts"}) 
    247         public ConceptClass getConceptClass(Integer i); 
    248  
    249         /** 
    250          * Return a Concept class matching the given name 
    251          *  
    252          * @param name String 
    253          * @return ConceptClass 
    254          */ 
    255         @Transactional(readOnly=true) 
    256         @Authorized({"View Concepts"}) 
    257         public ConceptClass getConceptClassByName(String name); 
    258  
     466         * @throws APIException 
     467         */ 
     468        @Transactional(readOnly=true) 
     469        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_CLASSES) 
     470        public ConceptClass getConceptClassByName(String name) throws APIException; 
     471         
     472        /** 
     473         * Return a list of concept classes currently in the database 
     474         *  
     475         * @throws APIException 
     476         * @return List<ConceptClass> object with all ConceptClass objects 
     477         */ 
     478        @Transactional(readOnly=true) 
     479        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_CLASSES) 
     480        public List<ConceptClass> getAllConceptClasses() throws APIException; 
     481         
     482        /** 
     483         * Return a list of concept classes currently in the database 
     484         *  
     485         * @param include retired concept classes in the search results 
     486         * @throws APIException 
     487         * @return List<ConceptClass> object with all ConceptClass objects 
     488         */ 
     489        @Transactional(readOnly=true) 
     490        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_CLASSES) 
     491        public List<ConceptClass> getAllConceptClasses(boolean includeRetired) throws APIException; 
     492 
     493        /** 
     494         * Creates or updates a concept class 
     495         * @param ConceptClass to create or update 
     496         * @throws APIException 
     497         */ 
     498        @Authorized(OpenmrsConstants.PRIV_MANAGE_CONCEPT_CLASSES) 
     499        public ConceptClass saveConceptClass(ConceptClass cc) throws APIException; 
     500 
     501        /** 
     502         * Purge a ConceptClass 
     503         * @param ConceptClass to delete 
     504         * @throws APIException 
     505         */ 
     506        @Authorized(OpenmrsConstants.PRIV_PURGE_CONCEPT_CLASSES) 
     507        public void purgeConceptClass(ConceptClass cc) throws APIException;      
     508         
     509        /** 
     510         * Create or update a ConceptDatatype 
     511         * @param ConceptDatatype to create or update 
     512         * @throws APIException 
     513         */ 
     514        @Authorized({OpenmrsConstants.PRIV_MANAGE_CONCEPT_DATATYPES}) 
     515        public ConceptDatatype saveConceptDatatype(ConceptDatatype cd) throws APIException; 
     516         
     517        /** 
     518         * Purge a ConceptDatatype.  This removes the concept datatype from the database completely. 
     519         * @param ConceptDatatype to purge 
     520         * @throws APIException 
     521         */ 
     522        @Authorized(OpenmrsConstants.PRIV_PURGE_CONCEPT_DATATYPES) 
     523        public void purgeConceptDatatype(ConceptDatatype cd) throws APIException; 
     524         
    259525        /** 
    260526         * Return a list of concept datatypes currently in the database 
    261527         *  
     528         * @throws APIException 
    262529         * @return List of ConceptDatatypes 
    263530         */ 
    264531        @Transactional(readOnly=true) 
    265         @Authorized({"View Concepts"}) 
    266         public List<ConceptDatatype> getConceptDatatypes(); 
    267  
     532        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_DATATYPES) 
     533        public List<ConceptDatatype> getAllConceptDatatypes() throws APIException; 
     534         
     535        /** 
     536         * Return a list of concept datatypes currently in the database 
     537         *  
     538         * @param includeRetired true/false whether to include the retired datatypes 
     539         * @throws APIException 
     540         * @return List of ConceptDatatypes 
     541         */ 
     542        @Transactional(readOnly=true) 
     543        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_DATATYPES) 
     544        public List<ConceptDatatype> getAllConceptDatatypes(boolean includeRetired) throws APIException; 
     545         
     546        /** 
     547         * Find concept datatypes that contain the given name string 
     548         *  
     549         * @param name 
     550         * @return 
     551         * @throws APIException 
     552         */ 
     553        @Transactional(readOnly=true) 
     554        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_DATATYPES) 
     555        public List<ConceptDatatype> getConceptDatatypes(String name) throws APIException; 
     556         
    268557        /** 
    269558         * Return a ConceptDatatype matching the given identifier 
    270          *  
     559         * @param Integer i 
    271560         * @return ConceptDatatype 
    272          */ 
    273         @Transactional(readOnly=true) 
    274         @Authorized({"View Concepts"}) 
    275         public ConceptDatatype getConceptDatatype(Integer i); 
     561         * @throws APIException 
     562         */ 
     563        @Transactional(readOnly=true) 
     564        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_DATATYPES) 
     565        public ConceptDatatype getConceptDatatype(Integer i) throws APIException; 
    276566         
    277567        /** 
    278568         * Return a Concept datatype matching the given name 
    279569         *  
    280          * @param name String 
     570         * @param String name 
    281571         * @return ConceptDatatype 
    282          */ 
    283         @Transactional(readOnly=true) 
    284         @Authorized({"View Concepts"}) 
    285         public ConceptDatatype getConceptDatatypeByName(String name); 
     572         * @throws APIException 
     573         */ 
     574        @Transactional(readOnly=true) 
     575        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_DATATYPES) 
     576        public ConceptDatatype getConceptDatatypeByName(String name) throws APIException; 
     577         
     578        /** 
     579         * Updates the concept set derived business table for this concept (bursting the concept sets)  
     580         * @param concept 
     581         * @throws APIException 
     582         */ 
     583        @Authorized({OpenmrsConstants.PRIV_MANAGE_CONCEPTS}) 
     584        public void updateConceptSetDerived(Concept concept) throws APIException; 
     585         
     586        /** 
     587         * Iterates over all concepts calling updateConceptSetDerived(concept) 
     588         * @throws APIException 
     589         */ 
     590        @Authorized({OpenmrsConstants.PRIV_MANAGE_CONCEPTS}) 
     591        public void updateConceptSetDerived() throws APIException; 
     592         
     593        /** 
     594         * @deprecated use {@link #getConceptSetsByConcept(Concept)} 
     595         */ 
     596        @Transactional(readOnly=true) 
     597        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     598        public List<ConceptSet> getConceptSets(Concept concept) throws APIException; 
    286599         
    287600        /** 
     
    291604         * and then take the conceptIds from the resulting list. 
    292605         *  
    293          * @return List 
    294          */ 
    295         @Transactional(readOnly=true) 
    296         @Authorized({"View Concepts"}) 
    297         public List<ConceptSet> getConceptSets(Concept c); 
    298  
    299         @Transactional(readOnly=true) 
    300         @Authorized({"View Concepts"}) 
    301         public List<Concept> getConceptsInSet(Concept c); 
    302  
     606         * @param Concept concept The concept representing the concept set 
     607         * @return A List<ConceptSet> object containing all matching ConceptSets 
     608         * @throws APIException 
     609         */ 
     610        @Transactional(readOnly=true) 
     611        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     612        public List<ConceptSet> getConceptSetsByConcept(Concept concept) throws APIException; 
     613         
     614        /** 
     615         * @deprecated use {@link #getConceptsByConceptSet(Concept)} 
     616         */ 
     617        @Transactional(readOnly=true) 
     618        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     619        public List<Concept> getConceptsInSet(Concept concept) throws APIException; 
     620         
     621        /** 
     622         * Return a List of all concepts within a concept set 
     623         * @param Concept concept The concept representing the concept set 
     624         * @return A List<Concept> object containing all objects within the ConceptSet 
     625         * @throws APIException 
     626         */ 
     627        @Transactional(readOnly=true) 
     628        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     629        public List<Concept> getConceptsByConceptSet(Concept concept) throws APIException; 
     630         
    303631        /** 
    304632         * Find all sets that the given concept is a member of  
    305          * @param concept 
    306          */ 
    307         @Transactional(readOnly=true) 
    308         @Authorized({"View Concepts"}) 
    309         public List<ConceptSet> getSetsContainingConcept(Concept concept); 
    310  
    311         /** 
    312          * @return Returns all concepts in a given class  
    313          */ 
    314         @Transactional(readOnly=true) 
    315         @Authorized({"View Concepts"}) 
    316         public List<Concept> getConceptsByClass(ConceptClass cc); 
    317          
    318         /** 
    319          * Return a concept numeric object given the concept id 
    320          *  
    321          * @return ConceptNumeric 
    322          */ 
    323         @Transactional(readOnly=true) 
    324         @Authorized({"View Concepts"}) 
    325         public ConceptNumeric getConceptNumeric(Integer conceptId); 
    326  
    327         /** 
    328          * Searches on given phrase via the concept word table 
     633         * @param Concept concept 
     634         * @throws APIException 
     635         * @return A List<ConceptSet> object with all parent concept sets 
     636         */ 
     637        @Transactional(readOnly=true) 
     638        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     639        public List<ConceptSet> getSetsContainingConcept(Concept concept) throws APIException; 
     640         
     641        /** 
     642         * @deprecated use {@link #getAllConceptProposals(boolean)} 
     643         */ 
     644        @Transactional(readOnly=true) 
     645        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_PROPOSALS) 
     646        public List<ConceptProposal> getConceptProposals(boolean includeCompleted) throws APIException; 
     647         
     648        /** 
     649         * Get a List of all concept proposals 
     650         *  
     651         * @param boolean includeCompleted  
     652         * @return a List<ConceptProposal> object of all found ConceptProposals 
     653         * @throws APIException 
     654         */ 
     655        @Transactional(readOnly=true) 
     656        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_PROPOSALS) 
     657        public List<ConceptProposal> getAllConceptProposals(boolean includeCompleted) throws APIException; 
     658         
     659        /** 
     660         * Get a ConceptProposal by conceptProposalId 
     661         *  
     662         * @param Integer conceptProposalId the concept proposal Id  
     663         * @return the found ConceptProposal 
     664         * @throws APIException 
     665         */ 
     666        @Transactional(readOnly=true) 
     667        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_PROPOSALS) 
     668        public ConceptProposal getConceptProposal(Integer conceptProposalId) throws APIException; 
     669         
     670        /** 
     671         * find matching concept proposals 
     672         *  
     673         * @param String text 
     674         * @return a List<ConceptProposal> object containing all concept proposals 
     675         * @throws APIException 
     676         */ 
     677        @Transactional(readOnly=true) 
     678        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_PROPOSALS) 
     679        public List<ConceptProposal> getConceptProposals(String text) throws APIException; 
     680         
     681        /** 
     682         * @deprecated Use #getConceptProposals(String) and then retrieve the Concepts out of the ConceptProposals... 
     683         */ 
     684        @Transactional(readOnly=true) 
     685        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_PROPOSALS) 
     686        public List<Concept> findProposedConcepts(String text) throws APIException; 
     687         
     688        /** 
     689         * find matching concept proposals and return a list of the proposed concepts 
     690         *  
     691         * @param text 
     692         * @return 
     693         * @throws APIException 
     694         */ 
     695        @Transactional(readOnly=true) 
     696        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_PROPOSALS) 
     697        public List<Concept> getProposedConcepts(String text) throws APIException; 
     698         
     699 
     700        /** 
     701         * Searches on given phrase via the concept word table within a sorted list of Locales 
    329702         *  
    330703         * @param phrase/search/words 
    331704         *            String 
    332          * @param locale 
    333          *            Locale 
    334          * @param includeRetired 
    335          *            boolean 
    336          * @return 
    337          */ 
    338         @Transactional(readOnly=true) 
    339         @Authorized({"View Concepts"}) 
    340         public List<ConceptWord> findConcepts(String phrase, Locale locale, 
    341                         boolean includeRetired); 
    342  
    343         /** 
    344          * Searches on given phrase via the concept word table 
    345          *  
    346          * @param phrase/search/words 
    347          *            String 
    348          * @param locale 
    349          *            Locale 
     705         * @param searchLocales 
     706         *            ordered List of Locales within which to search 
    350707         * @param includeRetired 
    351708         *            boolean 
     
    364721        @Transactional(readOnly=true) 
    365722        @Authorized({"View Concepts"}) 
    366         public List<ConceptWord> findConcepts(String phrase, Locale locale, boolean includeRetired,  
     723        public List<ConceptWord> findConcepts(String phrase, L