Downloads Documentation Community Contribute Demo






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

api-refactoring: Re-refactoring some of the api services

Files:

Legend:

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

    r4231 r4240  
    3434 * Contains methods pertaining to creating/updating/deleting/retiring  
    3535 * Concepts, Drugs, Concept Proposals, and all other things 'Concept' 
     36 *  
     37 * Use: 
     38 * <code> 
     39 *   List<Concept> concepts = Context.getConceptService().getAllConcepts(); 
     40 * </code> 
     41 *  
     42 * @see org.openmrs.api.context.Context 
    3643 */ 
    3744@Transactional 
     
    4754 
    4855        /** 
    49          * Create a new Concept 
    50          * @param Concept concept The concept to be created 
    51          * @throws APIException 
    5256         * @deprecated use #saveConcept(Concept) 
    5357         */ 
     
    5660 
    5761        /** 
    58          * Create a new Numeric Concept 
    59          * @param ConceptNumeric concept The numeric concept to be created 
    60          * @throws APIException 
    61          * @deprecated use #saveConceptNumeric(ConceptNumeric) 
     62         * @deprecated use #saveConcept(Concept) 
    6263         */ 
    6364        @Authorized({OpenmrsConstants.PRIV_ADD_CONCEPTS}) 
     
    6566 
    6667        /** 
    67          * Update the given concept 
    68          * @param Concept concept The concept to be updated 
    69          * @throws APIException 
    7068         * @deprecated use #saveConcept(Concept) 
    7169         */ 
     
    7472 
    7573        /** 
    76          * Update the given numeric concept 
    77          * @param ConceptNumeric concept The numeric concept to be updated 
    78          * @throws APIException 
    79          * @deprecated use #saveConceptNumeric(ConceptNumeric) 
     74         * @deprecated use #saveConcept(Concept) 
    8075         */ 
    8176        @Authorized({OpenmrsConstants.PRIV_EDIT_CONCEPTS}) 
     
    8378         
    8479        /** 
    85          * Create the given drug 
    86          * @param Drug drug The drug to be created 
    87          * @throws APIException 
    8880         * @deprecated use #saveDrug(Drug) 
    8981         */ 
     
    9284 
    9385        /** 
    94          * Update the given drug 
    95          * @param Drug drug The drug to be updated 
    96          * @throws APIException 
    9786         * @deprecated use #saveDrug(Drug) 
    9887         */ 
     
    10190         
    10291        /** 
    103          * Delete the given concept 
    104          *  
    105          * For super users only. If dereferencing concepts, use 
    106          * <code>retireConcept(Concept, String)</code> 
    107          * @param Concept concept The concept to be deleted 
    10892         * @deprecated use #purgeConcept(Concept concept) 
    109          * @throws APIException 
    11093         */ 
    11194        @Authorized({OpenmrsConstants.PRIV_DELETE_CONCEPTS}) 
     
    11396         
    11497        /** 
    115          * Voiding a concept essentially removes it from circulation 
    116          *  
    117          * @param Concept concept 
    118          * @param String reason 
    119          * @throws APIException 
    120          * @deprecated use #retireConcept            
     98         * @deprecated use {@link #retireConcept(Concept, String)}            
    12199         */ 
    122100        @Authorized({"Edit Concepts"}) 
     
    147125         * This should not typically be used unless desperately needed.  Most should just be retired. 
    148126         * See {@link #retireConcept(Concept, String)} 
    149          * This should be used instead of deleteConcept(Concept) 
    150127         *  
    151128         * @param Object conceptOrConceptNumeric The <code>Concept</code> or <code>ConceptNumeric</code> to remove from the system 
     
    155132        public void purgeConcept(Concept conceptOrConceptNumeric) throws APIException; 
    156133         
    157  
    158134        /** 
    159135         * Retiring a concept essentially removes it from circulation 
     
    167143        public Concept retireConcept(Concept conceptOrConceptNumeric, String reason) throws APIException; 
    168144         
    169          
    170145        /** 
    171146         * Retiring a Drug essentially removes it from circulation 
     
    177152         */ 
    178153        @Authorized(OpenmrsConstants.PRIV_MANAGE_CONCEPTS) 
    179         public Drug voidDrug(Drug drug, String reason) throws APIException; 
     154        public Drug retireDrug(Drug drug, String reason) throws APIException; 
    180155         
    181156        /** 
     
    244219         
    245220        /** 
     221         * Return a list of unretired concepts sorted by concept id ascending and  
     222         *  
     223         * @return a List<Concept> object containing all of the sorted concepts 
     224         * @throws APIException 
     225         */ 
     226        @Transactional(readOnly=true) 
     227        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     228        public List<Concept> getAllConcepts() throws APIException; 
     229         
     230        /** 
    246231         * Return a list of concepts sorted on sortBy in dir direction (asc/desc) 
    247          * This is the method that should be used to generically return all concepts 
    248232         * 
    249233         * @param String sortBy The property name to sort by; if null or invalid, concept_id is used. 
     
    255239        @Transactional(readOnly=true) 
    256240        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    257         public List<Concept> getConcepts(String sortBy, boolean asc, boolean includeRetired) throws APIException; 
    258          
    259          
    260         /** 
    261          *  
    262          * Returns a list of concepts by concept class and retired or not retired. 
    263          *  
    264          * @param cc A concept class 
    265          * @param includeRetired 
    266          * @return a List object containing all of the matching concepts 
    267          * @throws APIException 
    268          */ 
    269         @Transactional(readOnly=true) 
    270         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    271         public List<Concept> getConcepts(ConceptClass cc, boolean includeRetired) throws APIException; 
    272          
    273         /** 
    274          *  
    275          * Gets a list of concepts with an optional search on phrase argument that allows for finding by phrase 
    276          *  
    277          * @param name 
    278          * @param loc 
    279          * @param includeRetired 
    280          * @param searchOnPhrase 
    281          * @return a List of Concepts matching the search criteria. 
    282          * @throws APIException 
    283          */ 
    284         public List<Concept> getConcepts(String name, Locale loc, boolean includeRetired, boolean searchOnPhrase) throws APIException; 
    285          
    286         /** 
    287          * Return a list of unvoided concepts sorted on sortBy in dir direction (asc/desc) 
    288          *  
    289          * @param String sortBy The concept property value to sort on 
    290          * @param String dir The sort direction (asc/desc) 
    291          * @return a List<Concept> object containing all of the sorted concepts 
    292          * @deprecated use getConcepts(String, boolean, boolean) 
    293          * @throws APIException 
     241        public List<Concept> getAllConcepts(String sortBy, boolean asc, boolean includeRetired) throws APIException; 
     242                 
     243        /** 
     244         * @deprecated use {@link #getAllConcepts(String, boolean, boolean)} 
    294245         */ 
    295246        @Transactional(readOnly=true) 
    296247        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    297248        public List<Concept> getConcepts(String sortBy, String dir) throws APIException; 
    298  
    299249 
    300250        /** 
     
    302252         * @param String name The search string 
    303253         * @throws APIException 
    304          * @deprecated use getConcepts(String, Locale, boolean, boolean) 
    305254         * @return a List<Concept> object containing all of the matching concepts 
    306255         */ 
     
    313262         * @param String name The search string 
    314263         * @throws APIException 
    315          * @deprecated Use getConcept(String, Locale, boolean). 
    316264         * @return the found Concept 
    317265         */ 
     
    321269 
    322270        /** 
    323          *  
    324271         * Get Concepts by id or name 
    325272         * Note: this just calls other impl methods; no DAO of its own 
     
    327274         * @param String idOrName 
    328275         * @return the found Concept 
    329          * @deprecated use getConcept(...) 
     276         * @deprecated use {@link #getConceptByName(String)} 
    330277         * @throws APIException 
    331278         */ 
     
    335282         
    336283        /** 
    337          *  
    338284         * Get Concept by id or name convenience method 
    339285         *  
     
    345291        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    346292        public Concept getConcept(String conceptIdOrName) throws APIException; 
    347          
    348         /**  
    349          * Returns a concept by either name or id, locale, and retired status 
    350          *  
    351          * @param String idOrName 
    352          * @param Locale locale 
    353          * @param boolean includeRetired  If <code>true</code> the search will include retired Concepts 
    354          * @return the matching Concept 
    355          * @throws APIException 
    356          */ 
    357         @Transactional(readOnly=true) 
    358         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    359         public Concept getConcept(String name, Locale locale, boolean includeRetired) throws APIException; 
    360293         
    361294        /** 
     
    369302         * @param List<ConceptDatatype> requireDatatypes 
    370303         * @param List<ConceptDatatype> excludeDatatypes 
     304         * @param answersToConcept all results will be a possible answer to this concept 
    371305         * @param int start 
    372306         * @param int size 
     
    376310        @Transactional(readOnly=true) 
    377311        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    378         public List<ConceptWord> getConcepts(String phrase, List<Locale> locales, boolean includeRetired,  
     312        public List<ConceptWord> getConceptWords(String phrase, List<Locale> locales, boolean includeRetired,  
    379313                        List<ConceptClass> requireClasses, List<ConceptClass> excludeClasses, 
    380314                        List<ConceptDatatype> requireDatatypes,List<ConceptDatatype> excludeDatatypes, 
    381                         Integer start, Integer size) throws APIException; 
    382          
    383         /** 
    384          * @deprecated Use {@link #getConcepts(String, List, boolean, List, List, List, List, Integer, Integer) 
     315                        Concept answersToConcept, Integer start, Integer size) throws APIException; 
     316         
     317        /** 
     318         * Convenience method for {@link #getConceptWords(String, List, boolean, List, List, List, List, Integer, Integer)} 
     319         *  
     320         * @param phrase search string 
     321         * @param locale 
     322         * @return 
     323         * @throws APIException 
     324         */ 
     325        @Transactional(readOnly=true) 
     326        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     327        public List<ConceptWord> getConceptWords(String phrase, Locale locale) throws APIException; 
     328         
     329        /** 
     330         * @deprecated Use {@link #getConceptWords(String, List, boolean, List, List, List, List, Integer, Integer) 
    385331         */ 
    386332        @Transactional(readOnly=true) 
     
    390336         
    391337        /** 
    392          * @deprecated Use {@link #getConcepts(String, List, boolean, List, List, List, List, Integer, Integer)} 
     338         * @deprecated Use {@link #getConceptWords(String, List, boolean, List, List, List, List, Integer, Integer)} 
    393339         */ 
    394340        @Transactional(readOnly=true) 
     
    399345 
    400346        /** 
    401          *  
    402          * Finds concepts but only returns the given range 
    403          *  
    404          * @param phrase 
    405          * @param locale 
    406          * @param includeRetired 
    407          * @param start 
    408          * @param size 
    409          * @return ConceptWord list 
    410          * @throws APIException 
    411          * @deprecated Use getConcepts(...) 
     347         * @deprecated Use {@link #getConceptWords(String, List, boolean, List, List, List, List, Integer, Integer) 
    412348         */ 
    413349        @Transactional(readOnly=true) 
     
    416352                        boolean includeRetired, int start, int size) throws APIException; 
    417353         
    418          
    419         /** 
    420          * Return the drug object corresponding to the given name 
    421          * @param String drugName 
    422          * @throws APIException 
    423          * @deprecated use getDrug(String, Locale, boolean) 
     354        /** 
     355         * Return the drug object corresponding to the given name or drugId 
     356         *  
     357         * @param drugNameOrId name or drugId to match exactly on 
    424358         * @return Drug 
    425          */ 
    426          
    427         @Transactional(readOnly=true) 
    428         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    429         public Drug getDrug(String drugName) throws APIException; 
     359         * @throws APIException 
     360        */ 
     361        @Transactional(readOnly=true) 
     362        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     363        public Drug getDrug(String drugNameOrId) throws APIException; 
    430364         
    431365        /** 
     
    433367         * @param String drugId 
    434368         * @throws APIException 
    435          * @deprecated use #getDrug(...) 
    436369         * @return Drug 
    437370         */ 
     
    439372        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    440373        public Drug getDrugByNameOrId(String drugId) throws APIException; 
    441  
    442         /** 
    443          * Find a drug by drugName or id 
    444          *  
    445          * @param drugNameOrId  
    446          * @param locale 
    447          * @param includeVoided  If <code>true</code> then the search will include retired Drugs 
    448          * @return The matching Drug object 
    449          * @throws APIException 
    450          */ 
    451         @Transactional(readOnly=true) 
    452         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    453         public Drug getDrug(String drugNameOrId, boolean includeVoided) throws APIException; 
    454          
    455         /** 
    456          * Return a list of drugs currently in the database 
     374         
     375        /** 
     376         * @deprecated use {@link ConceptService#getAllDrugs()} 
     377         */ 
     378        @Transactional(readOnly=true) 
     379        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     380        public List<Drug> getDrugs() throws APIException; 
     381         
     382        /** 
     383         * Return a list of drugs currently in the database that are 
     384         * not retired 
     385         *  
    457386         * @throws APIException 
    458387         * @return a List<Drug> object containing all drugs 
    459          * @deprecated use getDrugs(boolean) 
    460          */ 
    461         @Transactional(readOnly=true) 
    462         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    463         public List<Drug> getDrugs() throws APIException; 
     388         */ 
     389        @Transactional(readOnly=true) 
     390        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     391        public List<Drug> getAllDrugs() throws APIException; 
     392         
     393        /** 
     394         * @deprecated Use {@link #getDrugsByConcept(Concept)} 
     395         */ 
     396        @Transactional(readOnly=true) 
     397        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     398        public List<Drug> getDrugs(Concept concept) throws APIException; 
    464399         
    465400        /** 
     
    468403         * @param Concept concept 
    469404         * @return a List<Drug> object containing all matching drugs 
    470          * @deprecated Use getDrugs(...) instead 
    471          */ 
    472         @Transactional(readOnly=true) 
    473         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    474         public List<Drug> getDrugs(Concept concept) throws APIException; 
    475          
    476         /** 
    477          * Get drugs by concept 
    478          *  
    479          * @param Concept concept 
    480          * @param includeRetired If <code>true</code> then the search will include retired Drugs 
    481          * @return A List<Drug> object containing all matching Drugs 
    482          * @throws APIException 
    483          */ 
    484         @Transactional(readOnly=true) 
    485         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    486         public List<Drug> getDrugs(Concept concept, boolean includeVoided); 
     405         */ 
     406        @Transactional(readOnly=true) 
     407        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     408        public List<Drug> getDrugsByConcept(Concept concept) throws APIException; 
    487409         
    488410        /** 
     
    490412         * This method is the utility method that should be used to generically retrieve all Drugs in the system. 
    491413         *  
    492          * @param includeVoided If <code>true</code> then the search will include voided Drugs 
     414         * @param includeRetired If <code>true</code> then the search will include voided Drugs 
    493415         * @return A List<Drug> object containing all matching Drugs 
    494416         */ 
    495417        @Transactional(readOnly=true) 
    496418        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    497         public List<Drug> getDrugs(boolean includeVoided); 
     419        public List<Drug> getAllDrugs(boolean includeRetired); 
     420         
     421        /** 
     422         * @deprecated Use {@link #getDrugs(String)} 
     423         */ 
     424        @Transactional(readOnly=true) 
     425        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     426        public List<Drug> findDrugs(String phrase, boolean includeVoided) throws APIException; 
    498427         
    499428        /** 
     
    502431         *  
    503432         * @param String phrase  
    504          * @param boolean includeRetired if <code>true</code> then retired drugs will be included in the search 
     433         * @param Locale locale 
    505434         * @throws APIException 
    506435         * @return A List<Drug> object containing all Drug matches 
    507          * @deprecated Use findDrugs(String, Locale, boolean) 
    508          */ 
    509         @Transactional(readOnly=true) 
    510         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    511         public List<Drug> findDrugs(String phrase, boolean includeVoided) throws APIException; 
    512          
    513         /** 
    514          * Find drugs in the system. The string search can match either drug.name or 
    515          * drug.concept.name 
    516          *  
    517          * @param String phrase  
    518          * @param boolean includeVoided if <code>true</code> then voided drugs will be included in the search 
    519          * @param Locale locale 
    520          * @throws APIException 
    521          * @return A List<Drug> object containing all Drug matches 
    522          */ 
    523         @Transactional(readOnly=true) 
    524         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    525         public List<Drug> getDrugs(String phrase, boolean includeVoided) throws APIException; 
     436         */ 
     437        @Transactional(readOnly=true) 
     438        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     439        public List<Drug> getDrugs(String phrase) throws APIException; 
    526440         
    527441        /** 
     
    529443         * @return Returns all concepts in a given class 
    530444         * @throws APIException  
    531          * @deprecated use findConcepts(...) 
    532445         */ 
    533446        @Transactional(readOnly=true) 
     
    539452         * @throws APIException 
    540453         * @return List<ConceptClass> object with all ConceptClass objects 
    541          * @deprecated use getAllConceptClasses(boolean) 
    542          */ 
    543         @Transactional(readOnly=true) 
    544         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     454         * @deprecated use #getAllConceptClasses(boolean) 
     455         */ 
     456        @Transactional(readOnly=true) 
     457        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_CLASSES) 
    545458        public List<ConceptClass> getConceptClasses() throws APIException; 
    546459         
     
    550463         * @param String name 
    551464         * @return ConceptClass 
    552          * @deprecated Use getConceptClass(String) 
    553          * @throws APIException 
    554          */ 
    555         @Transactional(readOnly=true) 
    556         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     465         * @throws APIException 
     466         */ 
     467        @Transactional(readOnly=true) 
     468        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_CLASSES) 
    557469        public ConceptClass getConceptClassByName(String name) throws APIException; 
    558470         
    559471        /** 
    560          * Return a Concept class matching the given name 
    561          *  
    562          * @param String name 
    563          * @return the matching ConceptClass 
    564          * @throws APIException 
    565          */ 
    566         @Transactional(readOnly=true) 
    567         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    568         public ConceptClass getConceptClass(String name) throws APIException; 
    569          
    570         /** 
    571472         * Return a list of concept classes currently in the database 
     473         *  
     474         * @throws APIException 
     475         * @return List<ConceptClass> object with all ConceptClass objects 
     476         */ 
     477        @Transactional(readOnly=true) 
     478        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_CLASSES) 
     479        public List<ConceptClass> getAllConceptClasses() throws APIException; 
     480         
     481        /** 
     482         * Return a list of concept classes currently in the database 
     483         *  
    572484         * @param include retired concept classes in the search results 
    573485         * @throws APIException 
     
    575487         */ 
    576488        @Transactional(readOnly=true) 
    577         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    578         public List<ConceptClass> getAllConceptClasses() throws APIException; 
     489        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_CLASSES) 
     490        public List<ConceptClass> getAllConceptClasses(boolean includeRetired) throws APIException; 
    579491 
    580492        /** 
     
    582494         * @param ConceptClass to create or update 
    583495         * @throws APIException 
    584          *  
    585          */ 
    586         @Authorized(OpenmrsConstants.PRIV_MANAGE_CONCEPTS) 
     496         */ 
     497        @Authorized(OpenmrsConstants.PRIV_MANAGE_CONCEPT_CLASSES) 
    587498        public ConceptClass saveConceptClass(ConceptClass cc) throws APIException; 
    588499 
    589          
    590500        /** 
    591501         * Purge a ConceptClass 
     
    593503         * @throws APIException 
    594504         */ 
    595         @Authorized(OpenmrsConstants.PRIV_PURGE_CONCEPTS) 
     505        @Authorized(OpenmrsConstants.PRIV_PURGE_CONCEPT_CLASSES) 
    596506        public void purgeConceptClass(ConceptClass cc) throws APIException;      
    597          
    598507         
    599508        /** 
     
    604513        @Authorized({OpenmrsConstants.PRIV_MANAGE_CONCEPTS}) 
    605514        public ConceptDatatype saveConceptDatatype(ConceptDatatype cd) throws APIException; 
    606  
    607515         
    608516        /** 
     
    611519         * @throws APIException 
    612520         */ 
    613         @Authorized({OpenmrsConstants.PRIV_PURGE_CONCEPTS}
     521        @Authorized(OpenmrsConstants.PRIV_PURGE_CONCEPT_DATATYPES
    614522        public void purgeConceptDatatype(ConceptDatatype cd) throws APIException; 
    615523         
    616524        /** 
    617525         * Return a list of concept datatypes currently in the database 
     526         *  
    618527         * @throws APIException 
    619528         * @return List of ConceptDatatypes 
    620529         */ 
    621530        @Transactional(readOnly=true) 
    622         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    623         public List<ConceptDatatype> getConceptDatatypes() throws APIException; 
    624  
     531        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_DATATYPES) 
     532        public List<ConceptDatatype> getAllConceptDatatypes() throws APIException; 
     533         
     534        /** 
     535         * Return a list of concept datatypes currently in the database 
     536         *  
     537         * @param includeRetired true/false whether to include the retired datatypes 
     538         * @throws APIException 
     539         * @return List of ConceptDatatypes 
     540         */ 
     541        @Transactional(readOnly=true) 
     542        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_DATATYPES) 
     543        public List<ConceptDatatype> getAllConceptDatatypes(boolean includeRetired) throws APIException; 
     544         
     545        /** 
     546         * Find concept datatypes that contain the given name string 
     547         *  
     548         * @param name 
     549         * @return 
     550         * @throws APIException 
     551         */ 
     552        @Transactional(readOnly=true) 
     553        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_DATATYPES) 
     554        public List<ConceptDatatype> getConceptDatatypes(String name) throws APIException; 
     555         
    625556        /** 
    626557         * Return a ConceptDatatype matching the given identifier 
     
    630561         */ 
    631562        @Transactional(readOnly=true) 
    632         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     563        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_DATATYPES) 
    633564        public ConceptDatatype getConceptDatatype(Integer i) throws APIException; 
    634565         
     
    638569         * @param String name 
    639570         * @return ConceptDatatype 
    640          * @deprecated Use getConceptDataType(String) 
    641          * @throws APIException 
    642          */ 
    643         @Transactional(readOnly=true) 
    644         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     571         * @throws APIException 
     572         */ 
     573        @Transactional(readOnly=true) 
     574        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_DATATYPES) 
    645575        public ConceptDatatype getConceptDatatypeByName(String name) throws APIException; 
    646          
    647         /** 
    648          * Return a Concept datatype matching the given name 
    649          *  
    650          * @param String name 
    651          * @return The matching ConceptDatatype object 
    652          * @throws APIException 
    653          */ 
    654         @Transactional(readOnly=true) 
    655         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    656         public ConceptDatatype getConceptDatatype(String name) throws APIException; 
    657          
    658576         
    659577        /** 
     
    671589        @Authorized({OpenmrsConstants.PRIV_MANAGE_CONCEPTS}) 
    672590        public void updateConceptSetDerived() throws APIException; 
     591         
     592        /** 
     593         * @deprecated use {@link #getConceptSetsByConcept(Concept)} 
     594         */ 
     595        @Transactional(readOnly=true) 
     596        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     597        public List<ConceptSet> getConceptSets(Concept concept) throws APIException; 
    673598         
    674599        /** 
     
    677602         *    getConceptSets(getConcept("ANTIRETROVIRAL MEDICATIONS")) 
    678603         * and then take the conceptIds from the resulting list. 
     604         *  
    679605         * @param Concept concept The concept representing the concept set 
    680606         * @return A List<ConceptSet> object containing all matching ConceptSets 
     
    683609        @Transactional(readOnly=true) 
    684610        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    685         public List<ConceptSet> getConceptSets(Concept concept) throws APIException; 
     611        public List<ConceptSet> getConceptSetsByConcept(Concept concept) throws APIException; 
     612         
     613        /** 
     614         * @deprecated use {@link #getConceptsByConceptSet(Concept)} 
     615         */ 
     616        @Transactional(readOnly=true) 
     617        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     618        public List<Concept> getConceptsInSet(Concept concept) throws APIException; 
    686619         
    687620        /** 
     
    691624         * @throws APIException 
    692625         */ 
    693          
    694         @Transactional(readOnly=true) 
    695         @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    696         public List<Concept> getConceptsInSet(Concept concept) throws APIException; 
     626        @Transactional(readOnly=true) 
     627        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     628        public List<Concept> getConceptsByConceptSet(Concept concept) throws APIException; 
    697629         
    698630        /** 
     
    706638        public List<ConceptSet> getSetsContainingConcept(Concept concept) throws APIException; 
    707639         
     640        /** 
     641         * @deprecated use {@link #getAllConceptProposals(boolean)} 
     642         */ 
     643        @Transactional(readOnly=true) 
     644        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_PROPOSALS) 
     645        public List<ConceptProposal> getConceptProposals(boolean includeCompleted) throws APIException; 
    708646         
    709647        /** 
     
    715653         */ 
    716654        @Transactional(readOnly=true) 
    717         @Authorized(OpenmrsConstants.PRIV_ADD_CONCEPT_PROPOSAL
    718         public List<ConceptProposal> getConceptProposals(boolean includeCompleted) throws APIException; 
    719  
     655        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_PROPOSALS
     656        public List<ConceptProposal> getAllConceptProposals(boolean includeCompleted) throws APIException; 
     657         
    720658        /** 
    721659         * Get a ConceptProposal by conceptProposalId 
     
    726664         */ 
    727665        @Transactional(readOnly=true) 
    728         @Authorized(OpenmrsConstants.PRIV_ADD_CONCEPT_PROPOSAL
     666        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_PROPOSALS
    729667        public ConceptProposal getConceptProposal(Integer conceptProposalId) throws APIException; 
    730668         
    731669        /** 
    732          *  
    733670         * find matching concept proposals 
    734671         *  
     
    738675         */ 
    739676        @Transactional(readOnly=true) 
    740         @Authorized(OpenmrsConstants.PRIV_ADD_CONCEPT_PROPOSAL
     677        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_PROPOSALS
    741678        public List<ConceptProposal> getConceptProposals(String text) throws APIException; 
    742679         
    743680        /** 
    744          *  
    745          * find matching concept proposals and return a list of the proposed concepts 
    746          *  
    747          * @param text 
    748          * @return a List<Concept> object containing all proposed concepts 
    749          * @throws APIException 
    750          * @deprecated Use getConceptProposals(String) and then retrieve the Concepts out of the ConceptProposals... 
    751          */ 
    752         @Transactional(readOnly=true) 
    753         @Authorized(OpenmrsConstants.PRIV_ADD_CONCEPT_PROPOSAL) 
     681         * @deprecated Use #getConceptProposals(String) and then retrieve the Concepts out of the ConceptProposals... 
     682         */ 
     683        @Transactional(readOnly=true) 
     684        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    754685        public List<Concept> findProposedConcepts(String text) throws APIException; 
    755686         
    756          
    757          
    758         /** 
    759          *  
     687        /** 
    760688         * find matching concept proposals and return a list of the proposed concepts 
    761689         *  
     
    765693         */ 
    766694        @Transactional(readOnly=true) 
    767         @Authorized(OpenmrsConstants.PRIV_ADD_CONCEPT_PROPOSAL
     695        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPT_PROPOSALS
    768696        public List<Concept> getProposedConcepts(String text) throws APIException; 
    769697         
    770          
    771         /** 
    772          *  
    773          * Convenience method for proposing a Concept 
    774          *  
    775          * @param ConceptProposal conceptProposal  the proposed concept 
    776          * @throws APIException 
    777          * @deprecated 
    778          * 
    779          */ 
    780         @Authorized(OpenmrsConstants.PRIV_ADD_CONCEPT_PROPOSAL) 
     698        /** 
     699         * @deprecated use {@link #saveConceptProposal(ConceptProposal)} 
     700         */ 
     701        @Authorized(OpenmrsConstants.PRIV_ADD_CONCEPT_PROPOSALS) 
    781702        public void proposeConcept(ConceptProposal conceptProposal) throws APIException; 
    782703         
     
    788709         * @return the saved/update ConceptProposal object 
    789710         */ 
    790         @Authorized(OpenmrsConstants.PRIV_ADD_CONCEPT_PROPOSAL
     711        @Authorized({OpenmrsConstants.PRIV_ADD_CONCEPT_PROPOSALS, OpenmrsConstants.PRIV_EDIT_CONCEPT_PROPOSALS}
    791712        public ConceptProposal saveConceptProposal(ConceptProposal conceptProposal) throws APIException; 
    792713         
    793714        /** 
    794          *  
    795715         * Removes a concept proposal from the database entirely. 
    796716         *  
     
    798718         * @throws APIException 
    799719         */ 
    800         @Authorized(OpenmrsConstants.PRIV_MANAGE_CONCEPT_PROPOSAL
     720        @Authorized(OpenmrsConstants.PRIV_PURGE_CONCEPT_PROPOSALS
    801721        public void purgeConceptProposal(ConceptProposal cp) throws APIException; 
    802         /** 
    803         *  
     722         
     723        /** 
    804724         * Maps a concept proposal to a concept 
    805725         *  
    806726         * @param cp 
    807727         * @param mappedConcept 
    808          * @throws APIException 
    809          */ 
    810         @Authorized(OpenmrsConstants.PRIV_ADD_CONCEPT_PROPOSAL) 
    811         public void mapConceptProposalToConcept(ConceptProposal cp, 
     728         * @return the mappedConcept 
     729         * @throws APIException 
     730         */ 
     731        @Authorized(OpenmrsConstants.PRIV_MANAGE_CONCEPTS) 
     732        public Concept mapConceptProposalToConcept(ConceptProposal cp, 
    812733                        Concept mappedConcept) throws APIException; 
    813734         
    814735        /** 
    815          *  
    816          * Rejects a concept proposal 
    817          *  
    818          * @param cp 
    819          * @throws APIException 
    820          */ 
    821         @Authorized(OpenmrsConstants.PRIV_MANAGE_CONCEPT_PROPOSAL) 
     736         * @deprecated use {@link ConceptProposal#rejectConceptProposal()} 
     737         */ 
     738        @Authorized(OpenmrsConstants.PRIV_EDIT_CONCEPT_PROPOSALS) 
    822739        public void rejectConceptProposal(ConceptProposal cp) throws APIException; 
    823740         
    824741         
    825742        /** 
    826          *  
    827          * Find concept proposals by original text 
    828          *  
    829          * @param text 
    830          * @return 
    831          * @deprecated use getConceptProposals(String) 
    832          */ 
    833         @Authorized(OpenmrsConstants.PRIV_ADD_CONCEPT_PROPOSAL) 
     743         * @deprecated use {@link ConceptService#getConceptProposals(String)} 
     744         */ 
     745        @Authorized(OpenmrsConstants.PRIV_ADD_CONCEPT_PROPOSALS) 
    834746        public List<ConceptProposal> findMatchingConceptProposals(String text); 
     747         
     748        /** 
     749         * @deprecated use {@link #getConceptAnswers(String, Locale, Concept)} 
     750         */ 
     751        @Transactional(readOnly=true) 
     752        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
     753        public List<ConceptWord> findConceptAnswers(String phrase, Locale locale, 
     754                        Concept concept, boolean includeRetired) throws APIException; 
    835755         
    836756        /** 
     
    839759         * @param String phrase 
    840760         * @param Locale locale 
    841          * @param Concept concept 
    842          * @param boolean includeRetired 
     761         * @param Concept concept the answers to match on 
    843762         * @return List<ConceptWord> object 
    844763         * @throws APIException 
     
    846765        @Transactional(readOnly=true) 
    847766        @Authorized(OpenmrsConstants.PRIV_VIEW_CONCEPTS) 
    848         public List<ConceptWord> findConceptAnswers(String phrase, Locale locale, 
    849                         Concept concept, boolean includeRetired) throws APIException; 
    850          
    851         /** 
    852          * Get the questions that have this concept as a possible answer 
    853          *  
    854          * @param concept concept 
    855          * @return List<Concept> object of all possible Concepts 
    856          * @throws APIException 
    857          * @deprecated use getConceptsByAnswer(Concepts) 
     767        public List<ConceptWord> getConceptAnswers(String phrase, Locale locale, 
     768                        Concept concept) throws APIException; 
     769         
     770        /** 
     771         * @deprecated use #getConceptsByAnswer(Concept) 
    858772         */ 
    859773        @Transactional(readOnly=true) 
     
    874788 
    875789        /** 
    876          * Finds the previous concept 
     790         * Finds the previous concept in the dictionary that has the next 
     791         * lowest concept id 
    877792         *  
    878793         * @param Concept concept the offset Concept 
     
    885800 
    886801        /** 
    887          * Finds the next concept 
     802         * Finds the next concept in the dictionary that has the next 
     803         * largest concept id 
     804         *  
    888805         * @param Concept concept the offset Concept 
    889806         * @return the foundConcept 
     
    894811        public Concept getNextConcept(Concept concept) throws APIException; 
    895812         
    896          
    897         /** 
    898          *  
    899          * Get the next available conceptId