Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
05/24/08 14:37:02 (8 months ago)
Author:
bwolfe
Message:

Merging api-refactoring to trunk [3595]:[4355]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs/trunk/src/api/org/openmrs/api/db/ProgramWorkflowDAO.java

    r4158 r4358  
    2323import org.openmrs.Patient; 
    2424import org.openmrs.PatientProgram; 
    25 import org.openmrs.PatientState; 
    2625import org.openmrs.Program; 
    2726import org.openmrs.ProgramWorkflow; 
    28 import org.openmrs.ProgramWorkflowState; 
    2927 
    3028/** 
    31  * Program- and Workflow-related database functions 
    32  *   
     29 * Program- and PatientProgram- and ConceptStateConversion-related database functions 
    3330 * @version 1.0 
    3431 */ 
    3532public interface ProgramWorkflowDAO { 
    3633 
    37         public void createOrUpdateProgram(Program program) throws DAOException; 
     34        // ************************** 
     35        // PROGRAM 
     36        // ************************** 
     37         
     38        /** 
     39         * Saves a Program to the database 
     40         * @param program - The {@link Program} to save 
     41         * @return The saved {@link Program} 
     42         * @throws DAOException 
     43         */ 
     44        public Program saveProgram(Program program) throws DAOException; 
    3845 
    39         public List<Program> getPrograms() throws DAOException; 
     46        /** 
     47         * Retrieves a {@link Program} from the database by primary key programId 
     48         * @param programId - The primary key programId to use to retrieve a {@link Program} 
     49         * @return Program - The {@link Program} matching the passed programId 
     50         * @throws DAOException 
     51         */ 
     52        public Program getProgram(Integer programId) throws DAOException; 
     53 
     54    /** 
     55     * Returns all programs 
     56     * @param includeRetired whether or not to include retired programs 
     57     * @return List<Program> all existing programs, including retired based on the input parameter 
     58     * @throws DAOException 
     59     */ 
     60        public List<Program> getAllPrograms(boolean includeRetired) throws DAOException; 
     61 
     62    /** 
     63     * Returns programs that match the given string. 
     64     * A null list will never be returned.  An empty list will be returned if there are no programs 
     65     * matching this <code>nameFragment</code> 
     66     * 
     67     * @param nameFragment is the string used to search for programs 
     68     * @return List<Program> - list of Programs whose name matches the input parameter 
     69     * @throws DAOException 
     70     */ 
     71        public List<Program> findPrograms(String nameFragment) throws DAOException; 
     72 
     73    /** 
     74     * Completely remove a program from the database (not reversible) 
     75     * This method delegates to #purgeProgram(program, boolean) method 
     76     * 
     77     * @param program the Program to clean out of the database. 
     78     * @throws DAOException 
     79     */ 
     80        public void deleteProgram(Program program) throws DAOException; 
     81 
     82        // ************************** 
     83        // PATIENT PROGRAM 
     84        // ************************** 
    4085         
    41         public Program getProgram(Integer id) throws DAOException; 
     86    /** 
     87     * Save patientProgram to database (create if new or update if changed) 
     88     * @param patientProgram is the PatientProgram to be saved to the database 
     89     * @return PatientProgram - the saved PatientProgram 
     90     * @throws DAOException 
     91     */ 
     92        public PatientProgram savePatientProgram(PatientProgram patientProgram) throws DAOException; 
    4293 
    43         public void createPatientProgram(PatientProgram p); 
    44  
    45         public void updatePatientProgram(PatientProgram p); 
    46  
     94    /** 
     95     * Returns a PatientProgram given that PatientPrograms primary key <code>patientProgramId</code> 
     96     * A null value is returned if no PatientProgram exists with this patientProgramId. 
     97     * 
     98     * @param patientProgramId integer primary key of the PatientProgram to find 
     99     * @returns PatientProgram object that has patientProgram.patientProgramId = <code>patientProgramId</code> passed in. 
     100     * @throws DAOException 
     101     */ 
    47102        public PatientProgram getPatientProgram(Integer id); 
    48  
    49         public PatientState getPatientState(Integer id); 
    50  
    51         public Collection<PatientProgram> getPatientPrograms(Patient patient); 
    52103         
    53104        public List<PatientProgram> getPatientPrograms(Cohort cohort, Collection<Program> programs); 
     105         
     106    /** 
     107     * Returns PatientPrograms that match the input parameters.  If an input parameter is set to null, the parameter will not be used. 
     108     * Calling this method will all null parameters will return all PatientPrograms in the database 
     109     * A null list will never be returned.  An empty list will be returned if there are no programs matching the input criteria 
     110     * 
     111     * @param patient - if supplied all PatientPrograms returned will be for this Patient 
     112     * @param program - if supplied all PatientPrograms returned will be for this Program 
     113     * @param minEnrollmentDate - if supplied will limit PatientPrograms to those with enrollments on or after this Date 
     114     * @param maxEnrollmentDate - if supplied will limit PatientPrograms to those with enrollments on or before this Date 
     115     * @param minCompletionDate - if supplied will limit PatientPrograms to those completed on or after this Date OR not yet completed 
     116     * @param maxCompletionDate - if supplied will limit PatientPrograms to those completed on or before this Date 
     117     * @param includeVoided - boolean, if true will return voided PatientPrograms as well.  If false, will not return voided PatientPrograms 
     118     * @return List<PatientProgram> of PatientPrograms that match the passed input parameters 
     119     * @throws DAOException 
     120     */ 
     121        public List<PatientProgram> getPatientPrograms(Patient patient, Program program, Date minEnrollmentDate, Date maxEnrollmentDate, Date minCompletionDate, Date maxCompletionDate, boolean includeVoided) throws DAOException; 
     122         
     123    /** 
     124     * Completely remove a patientProgram from the database (not reversible) 
     125     * This method delegates to #purgePatientProgram(patientProgram, boolean) method 
     126     * 
     127     * @param patientProgram the PatientProgram to clean out of the database. 
     128     * @throws DAOException 
     129     */ 
     130        public void deletePatientProgram(PatientProgram patientProgram) throws DAOException; 
    54131 
    55         public ProgramWorkflow findWorkflowByProgramAndConcept(Integer programId, Integer conceptId); 
     132        // ************************** 
     133        // CONCEPT STATE CONVERSION 
     134        // ************************** 
    56135         
    57         public ProgramWorkflow getWorkflow(Integer id); 
     136    /** 
     137     * Save ConceptStateConversion to database (create if new or update if changed) 
     138     * @param conceptStateConversion - The ConceptStateConversion to save 
     139     * @return ConceptStateConversion - The saved ConceptStateConversion 
     140     * @throws DAOException 
     141     */ 
     142        public ConceptStateConversion saveConceptStateConversion(ConceptStateConversion csc) throws DAOException; 
     143 
     144    /** 
     145     * Returns all conceptStateConversions 
     146     * @return List<ConceptStateConversion> of all ConceptStateConversions that exist 
     147     * @throws DAOException 
     148     */ 
     149        public List<ConceptStateConversion> getAllConceptStateConversions() throws DAOException; 
    58150         
    59         public void createWorkflow(ProgramWorkflow w); 
    60          
    61         public void updateWorkflow(ProgramWorkflow w); 
     151    /** 
     152     * Returns a conceptStateConversion given that conceptStateConversions primary key <code>conceptStateConversionId</code> 
     153     * A null value is returned if no conceptStateConversion exists with this conceptStateConversionId. 
     154     * @param conceptStateConversionId integer primary key of the conceptStateConversion to find 
     155     * @returns ConceptStateConversion object that has conceptStateConversion.conceptStateConversionId = <code>conceptStateConversionId</code> passed in. 
     156     * @throws DAOException 
     157     */ 
     158        public ConceptStateConversion getConceptStateConversion(Integer id); 
    62159 
    63         public List<ProgramWorkflowState> getStates(boolean includeVoided); 
    64          
    65         public ProgramWorkflowState getState(Integer id); 
    66  
    67         public Collection<Integer> patientsInProgram(Program program, Date fromDate, Date toDate); 
    68          
    69         public void createConceptStateConversion(ConceptStateConversion csc); 
    70  
    71         public void updateConceptStateConversion(ConceptStateConversion csc); 
    72  
     160    /** 
     161     * Completely remove a conceptStateConversion from the database (not reversible) 
     162     * @param conceptStateConversion the ConceptStateConversion to clean out of the database. 
     163     * @param cascade <code>true</code> to delete related content 
     164     * @throws DAOException 
     165     */ 
    73166        public void deleteConceptStateConversion(ConceptStateConversion csc); 
    74167 
    75         public ConceptStateConversion getConceptStateConversion(Integer id); 
    76  
    77         public List<ConceptStateConversion> getAllConversions(); 
    78  
     168    /** 
     169     * Retrieves the ConceptStateConversion that matches the passed <code>ProgramWorkflow</code> and <code>Concept</code> 
     170     * @param workflow - the ProgramWorkflow to check 
     171     * @param trigger - the Concept to check 
     172     * @return ConceptStateConversion that matches the passed <code>ProgramWorkflow</code> and <code>Concept</code> 
     173     * @throws DAOException 
     174     */ 
    79175        public ConceptStateConversion getConceptStateConversion(ProgramWorkflow workflow, Concept trigger); 
    80176}