=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeGroupService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeGroupService.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeGroupService.java 2013-11-04 03:13:27 +0000 @@ -39,17 +39,61 @@ { String ID = PatientAttributeGroupService.class.getName(); + /** + * Adds an {@link PatientAttributeGroup} + * + * @param patientAttributeGroup The to PatientAttributeGroup add. + * + * @return A generated unique id of the added {@link PatientAttributeGroup}. + */ int savePatientAttributeGroup( PatientAttributeGroup patientAttributeGroup ); + /** + * Deletes a {@link PatientAttributeGroup}. + * + * @param patientAttributeGroup the PatientAttributeGroup to delete. + */ void deletePatientAttributeGroup( PatientAttributeGroup patientAttributeGroup ); + /** + * Updates a {@link PatientAttributeGroup}. + * + * @param patientAttributeGroup the PatientAttributeGroup to update. + */ void updatePatientAttributeGroup( PatientAttributeGroup patientAttributeGroup ); + /** + * Returns a {@link PatientAttributeGroup}. + * + * @param id the id of the PatientAttributeGroup to return. + * + * @return the PatientAttributeGroup with the given id + */ PatientAttributeGroup getPatientAttributeGroup( int id ); + /** + * Returns a {@link PatientAttributeGroup} with a given name. + * + * @param name the name of the PatientAttributeGroup to return. + * + * @return the PatientAttributeGroup with the given name, or null if no match. + */ PatientAttributeGroup getPatientAttributeGroupByName( String name ); + /** + * Returns all {@link PatientAttributeGroup} + * + * @return a collection of all PatientAttributeGroup, or an empty collection if there are + * no PatientAttributeGroups. + */ Collection getAllPatientAttributeGroups(); - + + /** + * Get {@link PatientAttribute} by a {@link PatientAttributeGroup} + * + * @param patientAttributeGroup {@link PatientAttributeGroup} + * + * @return PatientAttribute list + */ List getPatientAttributes( PatientAttributeGroup patientAttributeGroup ); } === removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeGroupStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeGroupStore.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeGroupStore.java 1970-01-01 00:00:00 +0000 @@ -1,47 +0,0 @@ -package org.hisp.dhis.patient; - -/* - * Copyright (c) 2004-2013, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * Neither the name of the HISP project nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -import java.util.Collection; - -import org.hisp.dhis.common.GenericNameableObjectStore; -import org.hisp.dhis.program.Program; - -/** - * @author Chau Thu Tran - * - * @version $PatientAttributeGroupStore.java Mar 26, 2012 1:43:53 PM$ - */ -public interface PatientAttributeGroupStore - extends GenericNameableObjectStore -{ - Collection get( Program program ); - - Collection getWithoutProgram(); -} === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeOptionService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeOptionService.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeOptionService.java 2013-11-04 03:13:27 +0000 @@ -37,16 +37,56 @@ */ public interface PatientAttributeOptionService { + /** + * Adds an {@link PatientAttributeOption} + * + * @param option The to PatientAttributeOption add. + * + * @return A generated unique id of the added {@link PatientAttributeOption}. + */ void addPatientAttributeOption( PatientAttributeOption option ); + /** + * Updates a {@link PatientAttributeOption}. + * + * @param option the PatientAttributeOption to update. + */ void updatePatientAttributeOption( PatientAttributeOption option ); + /** + * Deletes a {@link PatientAttributeOption}. + * + * @param option the PatientAttributeOption to delete. + */ void deletePatientAttributeOption( PatientAttributeOption option ); + /** + * Returns a {@link PatientAttributeOption} with a given name. + * + * @param patientAttribute {@link PatientAttribute} + * @param name the name of the PatientAttributeOption to return. + * + * @return the PatientAttributeOption with the given name, or null if no + * match. + */ PatientAttributeOption get( PatientAttribute patientAttribute, String name ); - + + /** + * Returns a {@link PatientAttributeOption}. + * + * @param id the id of the PatientAttributeOption to return. + * + * @return the PatientAttributeOption with the given id + */ PatientAttributeOption get( int id ); - + + /** + * Get all {@link PatientAttributeOption} of a {@link PatientAttribute} + * + * @param patientAttribute {@link PatientAttribute} + * + * @return {@link PatientAttributeOption} + */ Collection get( PatientAttribute patientAttribute ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeOptionStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeOptionStore.java 2013-09-17 18:07:42 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeOptionStore.java 2013-11-04 03:13:27 +0000 @@ -35,12 +35,28 @@ /** * @author Viet */ -public interface PatientAttributeOptionStore +public interface PatientAttributeOptionStore extends GenericStore { - String ID = PatientAttributeOption.class.getName(); - + String ID = PatientAttributeOption.class.getName(); + + /** + * Returns a {@link PatientAttributeOption} with a given name. + * + * @param patientAttribute {@link PatientAttribute} + * @param name the name of the PatientAttributeOption to return. + * + * @return the PatientAttributeOption with the given name, or null if no + * match. + */ PatientAttributeOption get( PatientAttribute patientAttribute, String name ); - + + /** + * Get all {@link PatientAttributeOption} of a {@link PatientAttribute} + * + * @param patientAttribute {@link PatientAttribute} + * + * @return {@link PatientAttributeOption} + */ Collection get( PatientAttribute patientAttribute ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeService.java 2013-10-28 07:12:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeService.java 2013-11-04 03:13:27 +0000 @@ -38,18 +38,61 @@ { String ID = PatientAttributeService.class.getName(); + /** + * Adds an {@link PatientAttribute} + * + * @param patientAttribute The to PatientAttribute add. + * + * @return A generated unique id of the added {@link PatientAttribute}. + */ int savePatientAttribute( PatientAttribute patientAttribute ); + /** + * Deletes a {@link PatientAttribute}. + * + * @param patientAttribute the PatientAttribute to delete. + */ void deletePatientAttribute( PatientAttribute patientAttribute ); + /** + * Updates an {@link PatientAttribute}. + * + * @param patientAttribute the PatientAttribute to update. + */ void updatePatientAttribute( PatientAttribute patientAttribute ); + /** + * Returns a {@link PatientAttribute}. + * + * @param id the id of the PatientAttribute to return. + * + * @return the PatientAttribute with the given id + */ PatientAttribute getPatientAttribute( int id ); + /** + * Returns the {@link PatientAttribute} with the given UID. + * + * @param uid the UID. + * @return the PatientAttribute with the given UID, or null if no match. + */ PatientAttribute getPatientAttribute( String uid ); + /** + * Returns a {@link PatientAttribute} with a given name. + * + * @param name the name of the PatientAttribute to return. + * + * @return the PatientAttribute with the given name, or null if no match. + */ PatientAttribute getPatientAttributeByName( String name ); + /** + * Returns all {@link PatientAttribute} + * + * @return a collection of all PatientAttribute, or an empty collection if + * there are no PatientAttributes. + */ Collection getAllPatientAttributes(); /** @@ -85,7 +128,7 @@ /** * Get patient attributes without groups * - * @return List of patient attributes + * @return List of patient attributes without group */ Collection getPatientAttributesWithoutGroup(); === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java 2013-10-28 07:12:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java 2013-11-04 03:13:27 +0000 @@ -60,15 +60,24 @@ * Get patient attributes by mandatory option * * @param mandatory True/False value + * + * @return List of patient attributes */ Collection getByMandatory( boolean mandatory ); + /** + * Get {@link PatientAttribute} without any group + * + * @return PatientAttribute without group. + */ Collection getWithoutGroup(); /** * Get patient attributes by groupBy option * * @param groupBy True/False value + * + * @return List of patient attributes */ PatientAttribute getByGroupBy( boolean groupBy ); === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAuditService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAuditService.java 2013-10-28 07:12:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAuditService.java 2013-11-04 03:13:27 +0000 @@ -40,12 +40,37 @@ { String ID = PatientAuditService.class.getName(); + /** + * Adds an {@link PatientAudit} + * + * @param patientAudit The to PatientAudit add. + * + * @return A generated unique id of the added {@link PatientAudit}. + */ int savePatientAudit( PatientAudit patientAudit ); + /** + * Deletes a {@link PatientAudit}. + * + * @param patientAudit the PatientAudit to delete. + */ void deletePatientAudit( PatientAudit patientAudit ); + /** + * Returns a {@link PatientAudit}. + * + * @param id the id of the PatientAudit to return. + * + * @return the PatientAudit with the given id + */ PatientAudit getPatientAudit( int id ); + /** + * Returns all {@link PatientAudit} + * + * @return a collection of all PatientAudit, or an empty collection if + * there are no PatientAttributeGroups. + */ Collection getAllPatientAudit(); /** @@ -61,7 +86,8 @@ * Get patient audit of a patient * * @param patientId The id of patient - * @param visitor The user who accessed to see a certain information of the patient + * @param visitor The user who accessed to see a certain information of the + * patient * @param date The data this user visited * @param accessedModule The module this user accessed * === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierService.java 2013-10-29 05:04:36 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierService.java 2013-11-04 03:13:27 +0000 @@ -38,14 +38,44 @@ { String ID = PatientIdentifierService.class.getName(); + /** + * Adds an {@link PatientIdentifier} + * + * @param patientIdentifier The to PatientIdentifier add. + * + * @return A generated unique id of the added {@link PatientIdentifier}. + */ int savePatientIdentifier( PatientIdentifier patientIdentifier ); + /** + * Deletes a {@link PatientIdentifier}. + * + * @param patientIdentifier the PatientIdentifier to delete. + */ void deletePatientIdentifier( PatientIdentifier patientIdentifier ); + /** + * Deletes a {@link PatientIdentifier}. + * + * @param patientIdentifier the PatientIdentifier to delete. + */ void updatePatientIdentifier( PatientIdentifier patientIdentifier ); + /** + * Returns a {@link PatientIdentifier}. + * + * @param id the id of the PatientIdentifier to return. + * + * @return the PatientIdentifier with the given id + */ PatientIdentifier getPatientIdentifier( int id ); + /** + * Returns all {@link PatientIdentifier} + * + * @return a collection of all PatientIdentifier, or an empty collection if + * there are no PatientAttributeGroups. + */ Collection getAllPatientIdentifiers(); /** === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java 2013-10-29 05:04:36 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java 2013-11-04 03:13:27 +0000 @@ -38,18 +38,61 @@ { String ID = PatientIdentifierTypeService.class.getName(); + /** + * Adds an {@link PatientIdentifierType} + * + * @param patientIdentifierType The to PatientIdentifierType add. + * + * @return A generated unique id of the added {@link PatientIdentifierType}. + */ int savePatientIdentifierType( PatientIdentifierType patientIdentifierType ); + /** + * Deletes a {@link PatientIdentifierType}. + * + * @param patientIdentifierType the PatientIdentifierType to delete. + */ void deletePatientIdentifierType( PatientIdentifierType patientIdentifierType ); + /** + * Deletes a {@link PatientIdentifierType}. + * + * @param patientIdentifierType the PatientIdentifierType to delete. + */ void updatePatientIdentifierType( PatientIdentifierType patientIdentifierType ); + /** + * Returns a {@link PatientIdentifierType}. + * + * @param id the id of the PatientIdentifierType to return. + * + * @return the PatientIdentifierType with the given id + */ PatientIdentifierType getPatientIdentifierType( int id ); + /** + * Returns all {@link PatientIdentifierType} + * + * @return a collection of all PatientIdentifierType, or an empty collection if + * there are no PatientAttributeGroups. + */ Collection getAllPatientIdentifierTypes(); + /** + * Returns a {@link PatientIdentifierType} with a given name. + * + * @param name the name of the PatientIdentifierType to return. + * + * @return the PatientIdentifierType with the given name, or null if no match. + */ PatientIdentifierType getPatientIdentifierType( String name ); + /** + * Returns the {@link PatientIdentifierType} with the given UID. + * + * @param uid the UID. + * @return the PatientIdentifierType with the given UID, or null if no match. + */ PatientIdentifierType getPatientIdentifierTypeByUid( String uid ); /** === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientRegistrationFormService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientRegistrationFormService.java 2013-10-29 05:04:36 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientRegistrationFormService.java 2013-11-04 03:13:27 +0000 @@ -60,23 +60,53 @@ final Pattern TITLE_TAG_PATTERN = Pattern.compile( "title=\"(.*?)\"", Pattern.DOTALL ); final Pattern SUGGESTED_VALUE_PATTERN = Pattern.compile( "suggested=('|\")(\\w*)('|\")" ); - + final Pattern CLASS_PATTERN = Pattern.compile( "class=('|\")(\\w*)('|\")" ); - + final Pattern STYLE_PATTERN = Pattern.compile( "style=('|\")([\\w|\\d\\:\\;]+)('|\")" ); // -------------------------------------------------------------------------- // ProgramDataEntryService // -------------------------------------------------------------------------- + /** + * Adds an {@link PatientRegistrationForm} + * + * @param registrationForm The to PatientRegistrationForm add. + * + * @return A generated unique id of the added {@link PatientRegistrationForm}. + */ int savePatientRegistrationForm( PatientRegistrationForm registrationForm ); + /** + * Deletes a {@link PatientRegistrationForm}. + * + * @param registrationForm the PatientRegistrationForm to delete. + */ void deletePatientRegistrationForm( PatientRegistrationForm registrationForm ); + /** + * Updates an {@link PatientRegistrationForm}. + * + * @param patientAttribute the PatientRegistrationForm to update. + */ void updatePatientRegistrationForm( PatientRegistrationForm registrationForm ); + /** + * Returns a {@link PatientRegistrationForm}. + * + * @param id the id of the PatientRegistrationForm to return. + * + * @return the PatientRegistrationForm with the given id + */ PatientRegistrationForm getPatientRegistrationForm( int id ); + /** + * Returns all {@link PatientRegistrationForm} + * + * @return a collection of all PatientRegistrationForm, or an empty collection if + * there are no PatientRegistrationForms. + */ Collection getAllPatientRegistrationForms(); /** @@ -91,15 +121,15 @@ /** * Get custom registration form which doesn't belong to any program * - * @return PatientRegistrationForm + * @return PatientRegistrationForm */ PatientRegistrationForm getCommonPatientRegistrationForm(); /** - * Prepares the custom registration by injecting required javascripts - * and drop down lists. + * Prepares the custom registration by injecting required javascripts and + * drop down lists. * - * @param htmlCode the HTML code of the data entry form. + * @param htmlCode the HTML code of the data entry form. * @param program Program which include a custom entry form * @param healthWorkers DHIS users list * @param patient Patient @@ -109,7 +139,7 @@ * * @return HTML code for the form. */ - String prepareDataEntryFormForAdd( String htmlCode, Program program, Collection healthWorkers, Patient patient, - ProgramInstance programInstance, I18n i18n, I18nFormat format ); + String prepareDataEntryFormForAdd( String htmlCode, Program program, Collection healthWorkers, + Patient patient, ProgramInstance programInstance, I18n i18n, I18nFormat format ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java 2013-10-28 07:12:28 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java 2013-11-04 03:13:27 +0000 @@ -54,16 +54,52 @@ public static final int ERROR_ENROLLMENT = 2; + /** + * Adds an {@link Patient} + * + * @param patient The to Patient add. + * + * @return A generated unique id of the added {@link Patient}. + */ int savePatient( Patient patient ); + /** + * Deletes a {@link Patient}. + * + * @param patient the Patient to delete. + */ void deletePatient( Patient patient ); + /** + * Updates a {@link Patient}. + * + * @param patient the Patient to update. + */ void updatePatient( Patient patient ); + /** + * Returns a {@link Patient}. + * + * @param id the id of the PatientAttribute to return. + * + * @return the PatientAttribute with the given id + */ Patient getPatient( int id ); + /** + * Returns the {@link PatientAttribute} with the given UID. + * + * @param uid the UID. + * @return the PatientAttribute with the given UID, or null if no match. + */ Patient getPatient( String uid ); + /** + * Returns all {@link Patient} + * + * @return a collection of all Patient, or an empty collection if there are + * no Patients. + */ Collection getAllPatients(); /** @@ -134,7 +170,8 @@ Collection getPatients( Program program ); /** - * Retrieve patients registered in a orgunit and enrolled into a program with active status + * Retrieve patients registered in a orgunit and enrolled into a program + * with active status * * @param organisationUnit * @param program @@ -443,7 +480,7 @@ /** * Validate patient identifiers and validation criteria by program before - * registering / updating information + * registering or updating information * * @param patient Patient object * @param program Progam which person needs to enroll. If this paramameter === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueService.java 2013-10-29 11:02:46 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueService.java 2013-11-04 03:13:27 +0000 @@ -43,24 +43,90 @@ { String ID = PatientAttributeValueService.class.getName(); + /** + * Adds an {@link PatientAttribute} + * + * @param patientAttribute The to PatientAttribute add. + * + * @return A generated unique id of the added {@link PatientAttribute}. + */ void savePatientAttributeValue( PatientAttributeValue patientAttributeValue ); + /** + * Updates an {@link PatientAttribute}. + * + * @param patientAttribute the PatientAttribute to update. + */ void updatePatientAttributeValue( PatientAttributeValue patientAttributeValue ); + /** + * Deletes a {@link PatientAttribute}. + * + * @param patientAttribute the PatientAttribute to delete. + */ void deletePatientAttributeValue( PatientAttributeValue patientAttributeValue ); + /** + * Deletes all {@link PatientAttributeValue} of a patient + * + * @param patient {@link Patient} + * + * @return The error code. If the code is 0, deleting success + */ int deletePatientAttributeValue( Patient patient ); + /** + * Delete all {@link PatientAttributeValue} of a {@link PatientAttribute} + * + * @param patientAttribute {@link PatientAttribute} + * + * @return The error code. If the code is 0, deleting success + */ int deletePatientAttributeValue( PatientAttribute patientAttribute ); + /** + * Retrieve a {@link PatientAttributeValue} on a {@link Patient} and + * {@link PatientAttribute} + * + * @param patientAttribute {@link PatientAttribute} + * + * @return PatientAttributeValue + */ PatientAttributeValue getPatientAttributeValue( Patient patient, PatientAttribute patientAttribute ); + /** + * Retrieve {@link PatientAttributeValue} of a {@link Patient} + * + * @param patient Patient + * + * @return PatientAttributeValue list + */ Collection getPatientAttributeValues( Patient patient ); + /** + * Retrieve {@link PatientAttributeValue} of a {@link PatientAttribute} + * + * @param patientAttribute {@link PatientAttribute} + * + * @return PatientAttributeValue list + */ Collection getPatientAttributeValues( PatientAttribute patientAttribute ); + /** + * Retrieve {@link PatientAttributeValue} of a patient list + * + * @param patients Patient list + * + * @return PatientAttributeValue list + */ Collection getPatientAttributeValues( Collection patients ); + /** + * Returns all {@link PatientAttributeValue} + * + * @return a collection of all PatientAttributeValue, or an empty collection + * if there are no PatientAttributPatientAttributeValues. + */ Collection getAllPatientAttributeValues(); /** @@ -125,6 +191,14 @@ */ void updatePatientAttributeValues( PatientAttributeOption patientAttributeOption ); + /** + * Get the number of {@link PatientAttributeOption} in all + * {@link PatientAttribute} + * + * @param attributeOption PatientAttributeOption + * + * @return The number of PatientAttributeOptions + */ int countByPatientAttributeoption( PatientAttributeOption patientAttributeOption ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueStore.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueStore.java 2013-11-04 03:13:27 +0000 @@ -34,7 +34,6 @@ import org.hisp.dhis.patient.Patient; import org.hisp.dhis.patient.PatientAttribute; import org.hisp.dhis.patient.PatientAttributeOption; -import org.hisp.dhis.program.Program; /** * @author Abyot Asalefew @@ -43,31 +42,107 @@ public interface PatientAttributeValueStore extends GenericStore { - String ID = PatientAttributeValueStore.class.getName(); - + String ID = PatientAttributeValueStore.class.getName(); + + /** + * Adds an {@link PatientAttribute} + * + * @param patientAttribute The to PatientAttribute add. + * + * @return A generated unique id of the added {@link PatientAttribute}. + */ void saveVoid( PatientAttributeValue patientAttributeValue ); + /** + * Deletes all {@link PatientAttributeValue} of a patient + * + * @param patient {@link Patient} + * + * @return The error code. If the code is 0, deleting success + */ int deleteByPatient( Patient patient ); - + + /** + * Deletes a {@link PatientAttribute}. + * + * @param patientAttribute the PatientAttribute to delete. + */ int deleteByAttribute( PatientAttribute patientAttribute ); - - PatientAttributeValue get( Patient patient, PatientAttribute patientAttribute ); - + + /** + * Retrieve a {@link PatientAttributeValue} on a {@link Patient} and + * {@link PatientAttribute} + * + * @param patientAttribute {@link PatientAttribute} + * + * @return PatientAttributeValue + */ + PatientAttributeValue get( Patient patient, PatientAttribute patientAttribute ); + + /** + * Retrieve {@link PatientAttributeValue} of a {@link Patient} + * + * @param patient Patient + * + * @return PatientAttributeValue list + */ Collection get( Patient patient ); - + + /** + * Retrieve {@link PatientAttributeValue} of a {@link Patient} + * + * @param patient Patient + * + * @return PatientAttributeValue list + */ Collection get( PatientAttribute patientAttribute ); - + + /** + * Retrieve {@link PatientAttributeValue} of a patient list + * + * @param patients Patient list + * + * @return PatientAttributeValue list + */ Collection get( Collection patients ); - - Collection searchByValue( PatientAttribute patientAttribute, String searchText ); - + + /** + * Search PatientAttribueValue objects by a PatientAttribute and a attribute + * value (performs partial search ) + * + * @param patientAttribute PatientAttribute + * @param searchText A string for searching by attribute values + * + * @return PatientAttributeValue list + */ + Collection searchByValue( PatientAttribute patientAttribute, String searchText ); + + /** + * Get the number of {@link PatientAttributeOption} in all + * {@link PatientAttribute} + * + * @param attributeOption PatientAttributeOption + * + * @return The number of PatientAttributeOptions + */ int countByPatientAttributeoption( PatientAttributeOption attributeOption ); - + + /** + * Retrieve patients who have the same value on an attribute + * + * @param attribute PatientAttribute + * @param value An attribute value for searching + * + * @return Patient list + */ Collection getPatient( PatientAttribute attribute, String value ); - - void updatePatientAttributeValues( PatientAttributeOption patientAttributeOption); - Collection get( Patient patient, Program program ); + /** + * Update patient attribute values which belong to the pre-defined attribute + * when a value pre-defined of this attribute is modified + * + * @param patientAttributeOption PatientAttributeOption + */ + void updatePatientAttributeValues( PatientAttributeOption patientAttributeOption ); - Collection getWithoutProgram( Patient patient ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientcomment/PatientCommentService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientcomment/PatientCommentService.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientcomment/PatientCommentService.java 2013-11-04 03:13:27 +0000 @@ -39,14 +39,44 @@ { String ID = PatientCommentService.class.getName(); + /** + * Adds an {@link PatientComment} + * + * @param patientComment The to PatientComment add. + * + * @return A generated unique id of the added {@link PatientComment}. + */ int addPatientComment( PatientComment patientComment ); + /** + * Deletes a {@link PatientComment}. + * + * @param patientComment the PatientComment to delete. + */ void deletePatientComment( PatientComment patientComment ); + /** + * Updates an {@link PatientComment}. + * + * @param patientComment the PatientComment to update. + */ void updatePatientComment( PatientComment patientComment ); + /** + * Returns a {@link PatientComment}. + * + * @param id the id of the PatientComment to return. + * + * @return the PatientComment with the given id + */ PatientComment getPatientComment( int id ); + /** + * Returns all {@link PatientComment} + * + * @return a collection of all PatientComment, or an empty collection if + * there are no PatientAttributes. + */ Collection getAllPatientComments(); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueService.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueService.java 2013-11-04 03:13:27 +0000 @@ -43,28 +43,112 @@ { String ID = PatientDataValueService.class.getName(); + /** + * Adds an {@link PatientDataValue} + * + * @param patientAttribute The to PatientDataValue add. + * + * @return A generated unique id of the added {@link PatientDataValue}. + */ void savePatientDataValue( PatientDataValue patientDataValue ); + /** + * Updates an {@link PatientDataValue}. + * + * @param patientDataValue the PatientDataValue to update. + */ void updatePatientDataValue( PatientDataValue patientDataValue ); + /** + * Deletes a {@link PatientDataValue}. + * + * @param patientDataValue the PatientDataValue to delete. + */ void deletePatientDataValue( PatientDataValue patientDataValue ); + /** + * Deletes all {@link PatientDataValue} of {@link ProgramStageInstance} + * + * @param programStageInstance The {@link ProgramStageInstance}. + * + * @return Error code. If this code is 0, deleting succeed. + */ int deletePatientDataValue( ProgramStageInstance programStageInstance ); + /** + * Deletes all {@link PatientDataValue} of an {@link DataElement} + * + * @param patientDataValue the PatientDataValue to delete. + */ int deletePatientDataValue( DataElement dataElement ); + /** + * Retrieve patient data values of a event + * + * @param programStageInstance ProgramStageInstance + * + * @return PatientDataValue list + */ Collection getPatientDataValues( ProgramStageInstance programStageInstance ); - - Collection getPatientDataValues( ProgramStageInstance programStageInstance, Collection dataElement ); - + + /** + * Retrieve patient data values of a event with data elements specified + * + * @param programStageInstance ProgramStageInstance + * @param dataElement DataElement List + * + * @return PatientDataValue list + */ + Collection getPatientDataValues( ProgramStageInstance programStageInstance, + Collection dataElement ); + + /** + * Retrieve patient data values of many events + * + * @param programStageInstance ProgramStageInstance + * + * @return PatientDataValue list + */ Collection getPatientDataValues( Collection programStageInstances ); + /** + * Retrieve patient data values of a data element + * + * @param dataElement DataElement + * + * @return PatientDataValue list + */ Collection getPatientDataValues( DataElement dataElement ); + /** + * Retrive patient data values of a patient on data elements specified from + * a certain period + * + * @param patient Patient + * @param dataElements DataElement List + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * + * @return PatientDataValue list + */ Collection getPatientDataValues( Patient patient, Collection dataElements, - Date startDate, Date endDate ); + Date after, Date before ); + /** + * Retrieve a patient data value on an event and a data element + * + * @param programStageInstance ProgramStageInstance + * @param dataElement DataElement + * + * @return PatientDataValue + */ PatientDataValue getPatientDataValue( ProgramStageInstance programStageInstance, DataElement dataElement ); + /** + * Returns all {@link PatientDataValue} + * + * @return a collection of all PatientDataValues, or an empty collection if + * there are no PatientDataValues. + */ Collection getAllPatientDataValues(); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueStore.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueStore.java 2013-11-04 03:13:27 +0000 @@ -45,21 +45,81 @@ { String ID = PatientDataValueStore.class.getName(); + /** + * Adds an {@link PatientDataValue} + * + * @param patientAttribute The to PatientDataValue add. + * + * @return A generated unique id of the added {@link PatientDataValue}. + */ void saveVoid( PatientDataValue patientDataValue ); int delete( ProgramStageInstance programStageInstance ); + /** + * Deletes a {@link PatientDataValue}. + * + * @param patientDataValue the PatientDataValue to delete. + */ int delete( DataElement dataElement ); - + + /** + * Retrieve patient data values of a event + * + * @param programStageInstance ProgramStageInstance + * + * @return PatientDataValue list + */ Collection get( ProgramStageInstance programStageInstance ); - + + /** + * Retrieve patient data values of a event with data elements specified + * + * @param programStageInstance ProgramStageInstance + * @param dataElement DataElement List + * + * @return PatientDataValue list + */ Collection get( ProgramStageInstance programStageInstance, Collection dataElements ); + /** + * Retrieve patient data values of many events + * + * @param programStageInstance ProgramStageInstance + * + * @return PatientDataValue list + */ Collection get( Collection programStageInstances ); + /** + * Retrieve patient data values on a data element + * + * @param dataElement {@link DataElement} + * + * @return PatientDataValue list + */ Collection get( DataElement dataElement ); - - Collection get( Patient patient, Collection dataElements, Date startDate, Date endDate ); - + + /** + * Retrieve patient data values of a {@link Patient} on a + * {@link DataElement} lisy + * + * @patient patient Patient + * @param dataElements The data element list + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * + * @return PatientDataValue list + */ + Collection get( Patient patient, Collection dataElements, Date after, + Date before ); + /** + * Retrieve a patient data value on an event and a data element + * + * @param programStageInstance ProgramStageInstance + * @param dataElement DataElement + * + * @return PatientDataValue + */ PatientDataValue get( ProgramStageInstance programStageInstance, DataElement dataElement ); } \ No newline at end of file === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReportService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReportService.java 2013-10-08 03:23:55 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReportService.java 2013-11-04 03:13:27 +0000 @@ -39,22 +39,88 @@ */ public interface PatientAggregateReportService { + /** + * Adds an {@link PatientAggregateReport} + * + * @param patientAggregateReport The to PatientAggregateReport add. + * + * @return A generated unique id of the added {@link PatientAggregateReport} + * . + */ void addPatientAggregateReport( PatientAggregateReport patientAggregateReport ); + /** + * Updates an {@link PatientAggregateReport}. + * + * @param patientAggregateReport the PatientAggregateReport to update. + */ void updatePatientAggregateReport( PatientAggregateReport patientAggregateReport ); + /** + * Returns a {@link patientAggregateReport}. + * + * @param id the id of the patientAggregateReport to return. + * + * @return the patientAggregateReport with the given id + */ PatientAggregateReport getPatientAggregateReport( int id ); - + + /** + * Returns the {@link patientAggregateReport} with the given UID. + * + * @param uid the UID. + * @return the patientAggregateReport with the given UID, or null if no + * match. + */ PatientAggregateReport getPatientAggregateReportByUid( String uid ); + /** + * Returns a {@link patientAggregateReport} with a given name. + * + * @param name the name of the patientAggregateReport to return. + * + * @return the patientAggregateReport with the given name, or null if no + * match. + */ PatientAggregateReport getPatientAggregateReport( String name ); - + + /** + * Deletes a {@link patientAggregateReport}. + * + * @param patientAggregateReport the patientAggregateReport to delete. + */ void deletePatientAggregateReport( PatientAggregateReport patientAggregateReport ); + /** + * Returns all {@link patientAggregateReport} + * + * @return a collection of all patientAggregateReport, or an empty + * collection if there are no PatientAttributes. + */ Collection getAllPatientAggregateReports(); + /** + * Retrieve aggregate report favorites by name (performs partial search) + * which a user can read with result limited + * + * @param user User + * @param query A string for searching by name + * @param min + * @param max + * + * @return PatientAggregateReport list + */ Collection getPatientAggregateReports( User user, String query, Integer min, Integer max ); - + + /** + * Get the number of aggregate report favorites which a user can read and + * have the names meet the search string + * + * @param user User + * @param query A string for searching by name + * + * @return A number + */ int countPatientAggregateReportList( User user, String query ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReportStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReportStore.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReportStore.java 2013-11-04 03:13:27 +0000 @@ -41,7 +41,27 @@ public interface PatientAggregateReportStore extends GenericIdentifiableObjectStore { + /** + * Retrieve aggregate report favorites by name (performs partial search) which a + * user can read with result limited + * + * @param user User + * @param query A string for searching by name + * @param min + * @param max + * + * @return PatientAggregateReport list + */ Collection get( User user, String query, Integer min, Integer max ); - + + /** + * Get the number of aggregate report favorites which a user can read and have the + * names meet the search string + * + * @param user User + * @param query A string for searching by name + * + * @return A number + */ int countList( User user, String query ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReportService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReportService.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReportService.java 2013-11-04 03:13:27 +0000 @@ -34,25 +34,84 @@ /** * @author Chau Thu Tran - * + * * @version $PatientTabularReportService.java May 7, 2012 1:01:39 PM$ */ public interface PatientTabularReportService { + /** + * Adds/Updates an {@link PatientTabularReport} + * + * @param patientTabularReport The to PatientTabularReport add. + * + * @return A generated unique id of the added {@link PatientTabularReport} . + */ void saveOrUpdate( PatientTabularReport patientTabularReport ); + /** + * Returns a {@link patientTabularReport}. + * + * @param id the id of the patientTabularReport to return. + * + * @return the patientTabularReport with the given id + */ PatientTabularReport getPatientTabularReport( int id ); - + + /** + * Returns a {@link patientTabularReport} with a given name. + * + * @param name the name of the patientTabularReport to return. + * + * @return the patientTabularReport with the given name, or null if no + * match. + */ PatientTabularReport getPatientTabularReport( String name ); - + + /** + * Returns the {@link patientTabularReport} with the given UID. + * + * @param uid the UID. + * @return the patientTabularReport with the given UID, or null if no match. + */ PatientTabularReport getPatientTabularReportByUid( String uid ); + /** + * Deletes a {@link patientTabularReport}. + * + * @param patientTabularReport the patientTabularReport to delete. + */ void deletePatientTabularReport( PatientTabularReport patientTabularReport ); - Collection getAllCharts(); - + /** + * Returns all {@link patientTabularReport} + * + * @return a collection of all patientTabularReport, or an empty collection + * if there are no PatientAttributes. + */ + Collection getAllTabularReports(); + + /** + * Retrieve case-based report favorites by name (performs partial search) + * which a user can read with result limited + * + * @param user User + * @param query A string for searching by name + * @param min + * @param max + * + * @return PatientAggregateReport list + */ Collection getPatientTabularReports( User user, String query, Integer min, Integer max ); - + + /** + * Get the number of case-based report favorites which a user can read and + * have the names meet the search string + * + * @param user User + * @param query A string for searching by name + * + * @return A number + */ int countPatientTabularReportList( User user, String query ); - + } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReportStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReportStore.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReportStore.java 2013-11-04 03:13:27 +0000 @@ -35,12 +35,33 @@ /** * @author Chau Thu Tran - * + * * @version $PatientTabularReportStore.java May 7, 2012 1:01:55 PM$ */ -public interface PatientTabularReportStore extends GenericIdentifiableObjectStore -{ +public interface PatientTabularReportStore + extends GenericIdentifiableObjectStore +{ + /** + * Retrieve case-based report favorites by name (performs partial search) + * which a user can read with result limited + * + * @param user User + * @param query A string for searching by name + * @param min + * @param max + * + * @return PatientAggregateReport list + */ Collection get( User user, String query, Integer min, Integer max ); - + + /** + * Get the number of case-based report favorites which a user can read and + * have the names meet the search string + * + * @param user User + * @param query A string for searching by name + * + * @return A number + */ int countList( User user, String query ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramDataEntryService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramDataEntryService.java 2013-09-06 09:06:36 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramDataEntryService.java 2013-11-04 03:13:27 +0000 @@ -50,10 +50,42 @@ // ProgramDataEntryService // -------------------------------------------------------------------------- + /** + * Prepares the data entry form for data entry by injecting required + * javascripts and drop down lists. + * + * @param htmlCode the HTML code of the data entry form. + * @param dataValues the {@link PatientDataValue} which are registered for + * this form. + * @param programStage {@link ProgramStage} + * @param programStageInstance The {@link ProgramStageInstance} associated + * with entry form + * @param organisationUnit The {@link OrganisationUnit} associated with this + * program stage instance. + * @return HTML code for the form. + */ String prepareDataEntryFormForEntry( String htmlCode, Collection dataValues, I18n i18n, ProgramStage programStage, ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit ); + /** + * Prepare DataEntryForm code for save by reversing the effects of + * prepareDataEntryFormForEdit(). + * + * @param htmlCode the HTML code of the data entry form. + * @param i18n I18n object + * @param programStage {@link ProgramStage} + * + * @return htmlCode the HTML code of the data entry form. + */ String prepareDataEntryFormForAdd( String htmlCode, I18n i18n, ProgramStage programStage ); + /** + * Prepares the data entry form code by injecting the data element operand + * name as value and title for each entry field. + * + * @param htmlCode the HTML code of the data entry form. + * + * @return HTML code for the data entry form. + */ String prepareDataEntryFormForEdit( String htmlCode ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramExpressionService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramExpressionService.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramExpressionService.java 2013-11-04 03:13:27 +0000 @@ -31,7 +31,21 @@ import java.util.Collection; import java.util.Map; +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.patientdatavalue.PatientDataValue; + /** + * An Expression is the expression of e.g. a validation rule of a program. It + * consist of a String representation of the rule as well as references to the + * data elements and program stages included in the expression. + *

+ * The expression contains references to data elements and program stages on the + * form: + *

+ * i) [DE:1.2] where 1 refers to the program stage identifier and 2 refers to + * the data element identifier. + *

+ * * @author Chau Thu Tran * * @version ProgramExpressionService.java 2:59:58 PM Nov 8, 2012 $ @@ -40,19 +54,67 @@ { String ID = ProgramExpressionService.class.getName(); + /** + * Adds an {@link ProgramExpression} + * + * @param programExpression The to ProgramExpression add. + * + * @return A generated unique id of the added {@link ProgramExpression}. + */ int addProgramExpression( ProgramExpression programExpression ); + /** + * Updates an {@link ProgramExpression}. + * + * @param programExpression the ProgramExpression to update. + */ void updateProgramExpression( ProgramExpression programExpression ); + /** + * Deletes a {@link ProgramExpression}. + * + * @param programExpression the ProgramExpression to delete. + */ void deleteProgramExpression( ProgramExpression programExpression ); + /** + * Returns a {@link ProgramExpression}. + * + * @param id the id of the ProgramExpression to return. + * + * @return the ProgramExpression with the given id + */ ProgramExpression getProgramExpression( int id ); + /** + * Returns all {@link ProgramExpression} + * + * @return a collection of all ProgramExpression, or an empty collection if + * there are no ProgramExpressions. + */ Collection getAllProgramExpressions(); + /** + * Get value of program expession + * + * @param programExpression {@link ProgramExpression} + * @param programStageInstance The {@link ProgramStageInstance} associate + * with this expression + * @param patientDataValueMap patientDataValue + * + * @return The expression value + */ String getProgramExpressionValue( ProgramExpression programExpression, ProgramStageInstance programStageInstance, Map patientDataValueMap ); + /** + * Get the description of a program expression + * + * @param programExpression The expression + * + * @return the description of an expression + */ String getExpressionDescription( String programExpression ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java 2013-11-04 03:13:27 +0000 @@ -37,28 +37,107 @@ */ public interface ProgramIndicatorService { + /** + * Adds an {@link ProgramIndicator} + * + * @param programIndicator The to ProgramIndicator add. + * + * @return A generated unique id of the added {@link ProgramIndicator}. + */ int addProgramIndicator( ProgramIndicator programIndicator ); + /** + * Updates an {@link ProgramIndicator}. + * + * @param programIndicator the ProgramIndicator to update. + */ void updateProgramIndicator( ProgramIndicator programIndicator ); + /** + * Deletes a {@link ProgramIndicator}. + * + * @param programIndicator the ProgramIndicator to delete. + */ void deleteProgramIndicator( ProgramIndicator programIndicator ); + /** + * Returns a {@link ProgramIndicator}. + * + * @param id the id of the ProgramIndicator to return. + * + * @return the ProgramIndicator with the given id + */ ProgramIndicator getProgramIndicator( int id ); + /** + * Returns a {@link ProgramIndicator} with a given name. + * + * @param name the name of the ProgramIndicator to return. + * @return the ProgramIndicator with the given name, or null if no match. + */ ProgramIndicator getProgramIndicator( String name ); + /** + * Returns a {@link ProgramIndicator} with a given short name. + * + * @param name the name of the ProgramIndicator to return. + * @return the ProgramIndicator with the given short name, or null if no + * match. + */ ProgramIndicator getProgramIndicatorByShortName( String shortName ); + /** + * Returns the {@link ProgramIndicator} with the given UID. + * + * @param uid the UID. + * @return the ProgramIndicator with the given UID, or null if no match. + */ ProgramIndicator getProgramIndicatorByUid( String uid ); + /** + * Returns all {@link ProgramIndicator}. + * + * @return a collection of all ProgramIndicator, or an empty collection if + * there are no ProgramIndicators. + */ Collection getAllProgramIndicators(); + /** + * Get {@link ProgramIndicator} of a program + * + * @param program Program + * + * @return ProgramIndicators belong to the program + */ Collection getProgramIndicators( Program program ); + /** + * Calculate an prorgam indicator value based on program instance and an + * indicator defined for a patient + * + * @param programInstance ProgramInstance + * @param programIndicator ProgramIndicator + * + * @return Indicator value + */ String getProgramIndicatorValue( ProgramInstance programInstance, ProgramIndicator programIndicator ); + /** + * Get indicator values of all program indicators defined for a patient + * + * @param programInstance ProgramInstance + * + * @return Map + */ Map getProgramIndicatorValues( ProgramInstance programInstance ); + /** + * Get description of an indicator expression + * + * @param expression A expression string + * + * @return The description + */ String getExpressionDescription( String expression ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorStore.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorStore.java 2013-11-04 03:13:27 +0000 @@ -39,5 +39,12 @@ public interface ProgramIndicatorStore extends GenericNameableObjectStore { + /** + * Get {@link ProgramIndicator} of a program + * + * @param program Program + * + * @return ProgramIndicators belong to the program + */ Collection getByProgram( Program program ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java 2013-09-18 13:09:07 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java 2013-11-04 03:13:27 +0000 @@ -48,84 +48,369 @@ { String ID = ProgramInstanceService.class.getName(); + /** + * Adds an {@link ProgramInstance} + * + * @param programInstance The to ProgramInstance add. + * + * @return A generated unique id of the added {@link ProgramInstance}. + */ int addProgramInstance( ProgramInstance programInstance ); + /** + * Deletes a {@link ProgramInstance}. + * + * @param programInstance the ProgramInstance to delete. + */ void deleteProgramInstance( ProgramInstance programInstance ); + /** + * Updates an {@link ProgramInstance}. + * + * @param programInstance the ProgramInstance to update. + */ void updateProgramInstance( ProgramInstance programInstance ); + /** + * Returns a {@link ProgramInstance}. + * + * @param id the id of the ProgramInstance to return. + * + * @return the ProgramInstance with the given id + */ ProgramInstance getProgramInstance( int id ); - ProgramInstance getProgramInstance( String id ); + /** + * Returns the {@link ProgramInstance} with the given UID. + * + * @param uid the UID. + * @return the ProgramInstance with the given UID, or null if no match. + */ + ProgramInstance getProgramInstance( String uid ); + /** + * Returns all {@link ProgramInstance}. + * + * @return a collection of all ProgramInstance, or an empty collection if + * there are no ProgramInstances. + */ Collection getAllProgramInstances(); + /** + * Retrieve program instances by status + * + * @param status Status of program-instance, include STATUS_ACTIVE, + * STATUS_COMPLETED and STATUS_CANCELLED + * + * @return ProgramInstance list + */ Collection getProgramInstances( Integer status ); + /** + * Retrieve program instances on a program + * + * @param program Program + * + * @return ProgramInstance list + */ Collection getProgramInstances( Program program ); + /** + * Retrieve program instances on program list + * + * @param programs Program list + * + * @return ProgramInstance list + */ Collection getProgramInstances( Collection programs ); + /** + * Retrieve program instances of whom registered in to a orgunit from + * program list + * + * @param programs Program list + * @param organisationUnit Organisation Unit + * + * @return ProgramInstance list + */ Collection getProgramInstances( Collection programs, OrganisationUnit organisationUnit ); - Collection getProgramInstances( Collection programs, OrganisationUnit organisationUnit, int status ); + /** + * Retrieve program instances of whom registered in to a orgunit from + * program list with a certain status + * + * @param programs Program list + * @param organisationUnit Organisation Unit + * @param status Status of program-instance, include STATUS_ACTIVE, + * STATUS_COMPLETED and STATUS_CANCELLED + * + * @return ProgramInstance list + */ + Collection getProgramInstances( Collection programs, OrganisationUnit organisationUnit, + int status ); + /** + * Retrieve program instances on a program by status + * + * @param program Program + * @param status Status of program-instance, include STATUS_ACTIVE, + * STATUS_COMPLETED and STATUS_CANCELLED + * + * @return ProgramInstance list + */ Collection getProgramInstances( Program program, Integer status ); + /** + * Retrieve program instances on a program list by status + * + * @param programs Program list + * @param status Status of program-instance, include STATUS_ACTIVE, + * STATUS_COMPLETED and STATUS_CANCELLED + * + * @return ProgramInstance list + */ Collection getProgramInstances( Collection programs, Integer status ); + /** + * Retrieve program instances on a patient + * + * @param patient Patient + * + * @return ProgramInstance list + */ Collection getProgramInstances( Patient patient ); + /** + * Retrieve program instances on a patient by a status + * + * @param patient Patient + * @param status Status of program-instance, include STATUS_ACTIVE, + * STATUS_COMPLETED and STATUS_CANCELLED + * + * @return ProgramInstance list + */ Collection getProgramInstances( Patient patient, Integer status ); + /** + * Retrieve program instances on a patient by a program + * + * @param patient Patient + * @param program Program + * + * @return ProgramInstance list + */ Collection getProgramInstances( Patient patient, Program program ); + /** + * Retrieve program instances on a patient with a status by a program + * + * @param patient Patient + * @param program Program + * @param status Status of program-instance, include STATUS_ACTIVE, + * STATUS_COMPLETED and STATUS_CANCELLED + * + * @return ProgramInstance list + */ Collection getProgramInstances( Patient patient, Program program, Integer status ); + /** + * Retrieve program instances on an orgunit by a program + * + * @param program Program + * @param organisationUnit Organisation Unit + * + * @return ProgramInstance list + */ Collection getProgramInstances( Program program, OrganisationUnit organisationUnit ); + /** + * Retrieve program instances with active status on an orgunit by a program + * with result limited + * + * @param program Program + * @param organisationUnit Organisation Unit + * @param min + * @param max + * + * @return ProgramInstance list + */ Collection getProgramInstances( Program program, OrganisationUnit organisationUnit, int min, int max ); + /** + * Retrieve program instances with active status on an orgunit by a program + * in a certain period + * + * @param program Program + * @param organisationUnit Organisation Unit + * @param startDate The start date for retrieving on enrollment-date + * @param endDate The end date for retrieving on enrollment-date + * + * @return ProgramInstance list + */ Collection getProgramInstances( Program program, OrganisationUnit organisationUnit, Date startDate, Date endDate ); + /** + * Retrieve program instances with active status on an orgunit by a program + * for a certain period with result limited + * + * @param program Program + * @param organisationUnit Organisation Unit + * @param startDate The start date for retrieving on enrollment-date + * @param endDate The end date for retrieving on enrollment-date + * + * @return ProgramInstance list + */ Collection getProgramInstances( Program program, Collection orgunitIds, Date startDate, Date endDate, int min, int max ); + /** + * Get the number of program instances which are active status and + * registered in a certain orgunit by a program for a certain period + * + * @param program Program + * @param organisationUnit Organisation Unit + * @param startDate The start date for retrieving on enrollment-date + * @param endDate The end date for retrieving on enrollment-date + * + * @return ProgramInstance list + */ int countProgramInstances( Program program, Collection orgunitIds, Date startDate, Date endDate ); + /** + * Retrieve history of a patient + * + * @param patient Patient + * @param i18n I18n object + * @param format I18nFormat object + * + * @return Grid list in which each grid is the program information details + * of the patient + */ List getProgramInstanceReport( Patient patient, I18n i18n, I18nFormat format ); + /** + * Export a program information details report + * + * @param programInstance ProgramInstance + * @param i18n I18n object + * @param format I18nFormat object + * + * @return Grid object + */ Grid getProgramInstanceReport( ProgramInstance programInstance, I18n i18n, I18nFormat format ); + /** + * Retrieve program instances with a certain status on a program and an + * orgunit ids list for a period + * + * @param Status of program-instance, include STATUS_ACTIVE, + * STATUS_COMPLETED and STATUS_CANCELLED + * @param program ProgramInstance + * @param orgunitIds A list of orgunit ids + * @param startDate The start date for retrieving on enrollment-date + * @param endDate The end date for retrieving on enrollment-date + * + * @return ProgramInstance list + */ + Collection getProgramInstancesByStatus( Integer status, Program program, + Collection orgunitIds, Date startDate, Date endDate ); + + /** + * Get the number of program instances of a program which have a certain + * status and an orgunit ids list for a period + * + * @param Status of program-instance, include STATUS_ACTIVE, + * STATUS_COMPLETED and STATUS_CANCELLED + * @param program ProgramInstance + * @param orgunitIds A list of orgunit ids + * @param startDate The start date for retrieving on enrollment-date + * @param endDate The end date for retrieving on enrollment-date + * + * @return A number + */ int countProgramInstancesByStatus( Integer status, Program program, Collection orgunitIds, Date startDate, Date endDate ); - Collection getProgramInstancesByStatus( Integer status, Program program, - Collection orgunitIds, Date startDate, Date endDate ); - + /** + * Remove a program instance + * + * @param programInstance ProgramInstance + */ void removeProgramEnrollment( ProgramInstance programInstance ); + /** + * Retrieve scheduled list of patients registered + * + * @return A SchedulingProgramObject list + */ Collection getScheduleMesssages(); + /** + * Send messages as SMS defined for a program + * + * @param programInstance ProgramInstance + * @param status The time to send message, send when a person enrolled an + * program or complete a program or send by scheduled days + * @param format I18nFormat object + * + * @return OutboundSms list + */ Collection sendMessages( ProgramInstance programInstance, int status, I18nFormat format ); - Collection sendMessageConversations( ProgramInstance programInstance, - int sendWhenToC0mpletedEvent, I18nFormat format ); + /** + * Send messages defined as DHIS messages for a program + * + * @param programInstance ProgramInstance + * @param status The time to send message, send when a person enrolled an + * program or complete a program or send by scheduled days + * @param format I18nFormat object + * + * @return MessageConversation list + */ + Collection sendMessageConversations( ProgramInstance programInstance, int status, + I18nFormat format ); + /** + * Enroll a patient into a program + * + * @param patient Patient + * @param program Program + * @param enrollmentDate The date of enrollment + * @param dateOfIncident The date of incident + * @param orgunit Organisation Unit + * @param format I18nFormat object + * + * @return ProgramInsance + */ ProgramInstance enrollPatient( Patient patient, Program program, Date enrollmentDate, Date dateOfIncident, OrganisationUnit orgunit, I18nFormat format ); + /** + * Check a program instance if it can be completed automatically. If there + * is some event of this program-isntance uncompleted or this program has + * any repeatable stage, then this program cannot be completed automatically + * + * @param programInstance ProgramInstance + * + * @return True/False value + */ boolean canAutoCompleteProgramInstanceStatus( ProgramInstance programInstance ); + /** + * Complete a program instance. Besides, program template messages will be + * send if it was defined to send when to complete this program + * + * @param programInstance ProgramInstance + * @param format I18nFormat + */ void completeProgramInstanceStatus( ProgramInstance programInstance, I18nFormat format ); /** * Set status as skipped for overdue events; Remove scheduled events - *

- * * + * + * @param programInstance ProgramInstance */ - void cancelProgramInstanceStatus( ProgramInstance programInstance ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceStore.java 2013-09-18 13:09:07 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceStore.java 2013-11-04 03:13:27 +0000 @@ -44,47 +44,239 @@ { String ID = ProgramInstanceStore.class.getName(); + /** + * Retrieve program instances by status + * + * @param status Status of program-instance, include STATUS_ACTIVE, + * STATUS_COMPLETED and STATUS_CANCELLED + * + * @return ProgramInstance list + */ Collection get( Integer status ); + /** + * Retrieve program instances on a program + * + * @param program Program + * + * @return ProgramInstance list + */ Collection get( Program program ); + /** + * Retrieve program instances on program list + * + * @param programs Program list + * + * @return ProgramInstance list + */ Collection get( Collection programs ); + /** + * Retrieve program instances of whom registered in to a orgunit from + * program list + * + * @param programs Program list + * @param organisationUnit Organisation Unit + * + * @return ProgramInstance list + */ Collection get( Collection programs, OrganisationUnit organisationUnit ); + /** + * Retrieve program instances of whom registered in to a orgunit from + * program list with a certain status + * + * @param programs Program list + * @param organisationUnit Organisation Unit + * @param status Status of program-instance, include STATUS_ACTIVE, + * STATUS_COMPLETED and STATUS_CANCELLED + * + * @return ProgramInstance list + */ Collection get( Collection programs, OrganisationUnit organisationUnit, int status ); + /** + * Retrieve program instances on a program by status + * + * @param program Program + * @param status Status of program-instance, include STATUS_ACTIVE, + * STATUS_COMPLETED and STATUS_CANCELLED + * + * @return ProgramInstance list + */ Collection get( Program program, Integer status ); + /** + * Retrieve program instances on a program list by status + * + * @param programs Program list + * @param status Status of program-instance, include STATUS_ACTIVE, + * STATUS_COMPLETED and STATUS_CANCELLED + * + * @return ProgramInstance list + */ Collection get( Collection programs, Integer status ); + /** + * Retrieve program instances on a patient + * + * @param patient Patient + * + * @return ProgramInstance list + */ Collection get( Patient patient ); + /** + * Retrieve program instances on a patient by a status + * + * @param patient Patient + * @param status Status of program-instance, include STATUS_ACTIVE, + * STATUS_COMPLETED and STATUS_CANCELLED + * + * @return ProgramInstance list + */ Collection get( Patient patient, Integer status ); + /** + * Retrieve program instances on a patient by a program + * + * @param patient Patient + * @param program Program + * + * @return ProgramInstance list + */ Collection get( Patient patient, Program program ); + /** + * Retrieve program instances on a patient with a status by a program + * + * @param patient Patient + * @param program Program + * @param status Status of program-instance, include STATUS_ACTIVE, + * STATUS_COMPLETED and STATUS_CANCELLED + * + * @return ProgramInstance list + */ Collection get( Patient patient, Program program, Integer status ); + /** + * Retrieve program instances on an orgunit by a program + * + * @param program Program + * @param organisationUnit Organisation Unit + * + * @return ProgramInstance list + */ Collection get( Program program, OrganisationUnit organisationUnit ); + /** + * Retrieve program instances with active status on an orgunit by a program + * with result limited + * + * @param program Program + * @param organisationUnit Organisation Unit + * @param min + * @param max + * + * @return ProgramInstance list + */ Collection get( Program program, OrganisationUnit organisationUnit, int min, int max ); + /** + * Retrieve program instances with active status on an orgunit by a program + * in a certain period + * + * @param program Program + * @param organisationUnit Organisation Unit + * @param startDate The start date for retrieving on enrollment-date + * @param endDate The end date for retrieving on enrollment-date + * + * @return ProgramInstance list + */ Collection get( Program program, OrganisationUnit organisationUnit, Date startDate, Date endDate ); + /** + * Retrieve program instances with active status on an orgunit by a program + * for a certain period with result limited + * + * @param program Program + * @param organisationUnit Organisation Unit + * @param startDate The start date for retrieving on enrollment-date + * @param endDate The end date for retrieving on enrollment-date + * + * @return ProgramInstance list + */ Collection get( Program program, Collection orgunitIds, Date startDate, Date endDate, int min, int max ); + /** + * Get the number of program instances of a program on an organisation unit + * + * @param program Program + * @param organisationUnit Organisation Unit + * @param startDate The start date for retrieving on enrollment-date + * @param endDate The end date for retrieving on enrollment-date + * + * @return ProgramInstance list + */ int count( Program program, OrganisationUnit organisationUnit ); + /** + * Get the number of program instances which are active status and + * registered in a certain orgunit by a program for a certain period + * + * @param program Program + * @param organisationUnit Organisation Unit + * @param startDate The start date for retrieving on enrollment-date + * @param endDate The end date for retrieving on enrollment-date + * + * @return ProgramInstance list + */ int count( Program program, Collection orgunitIds, Date startDate, Date endDate ); + /** + * Remove a program instance + * + * @param programInstance ProgramInstance + */ void removeProgramEnrollment( ProgramInstance programInstance ); + /** + * Get the number of program instances of a program which have a certain + * status and an orgunit ids list for a period + * + * @param Status of program-instance, include STATUS_ACTIVE, + * STATUS_COMPLETED and STATUS_CANCELLED + * @param program ProgramInstance + * @param orgunitIds A list of orgunit ids + * @param startDate The start date for retrieving on enrollment-date + * @param endDate The end date for retrieving on enrollment-date + * + * @return A number + */ int countByStatus( Integer status, Program program, Collection orgunitIds, Date startDate, Date endDate ); + /** + * Retrieve program instances with a certain status on a program and an + * orgunit ids list for a period + * + * @param Status of program-instance, include STATUS_ACTIVE, + * STATUS_COMPLETED and STATUS_CANCELLED + * @param program ProgramInstance + * @param orgunitIds A list of orgunit ids + * @param startDate The start date for retrieving on enrollment-date + * @param endDate The end date for retrieving on enrollment-date + * + * @return ProgramInstance list + */ Collection getByStatus( Integer status, Program program, Collection orgunitIds, Date startDate, Date endDate ); + /** + * Rerieve schedule list of patiens registered + * + * @return A SchedulingProgramObject list + */ Collection getSendMesssageEvents( String dateToCompare ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java 2013-10-24 08:31:35 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramService.java 2013-11-04 03:13:27 +0000 @@ -28,11 +28,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.Collection; + import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.validation.ValidationCriteria; -import java.util.Collection; - /** * @author Abyot Asalefew * @version $Id$ @@ -41,35 +41,149 @@ { String ID = ProgramService.class.getName(); - int saveProgram( Program program ); - + /** + * Adds an {@link Program} + * + * @param program The to Program add. + * + * @return A generated unique id of the added {@link Program}. + */ + int addProgram( Program program ); + + /** + * Updates an {@link Program}. + * + * @param program the Program to update. + */ + void updateProgram( Program program ); + + /** + * Deletes a {@link Program}. All {@link ProgramStage}, + * {@link ProgramInstance} and {@link ProgramStageInstance} belong to this + * program are removed + * + * @param program the Program to delete. + */ void deleteProgram( Program program ); - void updateProgram( Program program ); - + /** + * Returns a {@link Program}. + * + * @param id the id of the Program to return. + * + * @return the Program with the given id + */ Program getProgram( int id ); + /** + * Returns a {@link Program} with a given name. + * + * @param name the name of the Program to return. + * @return the Program with the given name, or null if no match. + */ Program getProgramByName( String name ); - + + /** + * Returns the {@link Program} with the given code. + * + * @param code the code. + * @return the Program with the given code, or null if no match. + */ Program getProgramByCode( String code ); + /** + * Returns all {@link Program}. + * + * @return a collection of all Program, or an empty collection if there are + * no Programs. + */ Collection getAllPrograms(); + /** + * Get all {@link Program} belong to a orgunit + * + * @param organisationUnit {@link OrganisationUnit} + * + * @return The program list + */ Collection getPrograms( OrganisationUnit organisationUnit ); + /** + * Get {@link Program} by the current user. + * + * @return The program list the current user + */ Collection getProgramsByCurrentUser(); + /** + * Get {@link Program} by the current user and a certain type + * + * @param type The type of program. There are three types, include Multi + * events with registration, Single event with registration and + * Single event without registration. + * + * @return Program list by a type specified + */ Collection getProgramsByCurrentUser( int type ); + /** + * Get {@link Program} included in the expression of a + * {@link ValidationCriteria} + * + * @param validationCriteria {@link ValidationCriteria} + * + * @return Program list + */ Collection getPrograms( ValidationCriteria validationCriteria ); + /** + * Get {@link Program} by a type + * + * @param type The type of program. There are three types, include Multi + * events with registration, Single event with registration and + * Single event without registration + * + * @return Program list by a type specified + */ Collection getPrograms( int type ); + /** + * Get {@link Program} assigned to an {@link OrganisationUnit} by a type + * + * @param type The type of program. There are three types, include Multi + * events with registration, Single event with registration and + * Single event without registration + * @param orgunit Where programs assigned + * + * @return Program list by a type specified + */ Collection getPrograms( int type, OrganisationUnit orgunit ); + /** + * Returns the {@link Program} with the given UID. + * + * @param uid the UID. + * @return the Program with the given UID, or null if no match. + */ Program getProgram( String uid ); + /** + * Get {@link Program} which are displayed on all {@link OrganisationUnit} + * for searching or enrolling a person + * + * @param displayOnAllOrgunit Optional flag to specify programs can + * displayed for searching or enrolling (true ) or + * cannot be used on the orgunit (false) instances. + * @param orgunit {@link OrganisationUnit} + * + * @return Program list + */ Collection getProgramsByDisplayOnAllOrgunit( boolean displayOnAllOrgunit, OrganisationUnit orgunit ); - + + /** + * Get {@link Program} belong to an orgunit by the current user + * + * @param organisationUnit {@link OrganisationUnit} + */ Collection getProgramsByCurrentUser( OrganisationUnit organisationUnit ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElementService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElementService.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElementService.java 2013-11-04 03:13:27 +0000 @@ -41,18 +41,65 @@ { String ID = ProgramStageInstanceService.class.getName(); + /** + * Adds an {@link ProgramStageDataElement} + * + * @param programStageDataElement The to ProgramStageDataElement add. + * + * @return A generated unique id of the added + * {@link ProgramStageDataElement}. + */ void addProgramStageDataElement( ProgramStageDataElement programStageDataElement ); - - void updateProgramStageDataElement ( ProgramStageDataElement programStageDataElement ); - + + /** + * Updates an {@link ProgramStageDataElement}. + * + * @param programStageDataElement the ProgramStageDataElement to update. + */ + void updateProgramStageDataElement( ProgramStageDataElement programStageDataElement ); + + /** + * Deletes a {@link ProgramStageDataElement}. + * + * @param programStageDataElement the ProgramStageDataElement to delete. + */ void deleteProgramStageDataElement( ProgramStageDataElement programStageDataElement ); - + + /** + * Retrieve ProgramStageDataElement list on a program stage and a data + * element + * + * @param programStage ProgramStage + * @param dataElement DataElement + * + * @return ProgramStageDataElement + */ ProgramStageDataElement get( ProgramStage programStage, DataElement dataElement ); + /** + * Returns all {@link ProgramStageDataElement} + * + * @return a collection of all ProgramStageDataElement, or an empty + * collection if there are no ProgramStageDataElements. + */ Collection getAllProgramStageDataElements(); + /** + * Retrieve ProgramStageDataElement list on a program stage + * + * @param programStage ProgramStage + * + * @return ProgramStageDataElement list + */ Collection get( ProgramStage programStage ); - + + /** + * Retrieve Data element list on a program stage + * + * @param programStage ProgramStage + * + * @return ProgramStageDataElement list + */ Collection getListDataElement( ProgramStage programStage ); - + } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElementStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElementStore.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageDataElementStore.java 2013-11-04 03:13:27 +0000 @@ -41,17 +41,64 @@ { String ID = ProgramStageInstanceStore.class.getName(); + /** + * Adds an {@link ProgramStageDataElement} + * + * @param programStageDataElement The to ProgramStageDataElement add. + * + * @return A generated unique id of the added + * {@link ProgramStageDataElement}. + */ void save( ProgramStageDataElement programStageDataElement ); + /** + * Updates an {@link ProgramStageDataElement}. + * + * @param programStageDataElement the ProgramStageDataElement to update. + */ void update( ProgramStageDataElement programStageDataElement ); + /** + * Deletes a {@link ProgramStageDataElement}. + * + * @param programStageDataElement the ProgramStageDataElement to delete. + */ void delete( ProgramStageDataElement programStageDataElement ); + /** + * Retrieve ProgramStageDataElement list on a program stage and a data + * element + * + * @param programStage ProgramStage + * @param dataElement DataElement + * + * @return ProgramStageDataElement + */ ProgramStageDataElement get( ProgramStage programStage, DataElement dataElement ); - + + /** + * Returns all {@link ProgramStageDataElement} + * + * @return a collection of all ProgramStageDataElement, or an empty + * collection if there are no ProgramStageDataElements. + */ Collection getAll(); + /** + * Retrieve ProgramStageDataElement list on a program stage + * + * @param programStage ProgramStage + * + * @return ProgramStageDataElement list + */ Collection get( ProgramStage programStage ); + /** + * Retrieve Data element list on a program stage + * + * @param programStage ProgramStage + * + * @return ProgramStageDataElement list + */ Collection getListDataElement( ProgramStage programStage ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java 2013-11-03 23:45:52 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java 2013-11-04 03:13:27 +0000 @@ -49,44 +49,178 @@ { String ID = ProgramStageInstanceService.class.getName(); + /** + * Adds an {@link PatientAttribute} + * + * @param patientAttribute The to PatientAttribute add. + * + * @return A generated unique id of the added {@link PatientAttribute}. + */ int addProgramStageInstance( ProgramStageInstance programStageInstance ); + /** + * Deletes a {@link PatientAttribute}. + * + * @param patientAttribute the PatientAttribute to delete. + */ void deleteProgramStageInstance( ProgramStageInstance programStageInstance ); + /** + * Updates an {@link PatientAttribute}. + * + * @param patientAttribute the PatientAttribute to update. + */ void updateProgramStageInstance( ProgramStageInstance programStageInstance ); + /** + * Returns a {@link PatientAttribute}. + * + * @param id the id of the PatientAttribute to return. + * + * @return the PatientAttribute with the given id + */ ProgramStageInstance getProgramStageInstance( int id ); + /** + * Returns the {@link PatientAttribute} with the given UID. + * + * @param uid the UID. + * @return the PatientAttribute with the given UID, or null if no match. + */ ProgramStageInstance getProgramStageInstance( String uid ); + /** + * Retrieve an event on a program instance and a program stage. For + * repeatable stage, the system returns the last event + * + * @param programInstance ProgramInstance + * @param programStage ProgramStage + * + * @return ProgramStageInstance + */ ProgramStageInstance getProgramStageInstance( ProgramInstance programInstance, ProgramStage programStage ); + /** + * Retrieve an event list on a program instance and a program stage + * + * @param programInstance ProgramInstance + * @param programStage ProgramStage + * + * @return ProgramStageInstance + */ Collection getProgramStageInstances( ProgramInstance programInstance, ProgramStage programStage ); + /** + * Retrieve an event list on a program stage + * + * @param programStage ProgramStage + * + * @return ProgramStageInstance + */ Collection getProgramStageInstances( ProgramStage programStage ); + /** + * Retrieve an event list on program stage by an orgunit + * + * @param programStage ProgramStage + * @param organisationUnit OrganisationUnit + * + * @return ProgramStageInstance list + */ Collection getProgramStageInstances( ProgramStage programStage, OrganisationUnit organisationUnit ); + /** + * Retrieve an event list on program stage by an orgunit in a due date + * period + * + * @param programStage ProgramStage + * @param organisationUnit OrganisationUnit + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * + * @return ProgramStageInstance list + */ Collection getProgramStageInstances( ProgramStage programStage, - OrganisationUnit organisationUnit, Date start, Date end ); + OrganisationUnit organisationUnit, Date after, Date before ); + /** + * Retrieve an event list on program instance list + * + * @param programInstances ProgramInstance list + * + * @return ProgramStageInstance list + */ Collection getProgramStageInstances( Collection programInstances ); + /** + * Retrieve an event list on program instance list with a certain status + * + * @param programInstances ProgramInstance list + * @param completed Optional flag to only get completed (true ) + * or uncompleted (false) instances. + * + * @return ProgramStageInstance list + */ Collection getProgramStageInstances( Collection programInstances, boolean completed ); + /** + * Retrieve an event list on due-date + * + * @param dueDate Due date + * + * @return ProgramStageInstance list + */ Collection getProgramStageInstances( Date dueDate ); + /** + * Retrieve an event list by status on due date + * + * @param dueDate Due date + * @param completed Optional flag to only get completed (true ) + * or uncompleted (false) instances. + * + * @return ProgramStageInstance list + */ Collection getProgramStageInstances( Date dueDate, Boolean completed ); - Collection getProgramStageInstances( Date startDate, Date endDate ); + /** + * Retrieve an event list in a period + * + * @param after - Optional date the instance should be on or after. + * @param before - optional date the instance should be on or before. + * + * @param ProgramStageInstance list + */ + Collection getProgramStageInstances( Date after, Date before ); + /** + * Retrieve an event list by complete status in a period + * + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * @param completed Optional flag to only get completed (true ) + * or uncompleted (false) instances. + */ Collection getProgramStageInstances( Date startDate, Date endDate, Boolean completed ); + /** + * Returns all {@link ProgramStageInstance}. + * + * @return a collection of all event, or an empty collection if there are no + * ProgramStageInstances. + */ Collection getAllProgramStageInstances(); + /** + * Get statuses of events + * + * @param programStageInstances ProgramStageInstance list + * + * @return Map< ProgramStageInstance ID, status > + */ Map statusProgramStageInstances( Collection programStageInstances ); /** @@ -102,19 +236,80 @@ */ List get( OrganisationUnit unit, Date after, Date before, Boolean completed ); + /** + * Get all events by patient, optionally filtering by completed. + * + * @param patient Patient + * + * @param completed - optional flag to only get completed ( + * true ) or uncompleted (false) instances. + * + * @return ProgramStageInstance list + */ List getProgramStageInstances( Patient patient, Boolean completed ); + /** + * Get an event report of program instance + * + * @param programInstance ProgramInstance + * @param format I18nFormat object + * @param i18n I18n object + * + * @return List of grids. Each grid is included all information of a event + */ List getProgramStageInstancesReport( ProgramInstance programInstance, I18nFormat format, I18n i18n ); + /** + * Remove events without any data values + * + * @param programStage Empty events belong to this program stage are removed + * @param organisationUnit Specify an orgunit where empty events belong to + */ void removeEmptyEvents( ProgramStage programStage, OrganisationUnit organisationUnit ); + /** + * Create relationship between an OutboundSms with many events. + * + * @param programStageInstances Event list + * @param outboundSms OutboundSms object + */ void updateProgramStageInstances( Collection programStageInstances, OutboundSms outboundSms ); + /** + * Retrieve scheduled list of patients registered + * + * @return A SchedulingProgramObject list + */ Collection getSendMesssageEvents(); + /** + * Get/export statistical report of a program + * + * @param program Program needs to report + * @param orgunitIds The ids of orgunits where the events happened + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * @param i18n I18n object + * @param format I18nFormat + * + * @return Program report + */ Grid getStatisticalReport( Program program, Collection orgunitIds, Date startDate, Date endDate, I18n i18n, I18nFormat format ); + /** + * Get details of events which meets the criteria in statistical report + * + * @param programStage The program stage needs to get details + * @param orgunitIds The ids of orgunits where the events happened + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * @param status The status of event. There are four statuses for events, + * includes COMPLETED_STATUS, VISITED_STATUS, FUTURE_VISIT_STATUS, + * LATE_VISIT_STATUS + * @param min + * @param max + */ List getStatisticalProgramStageDetailsReport( ProgramStage programStage, Collection orgunitIds, Date startDate, Date endDate, int status, Integer max, Integer min ); @@ -122,29 +317,128 @@ // Statistical // ------------------------------------------------------------------------- + /** + * Get events of a program by report date + * + * @param program Program + * @param orgunitIds The ids of orgunits where the events happened + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * @param completed optional flag to only get completed (true ) + * or uncompleted (false) or all (null) + * instances. + * + * @return ProgramStageInstance list + */ Collection getProgramStageInstances( Program program, Collection orgunitIds, Date startDate, Date endDate, Boolean completed ); + /** + * Get the number of over due events of a program stage in a certain period + * + * @param programStage ProgramStage + * @param orgunitIds The ids of orgunits where the events happened + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * + * @return A number + */ int getOverDueEventCount( ProgramStage programStage, Collection orgunitIds, Date startDate, Date endDate ); + /** + * Get the number of program instances completed + * + * @param program Program + * @param orgunitIds The ids of orgunits where the events happened + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * @param status The status of event. There are four statuses for events, + * includes COMPLETED_STATUS, VISITED_STATUS, FUTURE_VISIT_STATUS, + * LATE_VISIT_STATUS + * @return A number + */ int averageNumberCompletedProgramInstance( Program program, Collection orgunitIds, Date startDate, Date endDate, Integer status ); + /** + * Get ids of orgunits where events happened in a period + * + * @param startDate The start date for retrieving on report date + * @param endDate The end date for retrieving on report date + * + * @return The ids of orgunits + */ Collection getOrganisationUnitIds( Date startDate, Date endDate ); + /** + * Get/Export a report about the number of events of a program completed on + * a orgunit + * + * @param orgunitIds The ids of orgunits where the events happened + * @param program The program needs for reporting + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * + * @return Grid + */ Grid getCompletenessProgramStageInstance( Collection orgunits, Program program, String startDate, String endDate, I18n i18n ); + /** + * Send messages as SMS defined for a program-stage + * + * @param programStageInstance ProgramStageInstance + * @param status The time to send message, send when to complete an event or + * send by scheduled days + * @param format I18nFormat object + * + * @return OutboundSms list + */ Collection sendMessages( ProgramStageInstance programStageInstance, int status, I18nFormat format ); + /** + * Send messages defined as DHIS messages for a program-stage + * + * @param programStageInstance ProgramStageInstance + * @param status The time to send message, send when a person enrolled an + * program or complete a program or send by scheduled days + * @param format I18nFormat object + * + * @return MessageConversation list + */ Collection sendMessageConversations( ProgramStageInstance programStageInstance, int status, I18nFormat format ); + /** + * Complete an event. Besides, program template messages will be send if it + * was defined to send when to complete this program + * + * @param programInstance ProgramInstance + * @param format I18nFormat + */ void completeProgramStageInstance( ProgramStageInstance programStageInstance, I18nFormat format ); + /** + * Set report date and orgunit where an event happened for the event + * + * @param programStageInstance ProgramStageInstance + * @param executionDate Report date + * @param organisationUnit Orgunit where the event happens + */ void setExecutionDate( ProgramStageInstance programStageInstance, Date executionDate, OrganisationUnit organisationUnit ); + /** + * For the first case of an anonymous program, the program-instance doesn't + * exist, So system has to create a program-instance and + * program-stage-instance. The similar thing happens for single event with + * registration. + * + * @param patient Patient + * @param program Single event without registration + * @param executionDate Report date of the event + * @param organisationUnit Orgunit where the event happens + */ void createProgramStageInstance( Patient patient, Program program, Date executionDate, OrganisationUnit organisationUnit ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java 2013-11-03 23:45:52 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java 2013-11-04 03:13:27 +0000 @@ -48,22 +48,94 @@ { String ID = ProgramStageInstanceStore.class.getName(); + /** + * Retrieve an event on a program instance and a program stage. For + * repeatable stage, the system returns the last event + * + * @param programInstance ProgramInstance + * @param programStage ProgramStage + * + * @return ProgramStageInstance + */ ProgramStageInstance get( ProgramInstance programInstance, ProgramStage programStage ); + /** + * Retrieve an event list on a program instance and a program stage + * + * @param programInstance ProgramInstance + * @param programStage ProgramStage + * + * @return ProgramStageInstance + */ Collection getAll( ProgramInstance programInstance, ProgramStage programStage ); + /** + * Retrieve an event list on a program stage + * + * @param programStage ProgramStage + * + * @return ProgramStageInstance + */ Collection get( ProgramStage programStage ); + /** + * Retrieve an event list on due-date + * + * @param dueDate Due date + * + * @return ProgramStageInstance list + */ Collection get( Date dueDate ); + /** + * Retrieve an event list by status on due date + * + * @param dueDate Due date + * @param completed Optional flag to only get completed (true ) + * or uncompleted (false) instances. + * + * @return ProgramStageInstance list + */ Collection get( Date dueDate, Boolean completed ); + /** + * Retrieve an event list in a due date period + * + * @param after - Optional date the instance should be on or after. + * @param before - optional date the instance should be on or before. + * + * @param ProgramStageInstance list + */ Collection get( Date startDate, Date endDate ); + /** + * Retrieve an event list by complete status in a period + * + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * @param completed Optional flag to only get completed (true ) + * or uncompleted (false) instances. + */ Collection get( Date startDate, Date endDate, Boolean completed ); + /** + * Retrieve an event list on program instance list + * + * @param programInstances ProgramInstance list + * + * @return ProgramStageInstance list + */ Collection get( Collection programInstances ); + /** + * Retrieve an event list on program instance list with a certain status + * + * @param programInstances ProgramInstance list + * @param completed Optional flag to only get completed (true ) + * or uncompleted (false) instances. + * + * @return ProgramStageInstance list + */ Collection get( Collection programInstances, boolean completed ); /** @@ -76,41 +148,187 @@ * ) or uncompleted (false) instances. * @return */ - public List get( OrganisationUnit unit, Date after, Date before, Boolean completed ); + List get( OrganisationUnit unit, Date after, Date before, Boolean completed ); + /** + * Get all events by patient, optionally filtering by completed. + * + * @param patient Patient + * + * @param completed - optional flag to only get completed ( + * true ) or uncompleted (false) instances. + * + * @return ProgramStageInstance list + */ List get( Patient patient, Boolean completed ); + /** + * Retrieve an event list on program stage by an orgunit + * + * @param programStage ProgramStage + * @param organisationUnit OrganisationUnit + * + * @return ProgramStageInstance list + */ List get( ProgramStage programStage, OrganisationUnit orgunit ); + /** + * Retrieve an event list on program stage by an orgunit in a due date + * period + * + * @param programStage ProgramStage + * @param organisationUnit OrganisationUnit + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * + * @return ProgramStageInstance list + */ List get( ProgramStage programStage, OrganisationUnit orgunit, Date startDate, Date endDate, int min, int max ); + /** + * Remove events without any data values + * + * @param programStage Empty events belong to this program stage are removed + * @param organisationUnit Specify an orgunit where empty events belong to + */ void removeEmptyEvents( ProgramStage programStage, OrganisationUnit organisationUnit ); + /** + * Create relationship between an OutboundSms with many events. + * + * @param programStageInstances Event list + * @param outboundSms OutboundSms object + */ void update( Collection programStageInstanceIds, OutboundSms outboundSms ); + /** + * Retrieve scheduled list of patients registered + * + * @return A SchedulingProgramObject list + */ Collection getSendMesssageEvents(); + /** + * Get the number of events by status + * + * @param programStage The program stage needs to get details + * @param orgunitIds The ids of orgunits where the events happened + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * @param status The status of event. There are four statuses for events, + * includes COMPLETED_STATUS, VISITED_STATUS, FUTURE_VISIT_STATUS, + * LATE_VISIT_STATUS + */ int getStatisticalProgramStageReport( ProgramStage programStage, Collection orgunitIds, Date startDate, Date endDate, int status ); + /** + * Get details of events which meets the criteria in statistical report + * + * @param programStage The program stage needs to get details + * @param orgunitIds The ids of orgunits where the events happened + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * @param status The status of event. There are four statuses for events, + * includes COMPLETED_STATUS, VISITED_STATUS, FUTURE_VISIT_STATUS, + * LATE_VISIT_STATUS + * @param min + * @param max + */ List getStatisticalProgramStageDetailsReport( ProgramStage programStage, Collection orgunitIds, Date startDate, Date endDate, int status, Integer min, Integer max ); - Collection get( Program program, Collection orgunitIds, Date startDate, - Date endDate, Boolean completed ); + /** + * Get events of a program by report date + * + * @param program Program + * @param orgunitIds The ids of orgunits where the events happened + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * @param completed optional flag to only get completed (true ) + * or uncompleted (false) or all (null) + * instances. + * + * @return ProgramStageInstance list + */ + Collection get( Program program, Collection orgunitIds, Date after, Date before, + Boolean completed ); + /** + * Get the number of events by completed status + * + * @param program Program + * @param orgunitIds The ids of orgunits where the events happened + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * @param completed Optional flag to only get completed (true ) + * or uncompleted (false) instances. + * @return A number + */ int count( Program program, Collection orgunitIds, Date startDate, Date endDate, Boolean completed ); + /** + * Get the number of events by completed status + * + * @param program Program + * @param orgunitIds The ids of orgunits where the events happened + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * @param completed Optional flag to only get completed (true ) + * or uncompleted (false) instances. + * @return A number + */ int count( ProgramStage programStage, Collection orgunitIds, Date startDate, Date endDate, Boolean completed ); + /** + * Get the number of over due events of a program stage in a certain period + * + * @param programStage ProgramStage + * @param orgunitIds The ids of orgunits where the events happened + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * + * @return A number + */ int getOverDueCount( ProgramStage programStage, Collection orgunitIds, Date startDate, Date endDate ); + /** + * Get the number of program instances completed + * + * @param program Program + * @param orgunitIds The ids of orgunits where the events happened + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * @param status The status of event. There are four statuses for events, + * includes COMPLETED_STATUS, VISITED_STATUS, FUTURE_VISIT_STATUS, + * LATE_VISIT_STATUS + * @return A number + */ int averageNumberCompleted( Program program, Collection orgunitIds, Date startDate, Date endDate, Integer status ); + /** + * Get ids of orgunits where events happened in a period + * + * @param startDate The start date for retrieving on report date + * @param endDate The end date for retrieving on report date + * + * @return The ids of orgunits + */ Collection getOrgunitIds( Date startDate, Date endDate ); + /** + * Get/Export a report about the number of events of a program completed on + * a orgunit + * + * @param orgunitIds The ids of orgunits where the events happened + * @param program The program needs for reporting + * @param after Optional date the instance should be on or after. + * @param before Optional date the instance should be on or before. + * + * @return Grid + */ Grid getCompleteness( Collection orgunitIds, Program program, String startDate, String endDate, I18n i18n ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSectionService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSectionService.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSectionService.java 2013-11-04 03:13:27 +0000 @@ -33,7 +33,7 @@ /** * @author Chau Thu Tran - * + * * @version ProgramStageSectionService.java 11:12:41 AM Aug 22, 2012 $ */ public interface ProgramStageSectionService @@ -43,21 +43,75 @@ // ------------------------------------------------------------------------- // ProgramStageSection // ------------------------------------------------------------------------- - + + /** + * Adds an {@link ProgramStageSection} + * + * @param programStageSection The to ProgramStageSection add. + * + * @return A generated unique id of the added {@link ProgramStageSection}. + */ int saveProgramStageSection( ProgramStageSection programStageSection ); - + + /** + * Deletes a {@link ProgramStageSection}. + * + * @param programStageSection the ProgramStageSection to delete. + */ void deleteProgramStageSection( ProgramStageSection programStageSection ); - + + /** + * Updates an {@link ProgramStageSection}. + * + * @param programStageSection the ProgramStageSection to update. + */ void updateProgramStageSection( ProgramStageSection programStageSection ); - + + /** + * Returns a {@link ProgramStageSection}. + * + * @param id the id of the ProgramStageSection to return. + * + * @return the ProgramStageSection with the given id + */ ProgramStageSection getProgramStageSection( int id ); - + + /** + * Returns a {@link ProgramStageSection} with a given name. + * + * @param name the name of the ProgramStageSection to return. + * + * @return the ProgramStageSection with the given name, or null if no match. + */ List getProgramStageSectionByName( String name ); - + + /** + * Retrieve a program stage section by name and a program stage + * + * @param name Name of program stage + * @param programStage Specify a {@link Program} for retrieving a program + * stage. The system allows the name of program stages are duplicated + * on different programs + * + * @return ProgramStage + */ ProgramStageSection getProgramStageSectionByName( String name, ProgramStage programStage ); - + + /** + * Returns all {@link ProgramStageSection} + * + * @return a collection of all ProgramStageSection, or an empty collection if + * there are no ProgramStageSections. + */ Collection getAllProgramStageSections(); - + + /** + * Get all sections by a program stage + * + * @param programStage {@link ProgramStage} + * + * @return ProgramStageSection list + */ Collection getProgramStages( ProgramStage programStage ); - + } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSectionStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSectionStore.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSectionStore.java 2013-11-04 03:13:27 +0000 @@ -37,5 +37,15 @@ public interface ProgramStageSectionStore extends GenericNameableObjectStore { + /** + * Retrieve a program stage section by name and a program stage + * + * @param name Name of program stage + * @param programStage Specify a {@link Program} for retrieving a program + * stage. The system allows the name of program stages are duplicated + * on different programs + * + * @return ProgramStage + */ ProgramStageSection getByNameAndProgramStage( String name, ProgramStage programStage ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageService.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageService.java 2013-11-04 03:13:27 +0000 @@ -43,20 +43,73 @@ // ProgramStage // ------------------------------------------------------------------------- + /** + * Adds an {@link ProgramStage} + * + * @param programStage The to ProgramStage add. + * + * @return A generated unique id of the added {@link ProgramStage}. + */ int saveProgramStage( ProgramStage programStage ); + /** + * Deletes a {@link ProgramStage}. + * + * @param programStage the ProgramStage to delete. + */ void deleteProgramStage( ProgramStage programStage ); + /** + * Updates an {@link ProgramStage}. + * + * @param programStage the ProgramStage to update. + */ void updateProgramStage( ProgramStage programStage ); + /** + * Returns a {@link ProgramStage}. + * + * @param id the id of the ProgramStage to return. + * + * @return the ProgramStage with the given id + */ ProgramStage getProgramStage( int id ); + /** + * Returns the {@link ProgramStage} with the given UID. + * + * @param uid the UID. + * @return the ProgramStage with the given UID, or null if no match. + */ ProgramStage getProgramStage( String uid ); + /** + * Returns a {@link ProgramStage} with a given name. + * + * @param name the name of the ProgramStage to return. + * + * @return the ProgramStage with the given name, or null if no match. + */ List getProgramStageByName( String name ); + /** + * Retrieve a program stage by name and a program + * + * @param name Name of program stage + * @param program Specify a {@link Program} for retrieving a program stage. + * The system allows the name of program stages are duplicated on + * different programs + * + * @return ProgramStage + */ ProgramStage getProgramStageByName( String name, Program program ); + /** + * Returns all {@link ProgramStage} + * + * @return a collection of all ProgramStage, or an empty collection if there + * are no ProgramStages. + */ Collection getAllProgramStages(); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageStore.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageStore.java 2013-11-04 03:13:27 +0000 @@ -36,5 +36,16 @@ public interface ProgramStageStore extends GenericNameableObjectStore { + + /** + * Retrieve a program stage by name and a program + * + * @param name Name of program stage + * @param program Specify a {@link Program} for retrieving a program stage. + * The system allows the name of program stages are duplicated on + * different programs + * + * @return ProgramStage + */ ProgramStage getByNameAndProgram( String name, Program program ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStore.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStore.java 2013-11-04 03:13:27 +0000 @@ -42,13 +42,57 @@ { String ID = ProgramStore.class.getName(); + /** + * Get {@link Program} by a type + * + * @param type The type of program. There are three types, include Multi + * events with registration, Single event with registration and + * Single event without registration + * + * @return Program list by a type specified + */ Collection getByType( int type ); + /** + * Get {@link Program} assigned to an {@link OrganisationUnit} by a type + * + * @param type The type of program. There are three types, include Multi + * events with registration, Single event with registration and + * Single event without registration + * @param orgunit Where programs assigned + * + * @return Program list by a type specified + */ Collection get( int type, OrganisationUnit orgunit ); + /** + * Get {@link Program} by the current user. + * + * @return The program list the current user + */ Collection getByCurrentUser(); + /** + * Get {@link Program} by the current user and a certain type + * + * @param type The type of program. There are three types, include Multi + * events with registration, Single event with registration and + * Single event without registration. + * + * @return Program list by a type specified + */ Collection getByCurrentUser( int type ); - - Collection getProgramsByDisplayOnAllOrgunit( boolean displayOnAllOrgunit, OrganisationUnit orgunit ); + + /** + * Get {@link Program} which are displayed on all {@link OrganisationUnit} + * for searching or enrolling a person + * + * @param displayOnAllOrgunit Optional flag to specify programs can + * displayed for searching or enrolling (true ) or + * cannot be used on the orgunit (false) instances. + * @param orgunit {@link OrganisationUnit} + * + * @return Program list + */ + Collection getProgramsByDisplayOnAllOrgunit( boolean displayOnAllOrgunit, OrganisationUnit orgunit ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationService.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationService.java 2013-11-04 03:13:27 +0000 @@ -38,22 +38,81 @@ { String ID = ProgramValidationService.class.getName(); + /** + * Adds an {@link ProgramValidation} + * + * @param programValidation The to ProgramValidation add. + * + * @return A generated unique id of the added {@link ProgramValidation}. + */ int addProgramValidation( ProgramValidation programValidation ); + /** + * Deletes a {@link ProgramValidation} + * + * @param programValidation The ProgramValidation to delete. + */ void deleteProgramValidation( ProgramValidation programValidation ); + /** + * Updates an {@link ProgramValidation}. + * + * @param programValidation The ProgramValidation to update. + */ void updateProgramValidation( ProgramValidation programValidation ); + /** + * Returns a {@link ProgramValidation}. + * + * @param id the id of the ProgramValidation to return. + * + * @return the ProgramValidation with the given id + */ ProgramValidation getProgramValidation( int id ); + /** + * Returns all {@link ProgramValidation}. + * + * @return a collection of all ProgramValidation, or an empty collection if + * there are no ProgramValidations. + */ Collection getAllProgramValidation(); + /** + * Get validation by {@link Program} + * + * @param program Program + * + * @return ProgramValidation list + */ Collection getProgramValidation( Program program ); + /** + * Get validation by program stage + * + * @param programStage {@link ProgramStage} + * + * @return ProgramValidation list + */ Collection getProgramValidation( ProgramStage programStage ); + /** + * Get {@link ProgramValidation} list from a {@link ProgramStageDataElement} + * + * @param psdataElement {@link ProgramStageDataElement} + * + * @return ProgramValidation list + */ Collection getProgramValidation( ProgramStageDataElement psdataElement ); + /** + * Get validation violated in an event + * + * @param validation ProgramValidation List + * @param programStageInstance {@link ProgramStageInstance} + * + * @return List of validation violated + */ Collection validate( Collection validation, ProgramStageInstance programStageInstance ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationStore.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidationStore.java 2013-11-04 03:13:27 +0000 @@ -29,6 +29,7 @@ */ import java.util.Collection; + import org.hisp.dhis.common.GenericStore; /** @@ -40,5 +41,12 @@ { String ID = ProgramValidation.class.getName(); + /** + * Get validation by program + * + * @param program {@link Program} + * + * @return ProgramValidation list + */ Collection get( Program program ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipService.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipService.java 2013-11-04 03:13:27 +0000 @@ -31,6 +31,7 @@ import java.util.Collection; import org.hisp.dhis.patient.Patient; +import org.hisp.dhis.program.Program; /** * @author Abyot Asalefew @@ -40,25 +41,97 @@ { String ID = RelationshipService.class.getName(); + /** + * Adds an {@link Program} + * + * @param program The to Program add. + * + * @return A generated unique id of the added {@link Program}. + */ int saveRelationship( Relationship relationship ); + /** + * Returns a {@link Program}. + * + * @param id the id of the Program to return. + * + * @return the Program with the given id + */ void deleteRelationship( Relationship relationship ); + /** + * Updates an {@link Program}. + * + * @param program the Program to update. + */ void updateRelationship( Relationship relationship ); + /** + * Returns a {@link Program}. + * + * @param id the id of the Program to return. + * + * @return the Program with the given id + */ Relationship getRelationship( int id ); - + + /** + * Get the relationship between two patients by retrieving a + * {@link RelationshipType} + * + * @param patientA {@link Patient} + * @param patientB {@link Patient} + * @param relationshipType {@link RelationshipType} + * + * @return {@link RelationshipType} + */ Relationship getRelationship( Patient patientA, Patient patientB, RelationshipType relationshipType ); - + + /** + * Get the relationship between two patients + * + * @param patientA {@link Patient} + * @param patientB {@link Patient} + * + * @return {@link RelationshipType} + */ Relationship getRelationship( Patient patientA, Patient patientB ); + /** + * Returns all {@link Relationship}. + * + * @return a collection of all Relationship, or an empty collection if there + * are no Programs. + */ Collection getAllRelationships(); + /** + * Retrieve relationships of a patient + * + * @param patient Patient + * + * @return Relationship list + */ Collection getRelationshipsForPatient( Patient patient ); - // For example a patient might have more than one sibling + /** + * Retrieve all relationships by relationship type of a person, for example + * a patient might have more than one sibling + * + * @param patientA Patient + * @param relationshipType RelationshipType + * + * @return Relationship list + */ Collection getRelationships( Patient patientA, RelationshipType relationshipType ); - Collection getRelationshipsByRelationshipType( RelationshipType relationshipType ); + /** + * Retrieve all relationships of a relationship type + * + * @param relationshipType RelationshipType + * + * @return Relationship list + */ + Collection getRelationshipsByRelationshipType( RelationshipType relationshipType ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipStore.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipStore.java 2013-11-04 03:13:27 +0000 @@ -42,13 +42,54 @@ { String ID = RelationshipStore.class.getName(); + /** + * Get the relationship between two patients by retrieving a + * {@link RelationshipType} + * + * @param patientA {@link Patient} + * @param patientB {@link Patient} + * @param relationshipType {@link RelationshipType} + * + * @return {@link RelationshipType} + */ Relationship get( Patient patientA, Patient patientB, RelationshipType relationshipType ); - + + /** + * Get the relationship between two patients + * + * @param patientA {@link Patient} + * @param patientB {@link Patient} + * + * @return {@link RelationshipType} + */ Relationship get( Patient patientA, Patient patientB ); + /** + * Retrieve all relationships by relationship type of a person, for example + * a patient might have more than one sibling + * + * @param patientA Patient + * @param relationshipType RelationshipType + * + * @return Relationship list + */ Collection get( Patient patientA, RelationshipType relationshipType ); + /** + * Retrieve relationships of a patient + * + * @param patient Patient + * + * @return Relationship list + */ Collection getForPatient( Patient patient ); - Collection getByRelationshipType( RelationshipType relationshipType ); + /** + * Retrieve all relationships of a relationship type + * + * @param relationshipType RelationshipType + * + * @return Relationship list + */ + Collection getByRelationshipType( RelationshipType relationshipType ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipTypeService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipTypeService.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipTypeService.java 2013-11-04 03:13:27 +0000 @@ -35,19 +35,57 @@ * @version $Id$ */ public interface RelationshipTypeService -{ +{ String ID = RelationshipTypeService.class.getName(); - + + /** + * Adds an {@link RelationshipType} + * + * @param relationshipType The to RelationshipType add. + * + * @return A generated unique id of the added {@link RelationshipType}. + */ int saveRelationshipType( RelationshipType relationshipType ); - + + /** + * Deletes a {@link RelationshipType}. + * + * @param relationshipType the RelationshipType to delete. + */ void deleteRelationshipType( RelationshipType relationshipType ); - + + /** + * Updates an {@link RelationshipType}. + * + * @param relationshipType the RelationshipType to update. + */ void updateRelationshipType( RelationshipType relationshipType ); - - RelationshipType getRelationshipType( int id ); - + + /** + * Returns a {@link RelationshipType}. + * + * @param id the id of the RelationshipType to return. + * + * @return the RelationshipType with the given id + */ + RelationshipType getRelationshipType( int id ); + + /** + * Retrieve a relationship + * + * @param aIsToB The A side + * @param bIsToA The B side + * + * @return RelationshipType + */ RelationshipType getRelationshipType( String aIsToB, String bIsToA ); - - Collection getAllRelationshipTypes(); - + + /** + * Returns all {@link RelationshipType} + * + * @return a collection of all RelationshipType, or an empty collection if + * there are no RelationshipTypes. + */ + Collection getAllRelationshipTypes(); + } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipTypeStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipTypeStore.java 2013-09-19 08:33:39 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipTypeStore.java 2013-11-04 03:13:27 +0000 @@ -39,6 +39,14 @@ { String ID = RelationshipTypeStore.class.getName(); + /** + * Retrieve a relationship + * + * @param aIsToB The A side + * @param bIsToA The B side + * + * @return RelationshipType + */ RelationshipType getRelationshipType( String aIsToB, String bIsToA ); } === modified file 'dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/patientreport/DefaultPatientTabularReportService.java' --- dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/patientreport/DefaultPatientTabularReportService.java 2013-08-23 16:05:01 +0000 +++ dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/patientreport/DefaultPatientTabularReportService.java 2013-11-04 03:13:27 +0000 @@ -64,7 +64,7 @@ } @Override - public Collection getAllCharts() + public Collection getAllTabularReports() { return tabularReportStore.getAll(); } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeGroupService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeGroupService.java 2013-08-23 16:05:01 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeGroupService.java 2013-11-04 03:13:27 +0000 @@ -34,6 +34,7 @@ import java.util.Collection; import java.util.List; +import org.hisp.dhis.common.GenericIdentifiableObjectStore; import org.hisp.dhis.i18n.I18nService; import org.springframework.transaction.annotation.Transactional; @@ -49,9 +50,10 @@ // Dependencies // ------------------------------------------------------------------------- - private PatientAttributeGroupStore patientAttributeGroupStore; + private GenericIdentifiableObjectStore patientAttributeGroupStore; - public void setPatientAttributeGroupStore( PatientAttributeGroupStore patientAttributeGroupStore ) + public void setPatientAttributeGroupStore( + GenericIdentifiableObjectStore patientAttributeGroupStore ) { this.patientAttributeGroupStore = patientAttributeGroupStore; } === removed file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeGroupStore.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeGroupStore.java 2013-08-23 16:05:01 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeGroupStore.java 1970-01-01 00:00:00 +0000 @@ -1,66 +0,0 @@ -package org.hisp.dhis.patient.hibernate; - -/* - * Copyright (c) 2004-2013, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * Neither the name of the HISP project nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -import java.util.Collection; - -import org.hibernate.criterion.CriteriaSpecification; -import org.hibernate.criterion.Restrictions; -import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore; -import org.hisp.dhis.patient.PatientAttributeGroup; -import org.hisp.dhis.patient.PatientAttributeGroupStore; -import org.hisp.dhis.program.Program; - -/** - * @author Chau Thu Tran - * - * @version $HibernatePatientAttributeGroupStore.java Mar 26, 2012 1:45:26 PM$ - */ -public class HibernatePatientAttributeGroupStore - extends HibernateIdentifiableObjectStore - implements PatientAttributeGroupStore -{ - - @SuppressWarnings( "unchecked" ) - @Override - public Collection get( Program program ) - { - return getCriteria().setResultTransformer( CriteriaSpecification.DISTINCT_ROOT_ENTITY ).createAlias( "attributes", - "attribute" ).add( Restrictions.eq( "attribute.program", program ) ).list(); - } - - @SuppressWarnings( "unchecked" ) - @Override - public Collection getWithoutProgram() - { - return getCriteria().setResultTransformer( CriteriaSpecification.DISTINCT_ROOT_ENTITY ).createAlias( "attributes", - "attribute" ).add( Restrictions.isNull( "attribute.program" ) ).list(); - } - -} === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java 2013-11-04 00:01:39 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java 2013-11-04 03:13:27 +0000 @@ -138,13 +138,4 @@ return query.list(); } - @SuppressWarnings( "unchecked" ) - public Collection getWithoutProgram( Patient patient ) - { - String hql = "SELECT pav FROM PatientAttributeValue as pav WHERE pav.patient=:patient and pav.patientAttribute.program IS NULL"; - Query query = getQuery( hql ); - query.setEntity( "patient", patient ); - - return query.list(); - } } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2013-10-14 14:00:47 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2013-11-04 03:13:27 +0000 @@ -403,7 +403,7 @@ // Get all program data registered // --------------------------------------------------------------------- - Collection programInstances = getProgramInstances( patient ); + Collection programInstances = patient.getProgramInstances(); if ( programInstances.size() > 0 ) { === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java 2013-10-24 08:31:35 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java 2013-11-04 03:13:27 +0000 @@ -72,7 +72,7 @@ // ------------------------------------------------------------------------- @Override - public int saveProgram( Program program ) + public int addProgram( Program program ) { return programStore.save( program ); } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2013-11-04 00:01:39 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2013-11-04 03:13:27 +0000 @@ -117,7 +117,7 @@ + class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore"> === modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientStoreTest.java' --- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientStoreTest.java 2013-10-14 14:03:52 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/patient/PatientStoreTest.java 2013-11-04 03:13:27 +0000 @@ -164,8 +164,8 @@ @Test public void testGetByOrgUnitProgram() { - programService.saveProgram( programA ); - programService.saveProgram( programB ); + programService.addProgram( programA ); + programService.addProgram( programB ); patientStore.save( patientA ); patientStore.save( patientB ); @@ -192,8 +192,8 @@ @Test public void testGetByProgram() { - programService.saveProgram( programA ); - programService.saveProgram( programB ); + programService.addProgram( programA ); + programService.addProgram( programB ); patientStore.save( patientA ); patientStore.save( patientB ); === modified file 'dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramServiceTest.java' --- dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramServiceTest.java 2013-08-23 16:05:01 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/test/java/org/hisp/dhis/program/ProgramServiceTest.java 2013-11-04 03:13:27 +0000 @@ -89,8 +89,8 @@ Program programA = createProgram( 'A', programStages, organisationUnit ); Program programB = createProgram( 'B', programStages, organisationUnit ); - int idA = programService.saveProgram( programA ); - int idB = programService.saveProgram( programB ); + int idA = programService.addProgram( programA ); + int idB = programService.addProgram( programB ); assertEquals( programA, programService.getProgram( idA ) ); assertEquals( programB, programService.getProgram( idB ) ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java 2013-09-27 17:04:23 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java 2013-11-04 03:13:27 +0000 @@ -420,7 +420,7 @@ } program.setPatientReminders( patientReminders ); - programService.saveProgram( program ); + programService.addProgram( program ); if ( program.getType().equals( Program.SINGLE_EVENT_WITH_REGISTRATION ) || program.getType().equals( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) )