← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12816: Add comments for services in tracker mmodule.

 

------------------------------------------------------------
revno: 12816
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-10-28 14:12:28 +0700
message:
  Add comments for services in tracker mmodule.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAuditService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAuditStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== 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-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeService.java	2013-10-28 07:12:28 +0000
@@ -52,16 +52,48 @@
 
     Collection<PatientAttribute> getAllPatientAttributes();
 
+    /**
+     * Get patient attributes by value type
+     * 
+     * @param valueType Value type
+     * 
+     * @return List of patient attributes
+     */
     Collection<PatientAttribute> getPatientAttributesByValueType( String valueType );
 
+    /**
+     * Get mandatory patient attributes without groups
+     * 
+     * @return List of patient attributes
+     */
     Collection<PatientAttribute> getOptionalPatientAttributesWithoutGroup();
 
+    /**
+     * Get patient attributes by mandatory option
+     * 
+     * @param mandatory True/False value
+     */
     Collection<PatientAttribute> getPatientAttributesByMandatory( boolean mandatory );
 
+    /**
+     * Get patient attributes by groupBy option
+     * 
+     * @param groupBy True/False value
+     */
     PatientAttribute getPatientAttributeByGroupBy( boolean groupBy );
 
+    /**
+     * Get patient attributes without groups
+     * 
+     * @return List of patient attributes
+     */
     Collection<PatientAttribute> getPatientAttributesWithoutGroup();
-    
+
+    /**
+     * Get patient attributes which are displayed in visit schedule
+     * 
+     * @return List of patient attributes
+     */
     Collection<PatientAttribute> getPatientAttributesByDisplayOnVisitSchedule( boolean displayOnVisitSchedule );
 
 }

=== 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-09-27 10:43:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java	2013-10-28 07:12:28 +0000
@@ -40,16 +40,43 @@
 {
     String ID = PatientAttributeStore.class.getName();
 
+    /**
+     * Get patient attributes by value type
+     * 
+     * @param valueType Value type
+     * 
+     * @return List of patient attributes
+     */
     Collection<PatientAttribute> getByValueType( String valueType );
 
+    /**
+     * Get mandatory patient attributes without groups
+     * 
+     * @return List of patient attributes
+     */
     Collection<PatientAttribute> getOptionalPatientAttributesWithoutGroup();
 
+    /**
+     * Get patient attributes by mandatory option
+     * 
+     * @param mandatory True/False value
+     */
     Collection<PatientAttribute> getByMandatory( boolean mandatory );
 
     Collection<PatientAttribute> getWithoutGroup();
 
+    /**
+     * Get patient attributes by groupBy option
+     * 
+     * @param groupBy True/False value
+     */
     PatientAttribute getByGroupBy( boolean groupBy );
 
+    /**
+     * Get patient attributes which are displayed in visit schedule
+     * 
+     * @return List of patient attributes
+     */
     Collection<PatientAttribute> getByDisplayOnVisitSchedule( boolean displayOnVisitSchedule );
 
 }

=== 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-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAuditService.java	2013-10-28 07:12:28 +0000
@@ -48,8 +48,25 @@
 
     Collection<PatientAudit> getAllPatientAudit();
 
+    /**
+     * Get all patient audits of a patient
+     * 
+     * @param patient Patient
+     * 
+     * @return List of PatientAudit
+     */
     Collection<PatientAudit> getPatientAudits( Patient patient );
 
+    /**
+     * 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 date The data this user visited
+     * @param accessedModule The module this user accessed
+     * 
+     * @return PatientAudit
+     */
     PatientAudit getPatientAudit( Integer patientId, String visitor, Date date, String accessedModule );
 
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAuditStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAuditStore.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAuditStore.java	2013-10-28 07:12:28 +0000
@@ -35,12 +35,31 @@
 
 /**
  * @author Chau Thu Tran
- *
+ * 
  * @version PatientAuditStore.java 9:04:53 AM Sep 26, 2012 $
  */
-public interface PatientAuditStore extends GenericStore<PatientAudit>
+public interface PatientAuditStore
+    extends GenericStore<PatientAudit>
 {
+    /**
+     * Get all patient audits of a patient
+     * 
+     * @param patient Patient
+     * 
+     * @return List of PatientAudit
+     */
     Collection<PatientAudit> get( Patient patient );
-    
+
+    /**
+     * 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 date The data this user visited
+     * @param accessedModule The module this user accessed
+     * 
+     * @return PatientAudit
+     */
     PatientAudit get( Integer patientId, String visitor, Date date, String accessedModule );
 }

=== 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-25 05:00:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierService.java	2013-10-28 07:12:28 +0000
@@ -46,31 +46,119 @@
 
     PatientIdentifier getPatientIdentifier( int id );
 
+    Collection<PatientIdentifier> getAllPatientIdentifiers();
+
+    /**
+     * Retrieve patient identifiers of patient
+     * 
+     * @param patient Patient
+     */
     PatientIdentifier getPatientIdentifier( Patient patient );
 
-    Collection<PatientIdentifier> getAllPatientIdentifiers();
-
+    /**
+     * Retrieve patient identifiers by type
+     * 
+     * @param identifierType PatientIdentifierType
+     */
     Collection<PatientIdentifier> getPatientIdentifiersByType( PatientIdentifierType identifierType );
 
+    /**
+     * Search patient identifiers by identifier (performs partial search )
+     * 
+     * @param identifier A string for searching by identifier
+     * 
+     * @return PatientIdentifier list
+     */
     Collection<PatientIdentifier> getPatientIdentifiersByIdentifier( String identifier );
 
+    /**
+     * Search a patient identifier of a patient by identifier
+     * 
+     * @param identifier An identifier string for searching
+     * @param patient Patient
+     * 
+     * @return PatientIdentifier
+     */
     PatientIdentifier getPatientIdentifier( String identifier, Patient patient );
 
+    /**
+     * Retrieve PatientIdentifier of a patient by identifier type
+     * 
+     * @param identifierType PatientIdentifierType
+     * @param patient Patient
+     * 
+     * @return PatientIdentifier
+     */
     PatientIdentifier getPatientIdentifier( PatientIdentifierType identifierType, Patient patient );
 
+    /**
+     * Retrieve patient identifiers of a patient
+     * 
+     * @param patient Patient
+     * 
+     * @return PatientIdentifier list
+     */
     Collection<PatientIdentifier> getPatientIdentifiers( Patient patient );
 
+    /**
+     * Retrieve first patient based on type and identifier
+     * 
+     * @param type PatientIdentifierType
+     * @param identifier Identifier of patient
+     * 
+     * @return PatientIdentifier
+     */
     PatientIdentifier get( PatientIdentifierType type, String identifier );
 
+    /**
+     * Retrieve patients based on type and identifier. We need this since we
+     * have allowed identifiers with duplicate values in the past. This returns
+     * a list instead.
+     * 
+     * @param type PatientIdentifierType
+     * @param identifier Identifier of patient
+     * 
+     * @return PatientIdentifier list
+     */
     Collection<PatientIdentifier> getAll( PatientIdentifierType type, String identifier );
 
+    /**
+     * Retrieve a patient based on identifier type and a identifier value
+     * 
+     * @param identifierType PatientIdentifierType
+     * @param value Identifier value
+     */
     Patient getPatient( PatientIdentifierType identifierType, String value );
 
+    /**
+     * Retrieve patients based on identifier value with limit result (performs
+     * partial search )
+     * 
+     * @param identifier identifier value
+     * @param min
+     * @param max
+     * 
+     * @result Patient list
+     */
     Collection<Patient> getPatientsByIdentifier( String identifier, Integer min, Integer max );
 
+    /**
+     * Get the number of patient who has a identifier value (performs partial
+     * search )
+     * 
+     * @param identifier Identifier value
+     * 
+     * @return The number of patients
+     */
     int countGetPatientsByIdentifier( String identifier );
 
+    /**
+     * Retrieve patient identifiers based on identifier types
+     * 
+     * @param identifierTypes PatientIdentifierType collection
+     * @param patient Patient
+     */
     Collection<PatientIdentifier> getPatientIdentifiers( Collection<PatientIdentifierType> identifierTypes,
         Patient patient );
-    
+
 }

=== 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-23 12:24:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java	2013-10-28 07:12:28 +0000
@@ -66,10 +66,18 @@
 
     Collection<Patient> getAllPatients();
 
+    /**
+     * Retrieve patients who is the same name, birthdate and gender
+     * 
+     * @param name
+     * @param birthDate
+     * @param gender
+     * @return Patient List
+     * **/
     Collection<Patient> getPatients( String name, Date birthdate, String gender );
 
     /**
-     * Search Patient base on birthDate
+     * Retrieve patients base on birthDate
      * 
      * @param birthDate
      * @return Patient List
@@ -77,7 +85,7 @@
     Collection<Patient> getPatientsByBirthDate( Date birthDate );
 
     /**
-     * Search Patient base on fullName
+     * Retrieve patients by full name (performs partial search )
      * 
      * @param name fullName
      * @return Patient List
@@ -85,7 +93,7 @@
     Collection<Patient> getPatientsByNames( String name, Integer min, Integer max );
 
     /**
-     * Search Patient base on full-name or identifier value
+     * Retrieve patients base on full-name or identifier value
      * 
      * @param searchText value
      * @return Patient List
@@ -93,7 +101,7 @@
     Collection<Patient> getPatients( String searchText, Integer min, Integer max );
 
     /**
-     * Search Patient for mobile base on identifier value
+     * Retrieve patients for mobile base on identifier value
      * 
      * @param searchText value
      * @param orgUnitId
@@ -102,7 +110,7 @@
     Collection<Patient> getPatientsForMobile( String searchText, int orgUnitId );
 
     /**
-     * Search Patient base on organization unit with result limited
+     * Retrieve patients base on organization unit with result limited
      * 
      * @param organisationUnit organisationUnit
      * @return Patient List
@@ -110,7 +118,7 @@
     Collection<Patient> getPatients( OrganisationUnit organisationUnit, Integer min, Integer max );
 
     /**
-     * Search Patient base on organization unit with result limited
+     * Retrieve patients base on organization unit with result limited
      * 
      * @param organisationUnit organisationUnit
      * @return Patient List
@@ -118,13 +126,15 @@
     Collection<Patient> getPatients( OrganisationUnit organisationUnit );
 
     /**
+     * Retrieve patients who enrolled into a program with active status
      * 
-     * @param program
-     * @return
+     * @param program Program
+     * @return Patient list
      */
     Collection<Patient> getPatients( Program program );
 
     /**
+     * Retrieve patients registered in a orgunit and enrolled into a program with active status
      * 
      * @param organisationUnit
      * @param program
@@ -133,7 +143,7 @@
     Collection<Patient> getPatients( OrganisationUnit organisationUnit, Program program );
 
     /**
-     * Search Patient base on organization unit and sort the result by
+     * Retrieve patients base on organization unit and sort the result by
      * PatientAttribute
      * 
      * @param organisationUnit organisationUnit
@@ -146,7 +156,7 @@
         Integer max );
 
     /**
-     * Search Patient base on organisationUnit and identifier value name
+     * Retrieve patients base on organisationUnit and identifier value name
      * 
      * @param organisationUnit
      * @param searchText identifier value
@@ -157,7 +167,7 @@
     Collection<Patient> getPatientsLikeName( OrganisationUnit organisationUnit, String name, Integer min, Integer max );
 
     /**
-     * Search Patient base on PatientIdentifierType or Attribute or Patient's
+     * Retrieve patients base on PatientIdentifierType or Attribute or Patient's
      * name
      * 
      * @param identifierTypeId
@@ -168,7 +178,7 @@
     Collection<Patient> getPatient( Integer identifierTypeId, Integer attributeId, String value );
 
     /**
-     * Search Patient base on OrganisationUnit and Program with result limited
+     * Search patients base on OrganisationUnit and Program with result limited
      * name
      * 
      * @param organisationUnit
@@ -188,12 +198,20 @@
      */
     Collection<Patient> sortPatientsByAttribute( Collection<Patient> patients, PatientAttribute patientAttribute );
 
+    /**
+     * Get patients who has the same representative
+     * 
+     * @params patient The representatives
+     * 
+     * @return Patient List
+     * **/
     Collection<Patient> getRepresentatives( Patient patient );
 
     /**
      * Search Patient base on identifier value and get number of result
      * 
      * @param searchText
+     * 
      * @return number of patients
      */
     int countGetPatients( String searchText );
@@ -202,47 +220,237 @@
      * Search Patient base on name and get number of result
      * 
      * @param name
+     * 
      * @return number of patients
      */
     int countGetPatientsByName( String name );
 
+    /**
+     * Register a new patient
+     * 
+     * @param patient Patient
+     * @param representativeId The id of patient who is representative
+     * @param relationshipTypeId The id of relationship type defined
+     * @param patientAttributeValues List of attribute values
+     * 
+     * @return The error code after registering patient
+     */
     int createPatient( Patient patient, Integer representativeId, Integer relationshipTypeId,
         List<PatientAttributeValue> patientAttributeValues );
 
+    /**
+     * Update information of an patient existed
+     * 
+     * @param patient Patient
+     * @param representativeId The id of representative of this patient
+     * @param relationshipTypeId The id of relationship type of this person
+     * @param valuesForSave The patient attribute values for adding
+     * @param valuesForUpdate The patient attribute values for updating
+     * @param valuesForDelete The patient attribute values for deleting
+     * 
+     */
     void updatePatient( Patient patient, Integer representativeId, Integer relationshipTypeId,
         List<PatientAttributeValue> valuesForSave, List<PatientAttributeValue> valuesForUpdate,
         Collection<PatientAttributeValue> valuesForDelete );
 
+    /**
+     * Get the number of patients who registered into an organisation unit
+     * 
+     * @param organisationUnit Organisation Unit
+     * 
+     * @return The number of patients
+     */
     int countGetPatientsByOrgUnit( OrganisationUnit organisationUnit );
 
+    /**
+     * Get the number of patients who registered into an organisation unit and
+     * enrolled into a program
+     * 
+     * @param organisationUnit Organisation Unit
+     * @param program Program
+     * 
+     * @return The number of patients
+     */
     int countGetPatientsByOrgUnitProgram( OrganisationUnit organisationUnit, Program program );
 
+    /**
+     * Cache value from String to the value type based on property
+     * 
+     * @param property Property name of patient
+     * @param value Value
+     * @param format I18nFormat
+     * 
+     * @return An object
+     */
     Object getObjectValue( String property, String value, I18nFormat format );
 
+    /**
+     * Search patients by attribute values, identifiers and/or a program which
+     * patients enrolled into
+     * 
+     * @param searchKeys The key for searching patients by attribute values,
+     *        identifiers and/or a program
+     * @param orgunit Organisation unit where patients registered
+     * @param followup Only getting patients with program risked if this
+     *        property is true. And getting patients without program risked if
+     *        its value is false
+     * @param patientAttributes The attribute values of these attribute are
+     *        displayed into result
+     * @param identifierTypes The identifiers are displayed into the result
+     * @param statusEnrollment The status of program of patients. There are
+     *        three status, includes Active enrollments only, Completed
+     *        enrollments only and Active and completed enrollments
+     * @param min
+     * @param max
+     * 
+     * @return An object
+     */
     Collection<Patient> searchPatients( List<String> searchKeys, Collection<OrganisationUnit> orgunit,
         Boolean followup, Collection<PatientAttribute> patientAttributes,
         Collection<PatientIdentifierType> identifierTypes, Integer statusEnrollment, Integer min, Integer max );
 
+    /**
+     * Get the number of patients who meet the criteria for searching
+     * 
+     * @param searchKeys The key for searching patients by attribute values,
+     *        identifiers and/or a program
+     * @param orgunit Organisation unit where patients registered
+     * @param followup Only getting patients with program risked if this
+     *        property is true. And getting patients without program risked if
+     *        its value is false
+     * @param statusEnrollment The status of program of patients. There are
+     *        three status, includes Active enrollments only, Completed
+     *        enrollments only and Active and completed enrollments
+     * 
+     * @return The number of patients
+     */
     int countSearchPatients( List<String> searchKeys, Collection<OrganisationUnit> orgunit, Boolean followup,
         Integer statusEnrollment );
 
+    /**
+     * Get phone numbers of persons who meet the criteria for searching *
+     * 
+     * @param searchKeys The key for searching patients by attribute values,
+     *        identifiers and/or a program
+     * @param orgunit Organisation unit where patients registered
+     * @param followup Only getting patients with program risked if this
+     *        property is true. And getting patients without program risked if
+     *        its value is false
+     * @param statusEnrollment The status of program of patients. There are
+     *        three status, includes Active enrollments only, Completed
+     *        enrollments only and Active and completed enrollments
+     * @parma min
+     * @param max
+     * 
+     * @return List of patient
+     */
     Collection<String> getPatientPhoneNumbers( List<String> searchKeys, Collection<OrganisationUnit> orgunit,
         Boolean followup, Integer statusEnrollment, Integer min, Integer max );
 
+    /**
+     * Get events which meet the criteria for searching
+     * 
+     * @param searchKeys The key for searching patients by attribute values,
+     *        identifiers and/or a program
+     * @param orgunit Organisation unit where patients registered
+     * @param followup Only getting patients with program risked if this
+     *        property is true. And getting patients without program risked if
+     *        its value is false
+     * @param statusEnrollment The status of program of patients. There are
+     *        three status, includes Active enrollments only, Completed
+     *        enrollments only and Active and completed enrollments
+     * @parma min
+     * @param max
+     * 
+     * @return List of patient
+     */
     List<Integer> getProgramStageInstances( List<String> searchKeys, Collection<OrganisationUnit> orgunit,
         Boolean followup, Integer statusEnrollment, Integer min, Integer max );
 
+    /**
+     * Get visit schedule of person who meet the criteria for searching
+     * 
+     * @param searchKeys The key for searching patients by attribute values,
+     *        identifiers and/or a program
+     * @param orgunit Organisation unit where patients registered
+     * @param followup Only getting patients with program risked if this
+     *        property is true. And getting patients without program risked if
+     *        its value is false
+     * @param statusEnrollment The status of program of patients. There are
+     *        three status, includes Active enrollments only, Completed
+     *        enrollments only and Active and completed enrollments
+     * @parma min
+     * @param max
+     * 
+     * @return Grid
+     */
     Grid getScheduledEventsReport( List<String> searchKeys, Collection<OrganisationUnit> orgunits, Boolean followup,
         Integer statusEnrollment, Integer min, Integer max, I18n i18n );
 
+    /**
+     * Search patients by phone number (performs partial search)
+     * 
+     * @param phoneNumber The string for searching by phone number
+     * @param min
+     * @param max
+     * 
+     * @return List of patient
+     */
     Collection<Patient> getPatientsByPhone( String phoneNumber, Integer min, Integer max );
 
+    /**
+     * Search patients who registered into a certain organisation unit by
+     * full-name
+     * 
+     * @param fullName The full name of patient
+     * @param organisationUnit Organisation Unit where patients registered
+     *        private information
+     * 
+     * @return List of patient
+     */
     Collection<Patient> getPatientByFullname( String fullName, OrganisationUnit organisationUnit );
 
+    /**
+     * Get ids of orgunits where patient registered in a certain period
+     * 
+     * @param startDate Start date
+     * @param endDate End date
+     * 
+     * @return List of patient
+     */
     Collection<Integer> getRegistrationOrgunitIds( Date startDate, Date endDate );
 
-    Grid getTrackingEventsReport( Program program, List<String> searchKeys, Collection<OrganisationUnit> orgunit,
+    /**
+     * Get events of patients who meet the criteria for searching
+     * 
+     * @param program Program. It's is used for getting identifier-types of this
+     *        program and put identifiers of patients into the result
+     * @param searchKeys The key for searching patients by attribute values,
+     *        identifiers and/or a program
+     * @param orgunit Organisation unit where patients registered
+     * @param followup Only getting patients with program risked if this
+     *        property is true. And getting patients without program risked if
+     *        its value is false
+     * @param statusEnrollment The status of program of patients. There are
+     *        three status, includes Active enrollments only, Completed
+     *        enrollments only and Active and completed enrollments
+     * @param i18n I18n
+     * 
+     * @return Grid
+     */
+    Grid getTrackingEventsReport( Program program, List<String> searchKeys, Collection<OrganisationUnit> orgunits,
         Boolean followup, Integer statusEnrollment, I18n i18n );
 
+    /**
+     * Validate patient identifiers and validation criteria by program before
+     * registering / updating information
+     * 
+     * @param patient Patient object
+     * @param program Progam which person needs to enroll. If this paramameter
+     *        is null, the system check idenfifiers of the patient
+     * 
+     * @return Error code 0 : Validation is OK 1 : The identifier is duplicated
+     *         2 : Violate validation criteria of the program
+     */
     int validatePatient( Patient patient, Program program );
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java	2013-10-23 12:24:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java	2013-10-28 07:12:28 +0000
@@ -48,50 +48,260 @@
 
     final int MAX_RESULTS = 50000;
 
+    /**
+     * Search patients by birth date
+     * 
+     * @param birthDate Data of birth
+     * 
+     * @return List of patient
+     */
     Collection<Patient> getByBirthDate( Date birthDate );
 
+    /**
+     * Search patients by full name (performs partial search )
+     * 
+     * @param name Full name of patients
+     * @param min
+     * @param max
+     * 
+     * @return List of patients
+     */
     Collection<Patient> getByNames( String name, Integer min, Integer max );
 
+    /**
+     * Search patients by full name, date of birth and gender
+     * 
+     * @param name Full name
+     * @param birthdate Date of birth
+     * 
+     * @return List of patients
+     */
     Collection<Patient> get( String name, Date birthdate, String gender );
 
+    /**
+     * Search patients who registered in a certain organisation unit
+     * 
+     * @param organisationUnit Organisation unit where patients registered
+     * @param min
+     * @param max
+     * 
+     * @return List of patients
+     */
     Collection<Patient> getByOrgUnit( OrganisationUnit organisationUnit, Integer min, Integer max );
 
+    /**
+     * Search patients who registered in a certain organisation unit by full name
+     * (performs partial search)
+     * 
+     * @param organisationUnit Organisation unit where patients registered
+     * @param nameLike A string for searching by full name
+     * @param min
+     * @param max
+     * 
+     * @return List of patient
+     */
     Collection<Patient> getByOrgUnitAndNameLike( OrganisationUnit organisationUnit, String nameLike, Integer min,
         Integer max );
 
+    /**
+     * Search patients registered into a certain organisation unit and enrolled
+     * into a program with active status
+     * 
+     * @param organisationUnit Organisation unit where patients registered
+     * @param program Program. It's is used for getting identifier-types of this
+     *        program and put identifiers of patients into the result
+     * @param min
+     * @param max
+     * 
+     * @return List of patients
+     */
     Collection<Patient> getByOrgUnitProgram( OrganisationUnit organisationUnit, Program program, Integer min,
         Integer max );
 
+    /**
+     * Search patient who has the same representative
+     * 
+     * @param patient Representative
+     * 
+     * @return List of patients
+     */
     Collection<Patient> getRepresentatives( Patient patient );
 
+    /**
+     * Search the number of patients who registered into an organisation unit
+     * 
+     * @param organisationUnit Organisation unit
+     * 
+     * @return The number of patients
+     */
     int countListPatientByOrgunit( OrganisationUnit organisationUnit );
 
+    /**
+     * Get the number of patients by full name (performs partial search )
+     * 
+     * @param name A string for searching by full name
+     * 
+     * @return The number of patients
+     */
     int countGetPatientsByName( String name );
 
+    /**
+     * Get the number of patients who registered into a certain organisation
+     * unit and enrolled into a program with active status
+     * 
+     * @param organisationUnit Organisation unit where patients registered
+     * @param program Program. It's is used for getting identifier-types of this
+     *        program and put identifiers of patients into the result
+     * 
+     * @return The number of patients
+     */
     int countGetPatientsByOrgUnitProgram( OrganisationUnit organisationUnit, Program program );
 
+    /**
+     * Get number of patients who meet the criteria for searching
+     * 
+     * @param searchKeys The key for searching patients by attribute values,
+     *        identifiers and/or a program
+     * @param orgunit Organisation unit where patients registered
+     * @param followup Only getting patients with program risked if this
+     *        property is true. And getting patients without program risked if
+     *        its value is false
+     * @param statusEnrollment The status of program of patients. There are
+     *        three status, includes Active enrollments only, Completed
+     *        enrollments only and Active and completed enrollments
+     * 
+     * @return The number of patients
+     */
     int countSearch( List<String> searchKeys, Collection<OrganisationUnit> orgunit, Boolean followup,
         Integer statusEnrollment );
 
+    /**
+     * Search patients by phone number (performs partial search)
+     * 
+     * @param phoneNumber The string for searching by phone number
+     * @param min
+     * @param max
+     * 
+     * @return List of patient
+     */
     Collection<Patient> getByPhoneNumber( String phoneNumber, Integer min, Integer max );
 
+    /**
+     * Search patients who registered into a certain organisation unit by
+     * full-name
+     * 
+     * @param fullName The full name of patient
+     * @param organisationUnit Organisation Unit where patients registered
+     *        private information
+     * 
+     * @return List of patient
+     */
     Collection<Patient> getByFullName( String name, OrganisationUnit organisationUnit );
 
+    /**
+     * Retrieve ids of orgunits where patient registered in a certain period
+     * 
+     * @param startDate Start date
+     * @param endDate End date
+     * 
+     * @return List of patient
+     */
     Collection<Integer> getRegistrationOrgunitIds( Date startDate, Date endDate );
 
+    /**
+     * Search events of patients who meet the criteria for searching
+     * 
+     * @param searchKeys The key for searching patients by attribute values,
+     *        identifiers and/or a program
+     * @param orgunit Organisation unit where patients registered
+     * @param followup Only getting patients with program risked if this
+     *        property is true. And getting patients without program risked if
+     *        its value is false
+     * @param patientAttributes The attribute values of these attribute are
+     *        displayed into result
+     * @param identifierTypes The identifiers are displayed into the result
+     * @param statusEnrollment The status of program of patients. There are
+     *        three status, includes Active enrollments only, Completed
+     *        enrollments only and Active and completed enrollments
+     * @param min
+     * @param max
+     * 
+     * @return List of patients
+     */
     Collection<Patient> search( List<String> searchKeys, Collection<OrganisationUnit> orgunit, Boolean followup,
         Collection<PatientAttribute> patientAttributes, Collection<PatientIdentifierType> identifierTypes,
         Integer statusEnrollment, Integer min, Integer max );
 
+    /**
+     * Search events which meet the criteria for searching
+     * 
+     * @param searchKeys The key for searching patients by attribute values,
+     *        identifiers and/or a program
+     * @param orgunit Organisation unit where patients registered
+     * @param followup Only getting patients with program risked if this
+     *        property is true. And getting patients without program risked if
+     *        its value is false
+     * @param patientAttributes The attribute values of these attribute are
+     *        displayed into result
+     * @param identifierTypes The identifiers are displayed into the result
+     * @param statusEnrollment The status of program of patients. There are
+     *        three status, includes Active enrollments only, Completed
+     *        enrollments only and Active and completed enrollments
+     * @param min
+     * @param max
+     * 
+     * @return List of patients
+     */
     List<Integer> getProgramStageInstances( List<String> searchKeys, Collection<OrganisationUnit> orgunits,
         Boolean followup, Collection<PatientAttribute> patientAttributes,
         Collection<PatientIdentifierType> identifierTypes, Integer statusEnrollment, Integer min, Integer max );
 
+    /**
+     * Search patients who enrolled into a program with active status
+     * 
+     * @param program Program
+     * @param min
+     * @param max
+     * 
+     *        return List of patients
+     */
     Collection<Patient> getByProgram( Program program, Integer min, Integer max );
 
+    /**
+     * Search events of patients who meet the criteria for searching
+     * 
+     * @param grid Grid with headers
+     * @param searchKeys The key for searching patients by attribute values,
+     *        identifiers and/or a program
+     * @param orgunit Organisation unit where patients registered
+     * @param followup Only getting patients with program risked if this
+     *        property is true. And getting patients without program risked if
+     *        its value is false
+     * @param patientAttributes The attribute values of these attribute are
+     *        displayed into result
+     * @param identifierTypes The identifiers are displayed into the result
+     * @param statusEnrollment The status of program of patients. There are
+     *        three status, includes Active enrollments only, Completed
+     *        enrollments only and Active and completed enrollments
+     * @param min
+     * @param max
+     * 
+     * @return Grid
+     */
     Grid getPatientEventReport( Grid grid, List<String> searchKeys, Collection<OrganisationUnit> orgunit,
         Boolean followup, Collection<PatientAttribute> patientAttributes,
         Collection<PatientIdentifierType> identifierTypes, Integer statusEnrollment, Integer min, Integer max );
 
+    /**
+     * Validate patient identifiers and validation criteria by program before
+     * registering / updating information
+     * 
+     * @param patient Patient object
+     * @param program Progam which person needs to enroll. If this paramameter
+     *        is null, the system check idenfifiers of the patient
+     * 
+     * @return Error code 0 : Validation is OK 1 : The identifier is duplicated
+     *         2 : Violate validation criteria of the program
+     */
     int validate( Patient patient, Program program );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java	2013-10-25 05:00:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java	2013-10-28 07:12:28 +0000
@@ -29,7 +29,6 @@
  */
 
 import java.util.Collection;
-import java.util.Date;
 
 import org.hibernate.criterion.Projections;
 import org.hibernate.criterion.Restrictions;
@@ -39,10 +38,6 @@
 import org.hisp.dhis.patient.PatientIdentifier;
 import org.hisp.dhis.patient.PatientIdentifierStore;
 import org.hisp.dhis.patient.PatientIdentifierType;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.system.util.DateUtils;
 
 /**
  * @author Abyot Asalefew Gizaw

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-10-24 08:31:35 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-10-28 07:12:28 +0000
@@ -312,7 +312,7 @@
         Collection<PatientIdentifierType> identifierTypes, Integer statusEnrollment, Integer min, Integer max )
     {
         String sql = searchPatientSql( false, searchKeys, orgunits, followup, patientAttributes, identifierTypes,
-            statusEnrollment, null, null );
+            statusEnrollment, min, max );
 
         SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );