Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
05/16/08 13:28:28 (4 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/db/ConceptDAO.java

    r4231 r4240  
    2626import org.openmrs.ConceptWord; 
    2727import org.openmrs.Drug; 
     28import org.openmrs.api.ConceptService; 
    2829 
    2930/** 
    3031 * Concept-related database functions 
    31  * @version 1.0 
     32 *  
     33 * @see ConceptService 
    3234 */ 
    3335public interface ConceptDAO { 
    3436 
    3537        /** 
    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) 
    7459         */ 
    7560        public Concept getConcept(Integer conceptId) throws DAOException; 
    7661         
    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        /** 
    9168         * Returns a list of concepts based on the search criteria 
    9269         *  
    9370         * @param name 
    9471         * @param loc 
    95          * @param includeRetired 
    9672         * @param searchOnPhrase  This puts wildcard characters around the concept name search criteria 
    9773         * @return List<Concept> 
    9874         * @throws DAOException 
    9975         */ 
    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,  
    11882                                                        List<ConceptClass> requireClasses, List<ConceptClass> excludeClasses, 
    11983                                                        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) 
    13988         */ 
    14089        public ConceptAnswer getConceptAnswer(Integer conceptAnswerId) throws DAOException; 
    14190 
    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) 
    14893         */ 
    14994        public Drug getDrug(Integer drugId) throws DAOException; 
    15095         
    15196        /** 
    152          *  
    15397         * DAO for retrieving a list of drugs based on the following criteria 
    15498         *  
    15599         * @param drugName 
    156100         * @param concept 
    157          * @param includeVoided 
     101         * @param includeRetired 
    158102         * @return List<Drug> 
    159103         * @throws DAOException 
    160104         */ 
    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) 
    180114         */ 
    181115        public ConceptClass getConceptClass(Integer i) throws DAOException; 
    182116         
    183117        /** 
    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) 
    190119         */ 
    191120        public List<ConceptClass> getConceptClasses(String name) throws DAOException; 
    192121         
    193122        /** 
    194          *  
    195          * Creates or updates a ConceptClass 
    196         *  
    197         * @param cc 
    198         * @return ConceptClass 
    199          * @throws DAOException 
     123     * @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) 
    200129         */ 
    201130        public ConceptClass saveConceptClass(ConceptClass cc) throws DAOException; 
    202131         
    203132        /** 
    204          *  
    205          * Purges a conceptClass 
    206          *  
    207          * @param cc 
    208          * @throws DAOException 
     133         * @see org.openmrs.api.ConceptService#purgeConceptClass(org.openmrs.ConceptClass) 
    209134         */ 
    210135        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) 
    223149         */ 
    224150        public ConceptDatatype getConceptDatatype(Integer i) throws DAOException; 
    225151         
    226152        /** 
    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) 
    233154         */ 
    234155        public ConceptDatatype saveConceptDatatype(ConceptDatatype cd) throws DAOException; 
    235156         
    236157        /** 
    237          *  
    238          * DAO for purging a ConceptDatatype 
    239          *  
    240          * @param cd 
    241          * @throws DAOException 
     158         * @see org.openmrs.api.ConceptService#purgeConceptDatatype(org.openmrs.ConceptDatatype) 
    242159         */ 
    243160        public void purgeConceptDatatype(ConceptDatatype cd) throws DAOException; 
    244161         
    245162        /** 
    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) 
    249164         */ 
    250165        public void updateConceptSetDerived(Concept concept) throws DAOException; 
    251166         
    252167        /** 
    253          * Iterates over all concepts calling updateConceptSetDerived(concept) 
    254          * @throws DAOException 
     168         * @see org.openmrs.api.ConceptService#updateConceptSetDerived() 
    255169         */ 
    256170        public void updateConceptSetDerived() throws DAOException; 
    257171         
    258172        /** 
    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; 
    264176         
    265177        /** 
    266178         * @see org.openmrs.api.ConceptService#getSetsContainingConcept(org.openmrs.Concept) 
    267          * @throws DAOException 
    268179         */ 
    269180        public List<ConceptSet> getSetsContainingConcept(Concept concept) throws DAOException; 
    270181         
    271182        /** 
    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) 
    275184         */ 
    276185        public ConceptNumeric getConceptNumeric(Integer conceptId) throws DAOException; 
    277186 
    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) 
    298189         */ 
    299190        public List<Concept> getConceptsByAnswer(Concept concept)throws DAOException; 
    300191         
    301192        /** 
    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) 
    307194         */ 
    308195        public Concept getPrevConcept(Concept c) throws DAOException;  
    309196 
    310197        /** 
    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) 
    316199         */ 
    317200        public Concept getNextConcept(Concept c) throws DAOException;  
    318201 
    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) 
    337209         */ 
    338210        public ConceptProposal getConceptProposal(Integer i) throws DAOException; 
    339211         
    340212        /** 
    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) 
    347214         */ 
    348215        public List<ConceptProposal> getConceptProposals(String text) throws DAOException; 
    349216         
    350217        /** 
    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) 
    357219         */ 
    358220        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() 
    382234         */ 
    383235        public Integer getNextAvailableId() throws DAOException; 
    384236 
    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) 
    400244         */ 
    401245        public void updateConceptWord(Concept concept) throws DAOException; 
    402246         
    403  
    404          
    405247}