← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12823: Add comments for service layer

 

------------------------------------------------------------
revno: 12823
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-10-29 12:04:36 +0700
message:
  Add comments for service layer
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientRegistrationFormService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientRegistrationFormStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientReminderService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.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/PatientIdentifierService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierService.java	2013-10-28 07:12:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierService.java	2013-10-29 05:04:36 +0000
@@ -52,6 +52,8 @@
      * Retrieve patient identifiers of patient
      * 
      * @param patient Patient
+     * 
+     * @return PatientIdentifier list
      */
     PatientIdentifier getPatientIdentifier( Patient patient );
 
@@ -59,6 +61,8 @@
      * Retrieve patient identifiers by type
      * 
      * @param identifierType PatientIdentifierType
+     * 
+     * @return PatientIdentifier list
      */
     Collection<PatientIdentifier> getPatientIdentifiersByType( PatientIdentifierType identifierType );
 
@@ -113,7 +117,8 @@
     /**
      * 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.
+     * a list instead. 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
@@ -128,7 +133,7 @@
      * @param identifierType PatientIdentifierType
      * @param value Identifier value
      */
-    Patient getPatient( PatientIdentifierType identifierType, String value );
+    Patient getPatient( PatientIdentifierType identifierType, String identifier );
 
     /**
      * Retrieve patients based on identifier value with limit result (performs
@@ -157,6 +162,8 @@
      * 
      * @param identifierTypes PatientIdentifierType collection
      * @param patient Patient
+     * 
+     * @return PatientIdentifier list
      */
     Collection<PatientIdentifier> getPatientIdentifiers( Collection<PatientIdentifierType> identifierTypes,
         Patient patient );

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierStore.java	2013-10-25 05:00:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierStore.java	2013-10-29 05:04:36 +0000
@@ -31,7 +31,6 @@
 import java.util.Collection;
 
 import org.hisp.dhis.common.GenericIdentifiableObjectStore;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
 
 /**
  * @author Abyot Asalefew Gizaw
@@ -42,34 +41,122 @@
 {
     String ID = PatientIdentifierStore.class.getName();
 
+    /**
+     * Retrieve patient identifiers of a patient
+     * 
+     * @param patient Patient
+     * 
+     * @return PatientIdentifier list
+     */
     PatientIdentifier get( Patient patient );
 
-    PatientIdentifier get( String identifier, OrganisationUnit organisationUnit );
-
+    /**
+     * Retrieve first patient based on type and identifier
+     * 
+     * @param type PatientIdentifierType
+     * @param identifier Identifier of patient
+     * 
+     * @return PatientIdentifier
+     */
     PatientIdentifier get( PatientIdentifierType type, String identifier );
 
-    /*
-     * We need this since we have allowed identifiers with duplicate values in
-     * the past. This returns a list instead.
+    /**
+     * 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 );
 
+    /**
+     * Search patient identifiers by identifier (performs partial search )
+     * 
+     * @param identifier A string for searching by identifier
+     * 
+     * @return PatientIdentifier list
+     */
     Collection<PatientIdentifier> getByIdentifier( String identifier );
 
+    /**
+     * Retrieve patient identifiers by type
+     * 
+     * @param identifierType PatientIdentifierType
+     * 
+     * @return PatientIdentifier list
+     */
     Collection<PatientIdentifier> getByType( PatientIdentifierType identifierType );
 
+    /**
+     * 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 );
 
-    Patient getPatient( PatientIdentifierType identifierType, String value );
+    /**
+     * Retrieve a patient based on identifier type and a identifier value
+     * 
+     * @param identifierType PatientIdentifierType
+     * @param value Identifier value
+     */
+    Patient getPatient( PatientIdentifierType identifierType, String identifier );
 
+    /**
+     * 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
+     * 
+     * @result PatientIdentifier list
+     */
     Collection<PatientIdentifier> get( Collection<PatientIdentifierType> identifierTypes, Patient patient );
 
 }

=== 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-09-27 10:43:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java	2013-10-29 05:04:36 +0000
@@ -52,7 +52,22 @@
 
     PatientIdentifierType getPatientIdentifierTypeByUid( String uid );
 
+    /**
+     * Retrieve patient identifer types based on mandatory option
+     * 
+     * @param mandatory True/False value
+     * 
+     * @return PatientIdentifierType list
+     */
     Collection<PatientIdentifierType> getPatientIdentifierTypes( boolean mandatory );
 
+    /**
+     * Retrieve patient identifer types which are displayed in person list
+     * instead of full name of person or not
+     * 
+     * @param personDisplayName True/False value
+     * 
+     * @return PatientIdentifierType list
+     */
     Collection<PatientIdentifierType> getDisplayedPatientIdentifierTypes( boolean personDisplayName );
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java	2013-10-29 05:04:36 +0000
@@ -35,7 +35,22 @@
 public interface PatientIdentifierTypeStore
     extends GenericNameableObjectStore<PatientIdentifierType>
 {
+    /**
+     * Retrieve patient identifer types based on mandatory option
+     * 
+     * @param mandatory True/False value
+     * 
+     * @return PatientIdentifierType list
+     */
     Collection<PatientIdentifierType> get( boolean mandatory );
-    
+
+    /**
+     * Retrieve patient identifer types which are displayed in person list
+     * instead of full name of person or not
+     * 
+     * @param personDisplayName True/False value
+     * 
+     * @return PatientIdentifierType list
+     */
     Collection<PatientIdentifierType> getByDisplayed( boolean personDisplayName );
 }

=== 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-14 02:42:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientRegistrationFormService.java	2013-10-29 05:04:36 +0000
@@ -79,10 +79,36 @@
 
     Collection<PatientRegistrationForm> getAllPatientRegistrationForms();
 
+    /**
+     * Get custom registration form of a program
+     * 
+     * @param program Program
+     * 
+     * @return PatientRegistrationForm
+     */
     PatientRegistrationForm getPatientRegistrationForm( Program program );
 
+    /**
+     * Get custom registration form which doesn't belong to any program
+     * 
+     * @return PatientRegistrationForm 
+     */
     PatientRegistrationForm getCommonPatientRegistrationForm();
 
+    /**
+     * Prepares the custom registration by injecting required javascripts
+     * and drop down lists.
+     * 
+     * @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
+     * @param programInstance Program-instance of the patient
+     * @param i18n the i18n object
+     * @param format the I18nFormat object
+     * 
+     * @return HTML code for the form.
+     */
     String prepareDataEntryFormForAdd( String htmlCode, Program program, Collection<User> healthWorkers, Patient patient,
         ProgramInstance programInstance, I18n i18n, I18nFormat format );
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientRegistrationFormStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientRegistrationFormStore.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientRegistrationFormStore.java	2013-10-29 05:04:36 +0000
@@ -41,7 +41,19 @@
 {
     String ID = PatientRegistrationFormStore.class.getName();
 
+    /**
+     * Get custom registration form of a program
+     * 
+     * @param program Program
+     * 
+     * @return PatientRegistrationForm
+     */
     PatientRegistrationForm get( Program program );
-    
+
+    /**
+     * Get custom registration form which doesn't belong to any program
+     * 
+     * @return PatientRegistrationForm
+     */
     PatientRegistrationForm getCommonForm();
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientReminderService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientReminderService.java	2013-09-10 04:51:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientReminderService.java	2013-10-29 05:04:36 +0000
@@ -42,12 +42,51 @@
  */
 public interface PatientReminderService
 {
+    /**
+     * Get message for sending to a patient from program-instance template
+     * defined
+     * 
+     * @param patientReminder PatientReminder object
+     * @param programInstance ProgramInstance
+     * @param format I18nFormat object
+     * 
+     * @return A message for an program instance.
+     */
     String getMessageFromTemplate( PatientReminder patientReminder, ProgramInstance programInstance, I18nFormat format );
 
+    /**
+     * Get message for sending to a patient from program-stage-instance template
+     * defined
+     * 
+     * @param patientReminder PatientReminder object
+     * @param programStageInstance ProgramStageInstance
+     * @param format I18nFormat object
+     * 
+     * @return A message for an program instance.
+     */
     String getMessageFromTemplate( PatientReminder patientReminder, ProgramStageInstance programStageInstance,
         I18nFormat format );
 
+    /**
+     * Retrieve the phone numbers for sending sms based on a template defined
+     * 
+     * @param patientReminder PatientReminder
+     * @param patient Patient
+     * 
+     * @return The list of the phone numbers ( patient phone numbers, orgunit
+     *         phone numbers, phone numbers of DHIS users at the orgunit OR
+     *         phone numbers of DHIS users in a user group.
+     */
     Set<String> getPhonenumbers( PatientReminder patientReminder, Patient patient );
 
+    /**
+     * Retrieve DHIS users from a template which is defined to send messages to
+     * DHIS users
+     * 
+     * @param patientReminder PatientReminder
+     * @param patient Patient
+     * 
+     * @return The list of DHIS users
+     */
     Set<User> getUsers( PatientReminder patientReminder, Patient patient );
 }

=== 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-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueService.java	2013-10-29 05:04:36 +0000
@@ -63,18 +63,66 @@
 
     Collection<PatientAttributeValue> getAllPatientAttributeValues();
 
+    /**
+     * Retrieve PatientAttributeValues of many patients and put them into a Map
+     * Object with key as the ids of patients and values as a
+     * PatientAttributeValue list of each patient
+     * 
+     * @param patients A patient list
+     * 
+     * @return Map<PatientID, PatientAttributeValue list>
+     */
     Map<Integer, Collection<PatientAttributeValue>> getPatientAttributeValueMapForPatients( Collection<Patient> patients );
-    
-    Map<Integer, PatientAttributeValue> getPatientAttributeValueMapForPatients( Collection<Patient> patients, PatientAttribute patientAttribute );
-    
-    Collection<PatientAttributeValue> searchPatientAttributeValue( PatientAttribute patientAttribute, String searchText );   
-
+
+    /**
+     * Retrieve PatientAttributeValues of many patients on a PatientAttribute
+     * and put them into a Map Object with key as the ids of patients and values
+     * as a PatientAttributeValue list of each patient
+     * 
+     * @param patients A patient list
+     * @param patientAttribute PatientAttribute
+     * 
+     * @return Map<Patient ID, PatientAttributeValue>
+     */
+    Map<Integer, PatientAttributeValue> getPatientAttributeValueMapForPatients( Collection<Patient> patients,
+        PatientAttribute patientAttribute );
+
+    /**
+     * 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<PatientAttributeValue> searchPatientAttributeValue( PatientAttribute patientAttribute, String searchText );
+
+    /**
+     * Remove all attribute values of destination patient and copy attribute
+     * values of source patient to destination patient
+     * 
+     * @param source Source patient
+     * @param destination Destination patient
+     */
     void copyPatientAttributeValues( Patient source, Patient destination );
-    
-    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<Patient> getPatient( PatientAttribute attribute, String value );
-    
-    void updatePatientAttributeValues( PatientAttributeOption patientAttributeOption);
-    
+
+    /**
+     * 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 );
+
 }

=== 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-28 07:12:28 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java	2013-10-29 05:04:36 +0000
@@ -33,7 +33,6 @@
 import org.hibernate.criterion.Projections;
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientIdentifier;
 import org.hisp.dhis.patient.PatientIdentifierStore;
@@ -54,13 +53,7 @@
     {
         return (PatientIdentifier) getCriteria( Restrictions.eq( "patient", patient ) ).uniqueResult();
     }
-
-    public PatientIdentifier get( String identifier, OrganisationUnit organisationUnit )
-    {
-        return (PatientIdentifier) getCriteria( Restrictions.eq( "identifier", identifier ),
-            Restrictions.eq( "organisationUnit", organisationUnit ) ).uniqueResult();
-    }
-
+    
     public PatientIdentifier get( PatientIdentifierType type, String identifier )
     {
         return (PatientIdentifier) getCriteria( Restrictions.eq( "identifierType", type ),