← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3223: Clean up code into dhis-web-maintenance-patient.

 

------------------------------------------------------------
revno: 3223
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-03-31 08:55:06 +0700
message:
  Clean up code into dhis-web-maintenance-patient.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionStore.java
  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/DefaultPatientAttributeOptionService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierTypeService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientMobileSettingService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeOptionStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeStore.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/HibernatePatientIdentifierTypeStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientMobileSettingStore.java
  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/startup/ProgramAttributePopulator.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/DefaultPatientAttributeValueService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueDeletionHandler.java
  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/patientdatavalue/DefaultPatientDataValueService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/aggregation/DefaultPatientDataValueAggregationEngine.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/aggregation/PatientDataValueAggregationEngine.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramAttributeOptionService.java
  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/DefaultProgramService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageDataElementService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageDataElementValidationService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramStageDataElementDeletionHandler.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramAttributeOptionStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramAttributeStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageDataElementStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageDataElementValidationStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/nextvisit/DefaultNextVisitGenerator.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/nextvisit/NextVisitGenerator.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/programattributevalue/DefaultProgramAttributeValueService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/DefaultRelationshipService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/DefaultRelationshipTypeService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/hibernate/HibernateRelationshipStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/hibernate/HibernateRelationshipTypeStore.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-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java	2011-03-27 15:39:28 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java	2011-03-31 01:55:06 +0000
@@ -1,8 +1,32 @@
-/**
- * 
- */
 package org.hisp.dhis.activityplan;
 
+/*
+ * Copyright (c) 2004-2010, 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.ArrayList;
 import java.util.Calendar;
 import java.util.Collection;
@@ -65,25 +89,15 @@
     }
 
     // -------------------------------------------------------------------------
-    // ActivityPlan
+    // Activity Plan
     // -------------------------------------------------------------------------
 
     @Override
     public Collection<Activity> getActivitiesByBeneficiary( Patient beneficiary )
     {
-
-        // ---------------------------------------------------------------------
-        // Get any active program for the beneficiary ( completed = false )
-        // ---------------------------------------------------------------------
-
         Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( beneficiary, false );
-
-        // ---------------------------------------------------------------------
-        // Get next activities for the active programInstances
-        // ---------------------------------------------------------------------
-
+        
         return getActivties( programInstances );
-
     }
 
     public Collection<Activity> getCurrentActivitiesByProvider( OrganisationUnit organisationUnit )
@@ -351,7 +365,6 @@
         }
 
         return activities;
-
     }
 
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2011-03-24 03:34:53 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2011-03-31 01:55:06 +0000
@@ -62,7 +62,6 @@
 
 /**
  * @author Chau Thu Tran
- * 
  * @version DefaultPatientAggregationExpressionService.java Nov 17, 2010
  *          11:16:37 AM
  */
@@ -118,7 +117,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // Implementation Method
+    // Implementation Methods
     // -------------------------------------------------------------------------
 
     @Override
@@ -174,7 +173,7 @@
         Period period )
     {
         String sql = createSQL( aggregationCondition, orgunit, period );
-        
+
         Collection<Integer> patientIds = aggregationConditionStore.executeSQL( sql );
 
         return calValue( patientIds, aggregationCondition.getOperator() );
@@ -212,7 +211,7 @@
         Collection<Patient> result = new HashSet<Patient>();
 
         String sql = createSQL( aggregationCondition, orgunit, period );
-        
+
         Collection<Integer> patientIds = aggregationConditionStore.executeSQL( sql );
 
         for ( Integer patientId : patientIds )
@@ -442,19 +441,35 @@
         int orgunitId, String startDate, String endDate )
     {
         return "SELECT distinct(pi.patientid) FROM programstageinstance as psi "
-                + "INNER JOIN programstage as ps ON psi.programstageid = ps.programstageid "
-                + "INNER JOIN programinstance as pi ON pi.programinstanceid = psi.programinstanceid "
-                + "LEFT OUTER JOIN patientdatavalue as pd ON psi.programstageinstanceid = pd.programstageinstanceid "
-                + "WHERE psi.executionDate >= '" + startDate + "' AND psi.executionDate <= '" + endDate + "' "
-                + "AND pd.value IS NULL AND pi.patientid NOT IN  ( "
-                    + "SELECT distinct(pi.patientid) FROM programstageinstance as psi "
-                    + "INNER JOIN programstage as ps ON psi.programstageid = ps.programstageid "
-                    + "INNER JOIN programinstance as pi ON pi.programinstanceid = psi.programinstanceid "
-                    + "INNER JOIN patientdatavalue as pd ON psi.programstageinstanceid = pd.programstageinstanceid "
-                    + "WHERE pd.organisationunitid = " + orgunitId + " AND ps.programstageid = " + programStageId + " "
-                    + "AND psi.executionDate >= '" + startDate + "' AND psi.executionDate <= '" + endDate + "' "
-                    + "AND pd.dataelementid = " + dataElementId + " " + "AND pd.categoryoptioncomboid = " + optionComboId
-                + "  ) ";
+            + "INNER JOIN programstage as ps ON psi.programstageid = ps.programstageid "
+            + "INNER JOIN programinstance as pi ON pi.programinstanceid = psi.programinstanceid "
+            + "LEFT OUTER JOIN patientdatavalue as pd ON psi.programstageinstanceid = pd.programstageinstanceid "
+            + "WHERE psi.executionDate >= '"
+            + startDate
+            + "' AND psi.executionDate <= '"
+            + endDate
+            + "' "
+            + "AND pd.value IS NULL AND pi.patientid NOT IN  ( "
+            + "SELECT distinct(pi.patientid) FROM programstageinstance as psi "
+            + "INNER JOIN programstage as ps ON psi.programstageid = ps.programstageid "
+            + "INNER JOIN programinstance as pi ON pi.programinstanceid = psi.programinstanceid "
+            + "INNER JOIN patientdatavalue as pd ON psi.programstageinstanceid = pd.programstageinstanceid "
+            + "WHERE pd.organisationunitid = "
+            + orgunitId
+            + " AND ps.programstageid = "
+            + programStageId
+            + " "
+            + "AND psi.executionDate >= '"
+            + startDate
+            + "' AND psi.executionDate <= '"
+            + endDate
+            + "' "
+            + "AND pd.dataelementid = "
+            + dataElementId
+            + " "
+            + "AND pd.categoryoptioncomboid = "
+            + optionComboId
+            + "  ) ";
 
     }
 
@@ -534,12 +549,9 @@
     public double calValue( Collection<Integer> patientIds, String operator )
     {
         if ( patientIds == null )
+        {
             return 0.0;
-
-        // if ( operator.equalsIgnoreCase( AGGRERATION_SUM ) )
-        // {
-        // double value = 0.0;
-        // }
+        }
 
         return patientIds.size();
     }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionStore.java	2010-11-25 22:22:10 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionStore.java	2011-03-31 01:55:06 +0000
@@ -66,7 +66,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // Implementation Method
+    // Implementation Methods
     // -------------------------------------------------------------------------
 
     @Override

=== 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	2010-01-29 03:08:45 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeGroupService.java	2011-03-31 01:55:06 +0000
@@ -52,7 +52,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // PatientAttribute implementation
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     public int savePatientAttributeGroup( PatientAttributeGroup patientAttributeGroup )

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeOptionService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeOptionService.java	2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeOptionService.java	2011-03-31 01:55:06 +0000
@@ -50,7 +50,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // PatientAttribute implementation
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     public void addPatientAttributeOption( PatientAttributeOption option )

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java	2010-11-12 10:28:30 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java	2011-03-31 01:55:06 +0000
@@ -50,7 +50,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // PatientAttribute implementation
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     public void deletePatientAttribute( PatientAttribute patientAttribute )

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierTypeService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierTypeService.java	2010-12-04 00:17:59 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientIdentifierTypeService.java	2011-03-31 01:55:06 +0000
@@ -50,7 +50,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // PatientIdentifierType implementation
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     public void deletePatientIdentifierType( PatientIdentifierType patientIdentifierType )

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientMobileSettingService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientMobileSettingService.java	2010-11-26 11:04:12 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientMobileSettingService.java	2011-03-31 01:55:06 +0000
@@ -35,6 +35,9 @@
 public class DefaultPatientMobileSettingService
     implements PatientMobileSettingService
 {
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
 
     private PatientMobileSettingStore patientMobileSettingStore;
 
@@ -43,6 +46,10 @@
         this.patientMobileSettingStore = patientMobileSettingStore;
     }
 
+    // -------------------------------------------------------------------------
+    // Implementation methods
+    // -------------------------------------------------------------------------
+
     @Override
     public int savePatientMobileSetting( PatientMobileSetting setting )
     {

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2010-12-29 20:15:01 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2011-03-31 01:55:06 +0000
@@ -118,7 +118,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // Patient
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     @Override
@@ -455,7 +455,7 @@
             patientAttributeValueService.deletePatientAttributeValue( av );
         }
 
-        if ( shouldSaveRepresentativeInformation( patient, representativeId ))
+        if ( shouldSaveRepresentativeInformation( patient, representativeId ) )
         {
             Patient representative = patientStore.get( representativeId );
 
@@ -482,12 +482,12 @@
 
     private boolean shouldSaveRepresentativeInformation( Patient patient, Integer representativeId )
     {
-        if (!patient.isUnderAge()) 
-            return false;
-
-        if (representativeId == null)
-            return false;
-        
+        if ( !patient.isUnderAge() )
+            return false;
+
+        if ( representativeId == null )
+            return false;
+
         return patient.getRepresentative() == null || !patient.getRepresentative().getId().equals( representativeId );
     }
 
@@ -532,7 +532,7 @@
         {
             ex.printStackTrace();
         }
-        
+
         return null;
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java	2010-10-20 13:34:22 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java	2011-03-31 01:55:06 +0000
@@ -4,8 +4,9 @@
 import org.hisp.dhis.source.Source;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 
-public class PatientDeletionHandler extends DeletionHandler
-{ 
+public class PatientDeletionHandler
+    extends DeletionHandler
+{
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -26,12 +27,11 @@
     {
         return Patient.class.getSimpleName();
     }
-    
+
     @Override
     public void deleteSource( Source source )
     {
-        for ( Patient patient : patientService
-            .getPatients( (OrganisationUnit) source ) )
+        for ( Patient patient : patientService.getPatients( (OrganisationUnit) source ) )
         {
             patientService.deletePatient( patient );
         }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeOptionStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeOptionStore.java	2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeOptionStore.java	2011-03-31 01:55:06 +0000
@@ -36,25 +36,23 @@
 
 /**
  * @author Viet
- *
+ * 
  * @version $Id$
  */
 public class HibernatePatientAttributeOptionStore
     extends HibernateGenericStore<PatientAttributeOption>
     implements PatientAttributeOptionStore
 {
-
     public PatientAttributeOption get( PatientAttribute patientAttribute, String name )
     {
-        return (PatientAttributeOption) getCriteria(
-            Restrictions.eq( "name", name ),
-            Restrictions.eq( "patientAttribute" , patientAttribute ) ).uniqueResult();
+        return (PatientAttributeOption) getCriteria( Restrictions.eq( "name", name ),
+            Restrictions.eq( "patientAttribute", patientAttribute ) ).uniqueResult();
     }
 
     @SuppressWarnings( "unchecked" )
     public Collection<PatientAttributeOption> get( PatientAttribute patientAttribute )
     {
-        return getCriteria( Restrictions.eq( "patientAttribute" , patientAttribute ) ).list();
+        return getCriteria( Restrictions.eq( "patientAttribute", patientAttribute ) ).list();
     }
 
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeStore.java	2010-11-12 10:28:30 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeStore.java	2011-03-31 01:55:06 +0000
@@ -57,18 +57,19 @@
     @SuppressWarnings( "unchecked" )
     public Collection<PatientAttribute> getOptionalPatientAttributesWithoutGroup()
     {
-        return getCriteria( Restrictions.isNull( "patientAttributeGroup" ) ).add(
-            Restrictions.eq( "mandatory", false ) ).list();
+        return getCriteria( Restrictions.isNull( "patientAttributeGroup" ) )
+            .add( Restrictions.eq( "mandatory", false ) ).list();
     }
-    
+
     @SuppressWarnings( "unchecked" )
     public Collection<PatientAttribute> getPatientAttributesNotGroup()
     {
         return getCriteria( Restrictions.isNull( "patientAttributeGroup" ) ).list();
     }
-    
-    public PatientAttribute getByGroupBy( boolean groupBy ){
-        return (PatientAttribute)getCriteria( Restrictions.eq( "groupBy", groupBy ) ).uniqueResult();
+
+    public PatientAttribute getByGroupBy( boolean groupBy )
+    {
+        return (PatientAttribute) getCriteria( Restrictions.eq( "groupBy", groupBy ) ).uniqueResult();
     }
-    
+
 }

=== 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	2010-10-20 13:34:22 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java	2011-03-31 01:55:06 +0000
@@ -45,25 +45,25 @@
 public class HibernatePatientIdentifierStore
     extends HibernateGenericStore<PatientIdentifier>
     implements PatientIdentifierStore
-{   
+{
     public PatientIdentifier get( Patient patient )
     {
         return (PatientIdentifier) getCriteria( Restrictions.eq( "patient", patient ),
             Restrictions.eq( "preferred", true ) ).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 ),
             Restrictions.eq( "identifier", identifier ) ).uniqueResult();
     }
-    
+
     @SuppressWarnings( "unchecked" )
     public Collection<PatientIdentifier> getByIdentifier( String identifier )
     {
@@ -81,36 +81,38 @@
         return (PatientIdentifier) getCriteria( Restrictions.eq( "identifier", identifier ),
             Restrictions.eq( "patient", patient ) ).uniqueResult();
     }
-    
+
     public PatientIdentifier getPatientIdentifier( PatientIdentifierType identifierType, Patient patient )
     {
         return (PatientIdentifier) getCriteria( Restrictions.eq( "identifierType.id", identifierType.getId() ),
             Restrictions.eq( "patient", patient ) ).uniqueResult();
     }
-    
+
     @SuppressWarnings( "unchecked" )
     public Collection<PatientIdentifier> getPatientIdentifiers( Patient patient )
     {
         return (Collection<PatientIdentifier>) getCriteria( Restrictions.eq( "patient", patient ) ).list();
     }
-    
+
     public Patient getPatient( PatientIdentifierType idenType, String value )
     {
-        return (Patient) getCriteria( Restrictions.and( Restrictions.eq( "identifierType", idenType ),
-            Restrictions.eq( "identifier", value ) ) )
+        return (Patient) getCriteria(
+            Restrictions.and( Restrictions.eq( "identifierType", idenType ), Restrictions.eq( "identifier", value ) ) )
             .setProjection( Projections.property( "patient" ) ).uniqueResult();
     }
-    
+
     @SuppressWarnings( "unchecked" )
     public Collection<Patient> getPatientsByIdentifier( String identifier, int min, int max )
     {
-        return getCriteria( Restrictions.ilike( "identifier", "%" + identifier + "%" ) ).setProjection( Projections.property( "patient" ) ).setFirstResult( min ).setMaxResults( max ).list();
+        return getCriteria( Restrictions.ilike( "identifier", "%" + identifier + "%" ) ).setProjection(
+            Projections.property( "patient" ) ).setFirstResult( min ).setMaxResults( max ).list();
     }
 
     public int countGetPatientsByIdentifier( String identifier )
     {
-    	 Number rs =   (Number)getCriteria( Restrictions.ilike( "identifier", "%" + identifier + "%" ) ).setProjection( Projections.rowCount() ).uniqueResult();
-         return rs != null ? rs.intValue() : 0;
+        Number rs = (Number) getCriteria( Restrictions.ilike( "identifier", "%" + identifier + "%" ) ).setProjection(
+            Projections.rowCount() ).uniqueResult();
+        return rs != null ? rs.intValue() : 0;
     }
 
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierTypeStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierTypeStore.java	2010-12-01 09:16:58 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierTypeStore.java	2011-03-31 01:55:06 +0000
@@ -1,5 +1,32 @@
 package org.hisp.dhis.patient.hibernate;
 
+/*
+ * Copyright (c) 2004-2010, 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.Restrictions;
@@ -11,7 +38,6 @@
     extends HibernateGenericStore<PatientIdentifierType>
     implements PatientIdentifierTypeStore
 {
-
     @SuppressWarnings( "unchecked" )
     public Collection<PatientIdentifierType> get( boolean mandatory )
     {

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientMobileSettingStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientMobileSettingStore.java	2010-11-22 10:23:44 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientMobileSettingStore.java	2011-03-31 01:55:06 +0000
@@ -1,5 +1,32 @@
 package org.hisp.dhis.patient.hibernate;
 
+/*
+ * Copyright (c) 2004-2010, 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.Criteria;
@@ -14,7 +41,6 @@
     extends HibernateGenericStore<PatientMobileSetting>
     implements PatientMobileSettingStore
 {
-
     @SuppressWarnings( "unchecked" )
     public Collection<PatientMobileSetting> getCurrentSetting()
     {
@@ -23,8 +49,8 @@
         Criteria criteria = session.createCriteria( PatientMobileSetting.class );
         criteria.setCacheable( true );
 
-        System.out.println(criteria.list().size());
-        
+        System.out.println( criteria.list().size() );
+
         return criteria.list();
     }
 }

=== 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	2011-01-11 01:56:03 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2011-03-31 01:55:06 +0000
@@ -77,12 +77,11 @@
     {
         this.statementManager = statementManager;
     }
-    
+
     // -------------------------------------------------------------------------
     // Implementation methods
     // -------------------------------------------------------------------------
 
-
     @SuppressWarnings( "unchecked" )
     public Collection<Patient> get( Boolean isDead )
     {
@@ -117,7 +116,7 @@
 
             while ( resultSet.next() )
             {
-                Patient p = get( resultSet.getInt( 1 ) ) ;
+                Patient p = get( resultSet.getInt( 1 ) );
                 patients.add( p );
             }
         }
@@ -131,10 +130,6 @@
         }
 
         return patients;
-        
-//         return getCriteria(
-//            Restrictions.disjunction().add( Restrictions.ilike( "fullName", "%" + name + "%") ) ).addOrder(
-//            Order.asc( "firstName" ) ).list();
     }
 
     @SuppressWarnings( "unchecked" )
@@ -202,7 +197,7 @@
     {
         String sql = statementBuilder.countPatientsByFullName( name );
         StatementHolder holder = statementManager.getHolder();
-        
+
         try
         {
             Statement statement = holder.getStatement();

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/ProgramAttributePopulator.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/ProgramAttributePopulator.java	2010-11-09 06:45:07 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/ProgramAttributePopulator.java	2011-03-31 01:55:06 +0000
@@ -50,10 +50,11 @@
     {
         this.programAttributeService = programAttributeService;
     }
+
     // -------------------------------------------------------------------------
     // Execute
     // -------------------------------------------------------------------------
-    
+
     @Transactional
     public void execute()
         throws Exception

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2011-02-17 02:14:36 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2011-03-31 01:55:06 +0000
@@ -60,7 +60,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // Execute
+    // Action Implementation
     // -------------------------------------------------------------------------
 
     @Transactional
@@ -83,15 +83,19 @@
         executeSql( "UPDATE program SET minDaysAllowedInputData=0 WHERE minDaysAllowedInputData IS NULL" );
 
         executeSql( "UPDATE program SET maxDaysAllowedInputData=0 WHERE maxDaysAllowedInputData IS NULL" );
-        
+
         executeSql( "UPDATE patient SET isdead=false WHERE isdead IS NULL" );
 
         executeSql( "UPDATE patient SET hasPatients=false WHERE hasPatients IS NULL" );
     }
 
+    // -------------------------------------------------------------------------
+    // Supporting methods
+    // -------------------------------------------------------------------------
+
     private void updatePatientOrgunitAssociation()
     {
-    	StatementHolder holder = statementManager.getHolder();
+        StatementHolder holder = statementManager.getHolder();
 
         try
         {
@@ -115,7 +119,7 @@
         }
         catch ( Exception ex )
         {
-        	ex.printStackTrace();
+            ex.printStackTrace();
             log.error( ex );
         }
         finally

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/DefaultPatientAttributeValueService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/DefaultPatientAttributeValueService.java	2010-10-29 05:24:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/DefaultPatientAttributeValueService.java	2011-03-31 01:55:06 +0000
@@ -60,7 +60,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // PatientAttributeValue
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     public void deletePatientAttributeValue( PatientAttributeValue patientAttributeValue )
@@ -100,9 +100,9 @@
 
     public Collection<PatientAttributeValue> getPatientAttributeValues( Collection<Patient> patients )
     {
-       if( patients != null && patients.size() > 0 )
-           return patientAttributeValueStore.get( patients );
-       return null;
+        if ( patients != null && patients.size() > 0 )
+            return patientAttributeValueStore.get( patients );
+        return null;
     }
 
     public void savePatientAttributeValue( PatientAttributeValue patientAttributeValue )
@@ -122,7 +122,7 @@
         else
         {
             patientAttributeValueStore.update( patientAttributeValue );
-        }        
+        }
     }
 
     public Map<Integer, Collection<PatientAttributeValue>> getPatientAttributeValueMapForPatients(
@@ -151,7 +151,7 @@
         for ( Entry<Integer, Set<PatientAttributeValue>> entry : attributeValueMap.entrySet() )
         {
             SortedMap<String, PatientAttributeValue> sortedByAttribute = new TreeMap<String, PatientAttributeValue>();
-            
+
             for ( PatientAttributeValue patientAttributeValue : entry.getValue() )
             {
                 sortedByAttribute.put( patientAttributeValue.getPatientAttribute().getName(), patientAttributeValue );
@@ -182,7 +182,7 @@
             savePatientAttributeValue( attributeValue );
         }
     }
-    
+
     public int countByPatientAttributeoption( PatientAttributeOption attributeOption )
     {
         return patientAttributeValueStore.countByPatientAttributeoption( attributeOption );
@@ -198,8 +198,7 @@
         return patientAttributeValueStore.countSearchPatientAttributeValue( patientAttribute, searchText );
     }
 
-    public Collection<Patient> searchPatients( PatientAttribute patientAttribute,
-        String searchText, int min, int max )
+    public Collection<Patient> searchPatients( PatientAttribute patientAttribute, String searchText, int min, int max )
     {
         return patientAttributeValueStore.searchPatients( patientAttribute, searchText, min, max );
     }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueDeletionHandler.java	2011-01-20 04:05:32 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueDeletionHandler.java	2011-03-31 01:55:06 +0000
@@ -55,16 +55,16 @@
 
     private PatientService patientService;
 
-    public void setPatientService( PatientService patientService ) {
-		this.patientService = patientService;
-	}
-    
+    public void setPatientService( PatientService patientService )
+    {
+        this.patientService = patientService;
+    }
+
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
 
-
-	@Override
+    @Override
     public String getClassName()
     {
         return PatientAttributeValue.class.getSimpleName();
@@ -91,10 +91,10 @@
         {
             for ( PatientAttributeValue attributeValue : attributeValues )
             {
-            	Patient patient = attributeValue.getPatient();
+                Patient patient = attributeValue.getPatient();
                 patientAttributeValueService.deletePatientAttributeValue( attributeValue );
-                
-                patient.getAttributes().remove(patientAttribute);
+
+                patient.getAttributes().remove( patientAttribute );
                 patientService.updatePatient( patient );
             }
         }

=== 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	2010-11-29 07:01:42 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java	2011-03-31 01:55:06 +0000
@@ -47,7 +47,6 @@
     extends HibernateGenericStore<PatientAttributeValue>
     implements PatientAttributeValueStore
 {
-
     public void saveVoid( PatientAttributeValue patientAttributeValue )
     {
         sessionFactory.getCurrentSession().save( patientAttributeValue );
@@ -107,46 +106,49 @@
 
     public int countByPatientAttributeoption( PatientAttributeOption attributeOption )
     {
-        Number rs =  (Number) getCriteria( Restrictions.eq( "patientAttributeOption", attributeOption ) )
-                .setProjection(Projections.rowCount() ).uniqueResult();
+        Number rs = (Number) getCriteria( Restrictions.eq( "patientAttributeOption", attributeOption ) ).setProjection(
+            Projections.rowCount() ).uniqueResult();
         return rs != null ? rs.intValue() : 0;
     }
 
     @SuppressWarnings( "unchecked" )
     public Collection<Patient> getPatient( PatientAttribute attribute, String value )
     {
-        return getCriteria( Restrictions.and( Restrictions.eq( "patientAttribute", attribute ), Restrictions.eq( "value", value ) ))
+        return getCriteria(
+            Restrictions.and( Restrictions.eq( "patientAttribute", attribute ), Restrictions.eq( "value", value ) ) )
             .setProjection( Projections.property( "patient" ) ).list();
     }
 
     public int countSearchPatientAttributeValue( PatientAttribute patientAttribute, String searchText )
     {
-        Number rs =  (Number) getCriteria( Restrictions.eq( "patientAttribute", patientAttribute ),
-            Restrictions.ilike( "value", "%" + searchText + "%" ) ).setProjection( Projections.rowCount() ).uniqueResult();
-        
+        Number rs = (Number) getCriteria( Restrictions.eq( "patientAttribute", patientAttribute ),
+            Restrictions.ilike( "value", "%" + searchText + "%" ) ).setProjection( Projections.rowCount() )
+            .uniqueResult();
+
         return rs != null ? rs.intValue() : 0;
     }
 
     @SuppressWarnings( "unchecked" )
-    public Collection<Patient> searchPatients( PatientAttribute patientAttribute,
-        String searchText, int min, int max )
+    public Collection<Patient> searchPatients( PatientAttribute patientAttribute, String searchText, int min, int max )
     {
-        String hql = "select pav.patient from PatientAttributeValue pav where pav.patientAttribute = :patientAttribute and pav.value like '%" + searchText + "%'";
-        
+        String hql = "select pav.patient from PatientAttributeValue pav where pav.patientAttribute = :patientAttribute and pav.value like '%"
+            + searchText + "%'";
+
         Query query = getQuery( hql );
         query.setEntity( "patientAttribute", patientAttribute );
-        
+
         return query.setFirstResult( min ).setMaxResults( max ).list();
     }
-    
+
     @SuppressWarnings( "unchecked" )
     public Collection<Patient> searchPatients( PatientAttribute patientAttribute, String searchText )
     {
-        String hql = "select pav.patient from PatientAttributeValue pav where pav.patientAttribute = :patientAttribute and pav.value like '%" + searchText + "%'";
-        
+        String hql = "select pav.patient from PatientAttributeValue pav where pav.patientAttribute = :patientAttribute and pav.value like '%"
+            + searchText + "%'";
+
         Query query = getQuery( hql );
         query.setEntity( "patientAttribute", patientAttribute );
-        
+
         return query.list();
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/DefaultPatientDataValueService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/DefaultPatientDataValueService.java	2010-11-29 02:04:22 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/DefaultPatientDataValueService.java	2011-03-31 01:55:06 +0000
@@ -57,7 +57,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // PatientDataValue
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     public void savePatientDataValue( PatientDataValue patientDataValue )

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/aggregation/DefaultPatientDataValueAggregationEngine.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/aggregation/DefaultPatientDataValueAggregationEngine.java	2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/aggregation/DefaultPatientDataValueAggregationEngine.java	2011-03-31 01:55:06 +0000
@@ -1,5 +1,32 @@
 package org.hisp.dhis.patientdatavalue.aggregation;
 
+/*
+ * Copyright (c) 2004-2010, 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.ArrayList;
 import java.util.Collection;
 import java.util.Date;
@@ -15,8 +42,6 @@
 import org.hisp.dhis.system.util.TextUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 
-// Work in progress!
-
 @SuppressWarnings( "unused" )
 public class DefaultPatientDataValueAggregationEngine
     implements PatientDataValueAggregationEngine
@@ -46,79 +71,58 @@
         this.statementManager = statementManager;
     }
 
-    /*
-     * interface: startDate, endDate, organisationUnit
-     * 
-     * dimensions: data element, category option combo, period, organisation unit,
-     * 
-     * process:
-     * 
-     * get distinct dataelement
-     * get patients for organisation unit
-     * 
-     * int - sum: ("Number of condoms") 
-     * 
-     * int - count: ("Need for referral")
-     * 
-     * bool - sum: ("Baby weight")
-     * 
-     */
-    
     // -------------------------------------------------------------------------
-    // PatientDataValueAggregationEngine implementation
+    // Implementation Action
     // -------------------------------------------------------------------------
 
     public void aggregate( Date startDate, Date endDate, OrganisationUnit organisationUnit )
     {
-        Collection<DataElement> dataElements = null; // patientDataValueService.getDistinctDataElements();
-        
-        Collection<Integer> patients = null; // patientService.getPatients( OrganisationUnit organisationUnit );
-
-        Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );            
+        Collection<DataElement> dataElements = null;
+
+        Collection<Integer> patients = null;
+
+        Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
     }
-    
-    private void aggregate( DataElement dataElement, Collection<Integer> categoryOptionCombos, Period period, Collection<Integer> patients )
+
+    private void aggregate( DataElement dataElement, Collection<Integer> categoryOptionCombos, Period period,
+        Collection<Integer> patients )
     {
+        // ---------------------------------------------------------------------
         // sum - int
-        
-        String sql = 
-            "SELECT sum( value ) " + 
-            "FROM patientdatavalue " + 
-            "WHERE dataelementid = '" + dataElement.getId() + "' " +
-            "AND datetime > '" + DateUtils.getMediumDateString( period.getStartDate() ) + " " +
-            "AND datetime <= " + DateUtils.getMediumDateString( period.getEndDate() ) + " " +
-            "AND patientid IN (" + TextUtils.getCommaDelimitedString( patients ) + ")";
-        
+        // ---------------------------------------------------------------------
+
+        String sql = "SELECT sum( value ) " + "FROM patientdatavalue " + "WHERE dataelementid = '"
+            + dataElement.getId() + "' " + "AND datetime > '" + DateUtils.getMediumDateString( period.getStartDate() )
+            + " " + "AND datetime <= " + DateUtils.getMediumDateString( period.getEndDate() ) + " "
+            + "AND patientid IN (" + TextUtils.getCommaDelimitedString( patients ) + ")";
+
+        // ---------------------------------------------------------------------
         // sum - bool
-        
-        sql = 
-            "SELECT count( * ) " +
-            "FROM patientdatavalue " + 
-            "WHERE dataelementid = '" + dataElement.getId() + "' " +
-            "AND datetime > '" + DateUtils.getMediumDateString( period.getStartDate() ) + " " +
-            "AND datetime <= " + DateUtils.getMediumDateString( period.getEndDate() ) + " " +
-            "AND patientid IN (" + TextUtils.getCommaDelimitedString( patients ) + ") " +
-            "AND value='T'";
-        
+        // ---------------------------------------------------------------------
+
+        sql = "SELECT count( * ) " + "FROM patientdatavalue " + "WHERE dataelementid = '" + dataElement.getId() + "' "
+            + "AND datetime > '" + DateUtils.getMediumDateString( period.getStartDate() ) + " " + "AND datetime <= "
+            + DateUtils.getMediumDateString( period.getEndDate() ) + " " + "AND patientid IN ("
+            + TextUtils.getCommaDelimitedString( patients ) + ") " + "AND value='T'";
+
+        // ---------------------------------------------------------------------
         // count - int
-        
+        // ---------------------------------------------------------------------
+
         for ( Integer categoryOptionComboId : categoryOptionCombos )
         {
-            sql =
-                "SELECT count( * ) " +
-                "FROM patientdatavalue " + 
-                "WHERE dataelementid = '" + dataElement.getId() + "' " +
-                "AND categoryoptioncomboid = '" + categoryOptionComboId + " " +
-                "AND datetime > '" + DateUtils.getMediumDateString( period.getStartDate() ) + " " +
-                "AND datetime <= " + DateUtils.getMediumDateString( period.getEndDate() ) + " " +
-                "AND patientid IN (" + TextUtils.getCommaDelimitedString( patients ) + ")";
+            sql = "SELECT count( * ) " + "FROM patientdatavalue " + "WHERE dataelementid = '" + dataElement.getId()
+                + "' " + "AND categoryoptioncomboid = '" + categoryOptionComboId + " " + "AND datetime > '"
+                + DateUtils.getMediumDateString( period.getStartDate() ) + " " + "AND datetime <= "
+                + DateUtils.getMediumDateString( period.getEndDate() ) + " " + "AND patientid IN ("
+                + TextUtils.getCommaDelimitedString( patients ) + ")";
         }
     }
-    
+
     private Collection<Period> filterPeriods( Collection<Period> periods, PeriodType periodType )
     {
         Collection<Period> filteredPeriods = new ArrayList<Period>();
-        
+
         for ( Period period : periods )
         {
             if ( period.getPeriodType().equals( periodType ) )
@@ -126,7 +130,7 @@
                 filteredPeriods.add( period );
             }
         }
-        
+
         return filteredPeriods;
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/aggregation/PatientDataValueAggregationEngine.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/aggregation/PatientDataValueAggregationEngine.java	2009-09-30 09:06:54 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/aggregation/PatientDataValueAggregationEngine.java	2011-03-31 01:55:06 +0000
@@ -1,5 +1,32 @@
 package org.hisp.dhis.patientdatavalue.aggregation;
 
+/*
+ * Copyright (c) 2004-2010, 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.Date;
 
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -7,6 +34,6 @@
 public interface PatientDataValueAggregationEngine
 {
     String ID = PatientDataValueAggregationEngine.class.getName();
-    
+
     public void aggregate( Date startDate, Date endDate, OrganisationUnit organisationUnit );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramAttributeOptionService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramAttributeOptionService.java	2010-11-09 02:09:53 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramAttributeOptionService.java	2011-03-31 01:55:06 +0000
@@ -33,7 +33,6 @@
 
 /**
  * @author Chau Thu Tran
- * 
  * @version DefaultProgramAttributeOptionService.java Nov 1, 2010 3:04:33 PM
  */
 
@@ -53,7 +52,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // ProgramAttribute implementation
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     public int addProgramAttributeOption( ProgramAttributeOption option )

=== 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	2010-10-30 10:56:31 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2011-03-31 01:55:06 +0000
@@ -52,7 +52,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // ProgramInstance implementation
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     public int addProgramInstance( ProgramInstance programInstance )
@@ -129,13 +129,14 @@
     {
         return programInstanceStore.get( program, organisationUnit );
     }
-    
-    public Collection<ProgramInstance> getProgramInstances( Program program, OrganisationUnit organisationUnit, int min, int max )
+
+    public Collection<ProgramInstance> getProgramInstances( Program program, OrganisationUnit organisationUnit,
+        int min, int max )
     {
-        return programInstanceStore.get( program, organisationUnit,  min, max );
+        return programInstanceStore.get( program, organisationUnit, min, max );
     }
-    
-    public int countProgramInstances(Program program, OrganisationUnit organisationUnit )
+
+    public int countProgramInstances( Program program, OrganisationUnit organisationUnit )
     {
         return programInstanceStore.count( program, organisationUnit );
     }

=== 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	2010-05-18 03:42:26 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramService.java	2011-03-31 01:55:06 +0000
@@ -56,7 +56,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // Program
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     public int saveProgram( Program program )
@@ -107,7 +107,7 @@
     public Collection<Program> getPrograms( ValidationCriteria validationCriteria )
     {
         Set<Program> programs = new HashSet<Program>();
-        
+
         for ( Program program : getAllPrograms() )
         {
             if ( program.getPatientValidationCriteria().contains( validationCriteria ) )

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageDataElementService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageDataElementService.java	2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageDataElementService.java	2011-03-31 01:55:06 +0000
@@ -33,14 +33,13 @@
 
 /**
  * @author Viet Nguyen
- *
+ * 
  * @version $Id$
  */
 @Transactional
-public class DefaultProgramStageDataElementService 
+public class DefaultProgramStageDataElementService
     implements ProgramStageDataElementService
 {
-    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -51,14 +50,14 @@
     {
         this.programStageDataElementStore = programStageDataElementStore;
     }
-    
+
     // -------------------------------------------------------------------------
-    // ProgramInstance implementation
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     public void addProgramStageDataElement( ProgramStageDataElement programStageDataElement )
     {
-        programStageDataElementStore.saveOrUpdate( programStageDataElement);
+        programStageDataElementStore.saveOrUpdate( programStageDataElement );
     }
 
     public void deleteProgramStageDataElement( ProgramStageDataElement programStageDataElement )
@@ -70,8 +69,8 @@
     {
         return programStageDataElementStore.getAll();
     }
-    
-    public Collection<ProgramStageDataElement> get( ProgramStage programStage)
+
+    public Collection<ProgramStageDataElement> get( ProgramStage programStage )
     {
         return programStageDataElementStore.get( programStage );
     }
@@ -90,6 +89,5 @@
     {
         return programStageDataElementStore.getListDataElement( programStage );
     }
-    
-    
+
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageDataElementValidationService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageDataElementValidationService.java	2010-10-22 06:43:14 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageDataElementValidationService.java	2011-03-31 01:55:06 +0000
@@ -42,7 +42,7 @@
     implements ProgramStageDataElementValidationService
 {
     // -------------------------------------------------------------------------
-    // Dependency
+    // Dependencies
     // -------------------------------------------------------------------------
 
     private ProgramStageDataElementValidationStore validationStore;
@@ -53,7 +53,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // ProgramStageDataElementValidation implementation
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     public int saveProgramStageDataElementValidation( ProgramStageDataElementValidation validation )

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2011-01-21 18:28:26 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2011-03-31 01:55:06 +0000
@@ -44,7 +44,6 @@
 public class DefaultProgramStageInstanceService
     implements ProgramStageInstanceService
 {
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -57,7 +56,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // ProgramStageInstance implementation
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     public int addProgramStageInstance( ProgramStageInstance programStageInstance )
@@ -137,32 +136,31 @@
 
     public Collection<ProgramStageInstance> getProgramStageInstances( Collection<ProgramInstance> programInstances )
     {
-
         return programStageInstanceStore.getProgramStageInstances( programInstances );
-
     }
 
     public Collection<ProgramStageInstance> getProgramStageInstances( Date dueDate )
     {
         return programStageInstanceStore.getProgramStageInstances( dueDate );
-    }    
-    
+    }
+
     public Collection<ProgramStageInstance> getProgramStageInstances( Date dueDate, Boolean completed )
     {
         return programStageInstanceStore.getProgramStageInstances( dueDate, completed );
     }
-    
+
     public Collection<ProgramStageInstance> getProgramStageInstances( Date startDate, Date endDate )
     {
         return programStageInstanceStore.getProgramStageInstances( startDate, endDate );
     }
-    
+
     public Collection<ProgramStageInstance> getProgramStageInstances( Date startDate, Date endDate, Boolean completed )
     {
         return programStageInstanceStore.getProgramStageInstances( startDate, endDate, completed );
     }
 
-    public List<ProgramStageInstance> get(OrganisationUnit unit, Date after, Date before, Boolean completed) {
+    public List<ProgramStageInstance> get( OrganisationUnit unit, Date after, Date before, Boolean completed )
+    {
         return programStageInstanceStore.get( unit, after, before, completed );
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java	2010-10-22 06:43:14 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramDeletionHandler.java	2011-03-31 01:55:06 +0000
@@ -37,7 +37,6 @@
 
 /**
  * @author Chau Thu Tran
- * 
  * @version ProgramDeleteHandler.java Sep 30, 2010 1:39:15 PM
  */
 public class ProgramDeletionHandler
@@ -62,7 +61,6 @@
     }
 
     // -------------------------------------------------------------------------
-
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java	2010-12-01 09:32:54 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java	2011-03-31 01:55:06 +0000
@@ -78,7 +78,7 @@
     }
     
     // -------------------------------------------------------------------------
-    // DeletionHandler implementation
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramStageDataElementDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramStageDataElementDeletionHandler.java	2010-10-22 06:43:14 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramStageDataElementDeletionHandler.java	2011-03-31 01:55:06 +0000
@@ -43,6 +43,7 @@
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
+
     ProgramStageDataElementService programStageDEService;
 
     public void setProgramStageDEService( ProgramStageDataElementService programStageDEService )
@@ -59,7 +60,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // DeletionHandler implementation
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     @Override
@@ -129,7 +130,6 @@
             {
                 programStageDEService.deleteProgramStageDataElement( dataElement );
             }
-
         }
 
     }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramAttributeOptionStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramAttributeOptionStore.java	2010-11-09 02:09:53 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramAttributeOptionStore.java	2011-03-31 01:55:06 +0000
@@ -37,14 +37,12 @@
 
 /**
  * @author Chau Thu Tran
- * 
  * @version HibernateProgramAttributeOptionStore.java Nov 1, 2010 3:07:17 PM
  */
 public class HibernateProgramAttributeOptionStore
     extends HibernateGenericStore<ProgramAttributeOption>
     implements ProgramAttributeOptionStore
 {
-
     public ProgramAttributeOption get( ProgramAttribute programAttribute, String name )
     {
         return (ProgramAttributeOption) getCriteria( Restrictions.eq( "name", name ),

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramAttributeStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramAttributeStore.java	2010-11-09 02:09:53 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramAttributeStore.java	2011-03-31 01:55:06 +0000
@@ -36,14 +36,13 @@
 
 /**
  * @author Chau Thu Tran
- * 
  * @version HibernateProgramAttributeStore.java Oct 30, 2010 11:41:58 PM
  */
 public class HibernateProgramAttributeStore
     extends HibernateGenericStore<ProgramAttribute>
     implements ProgramAttributeStore
 {
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     public Collection<ProgramAttribute> getByValueType( String valueType )
     {
         return getCriteria( Restrictions.eq( "valueType", valueType ) ).list();

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java	2010-10-30 10:56:31 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java	2011-03-31 01:55:06 +0000
@@ -105,24 +105,23 @@
     @SuppressWarnings( "unchecked" )
     public Collection<ProgramInstance> get( Program program, OrganisationUnit organisationUnit )
     {
-        return getCriteria( Restrictions.eq( "program", program ), Restrictions.isNull( "endDate" ) ).createAlias( "patient", "patient" )
-            .add( Restrictions.eq( "patient.organisationUnit", organisationUnit ) ).list();
+        return getCriteria( Restrictions.eq( "program", program ), Restrictions.isNull( "endDate" ) ).createAlias(
+            "patient", "patient" ).add( Restrictions.eq( "patient.organisationUnit", organisationUnit ) ).list();
     }
-    
+
     @SuppressWarnings( "unchecked" )
     public Collection<ProgramInstance> get( Program program, OrganisationUnit organisationUnit, int min, int max )
     {
-        return getCriteria( Restrictions.eq( "program", program ), Restrictions.isNull( "endDate" ) )
-            .add( Restrictions.eq( "patient.organisationUnit", organisationUnit ) )
-            .createAlias( "patient", "patient" ).addOrder( Order.asc( "patient.id" ) )
-            .setFirstResult( min ).setMaxResults( max ).list();
+        return getCriteria( Restrictions.eq( "program", program ), Restrictions.isNull( "endDate" ) ).add(
+            Restrictions.eq( "patient.organisationUnit", organisationUnit ) ).createAlias( "patient", "patient" )
+            .addOrder( Order.asc( "patient.id" ) ).setFirstResult( min ).setMaxResults( max ).list();
     }
 
-    public int count(Program program, OrganisationUnit organisationUnit )
+    public int count( Program program, OrganisationUnit organisationUnit )
     {
-        Number rs = (Number) getCriteria( Restrictions.eq( "program", program ), Restrictions.isNull( "endDate" ) ).createAlias( "patient", "patient" )
-        .add( Restrictions.eq( "patient.organisationUnit", organisationUnit ) )
-        .setProjection( Projections.rowCount() ).uniqueResult();
+        Number rs = (Number) getCriteria( Restrictions.eq( "program", program ), Restrictions.isNull( "endDate" ) )
+            .createAlias( "patient", "patient" ).add( Restrictions.eq( "patient.organisationUnit", organisationUnit ) )
+            .setProjection( Projections.rowCount() ).uniqueResult();
         return rs != null ? rs.intValue() : 0;
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageDataElementStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageDataElementStore.java	2010-03-12 13:25:09 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageDataElementStore.java	2011-03-31 01:55:06 +0000
@@ -39,37 +39,37 @@
 
 /**
  * @author Viet Nguyen
- *
  * @version $Id$
  */
-public class HibernateProgramStageDataElementStore 
-    extends HibernateGenericStore<ProgramStageDataElement> implements ProgramStageDataElementStore 
+public class HibernateProgramStageDataElementStore
+    extends HibernateGenericStore<ProgramStageDataElement>
+    implements ProgramStageDataElementStore
 {
-    
     @SuppressWarnings( "unchecked" )
     public Collection<ProgramStageDataElement> get( ProgramStage programStage )
     {
-        return getCriteria( Restrictions.eq( "programStage", programStage) ).list();
+        return getCriteria( Restrictions.eq( "programStage", programStage ) ).list();
     }
-    
+
     @SuppressWarnings( "unchecked" )
     public Collection<ProgramStageDataElement> get( ProgramStage programStage, boolean compulsory )
     {
-        return getCriteria( Restrictions.eq( "programStage", programStage ), Restrictions.eq( "compulsory", compulsory ) ).list();
+        return getCriteria( Restrictions.eq( "programStage", programStage ), Restrictions.eq( "compulsory", compulsory ) )
+            .list();
     }
-    
+
     public ProgramStageDataElement get( ProgramStage programStage, DataElement dataElement )
     {
-        return (ProgramStageDataElement) getCriteria( Restrictions.eq( "programStage", programStage ), Restrictions.eq( "dataElement", dataElement ) ).uniqueResult();
+        return (ProgramStageDataElement) getCriteria( Restrictions.eq( "programStage", programStage ),
+            Restrictions.eq( "dataElement", dataElement ) ).uniqueResult();
     }
 
     @SuppressWarnings( "unchecked" )
     public Collection<DataElement> getListDataElement( ProgramStage programStage )
     {
         Criteria criteria = sessionFactory.getCurrentSession().createCriteria( getClazz() );
-        
-        criteria.add(  Restrictions.eq( "programStage", programStage) );
-        criteria.setProjection( Projections.property( "dataElement" ));
+        criteria.add( Restrictions.eq( "programStage", programStage ) );
+        criteria.setProjection( Projections.property( "dataElement" ) );
         return criteria.list();
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageDataElementValidationStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageDataElementValidationStore.java	2010-10-22 06:43:14 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageDataElementValidationStore.java	2011-03-31 01:55:06 +0000
@@ -47,11 +47,6 @@
     extends HibernateGenericStore<ProgramStageDataElementValidation>
     implements ProgramStageDataElementValidationStore
 {
-
-    // -------------------------------------------------------------------------
-    // Implementation
-    // -------------------------------------------------------------------------
-
     @SuppressWarnings( "unchecked" )
     public Collection<ProgramStageDataElementValidation> getProgramStageDataElementValidations( Program program )
     {

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2011-01-21 18:28:26 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2011-03-31 01:55:06 +0000
@@ -47,7 +47,6 @@
     extends HibernateGenericStore<ProgramStageInstance>
     implements ProgramStageInstanceStore
 {
-
     public ProgramStageInstance get( ProgramInstance programInstance, ProgramStage programStage )
     {
         return (ProgramStageInstance) getCriteria( Restrictions.eq( "programInstance", programInstance ),
@@ -63,9 +62,7 @@
     @SuppressWarnings( "unchecked" )
     public Collection<ProgramStageInstance> getProgramStageInstances( Collection<ProgramInstance> programInstances )
     {
-
         return getCriteria( Restrictions.in( "programInstance", programInstances ) ).list();
-
     }
 
     @SuppressWarnings( "unchecked" )
@@ -83,41 +80,38 @@
     @SuppressWarnings( "unchecked" )
     public Collection<ProgramStageInstance> getProgramStageInstances( Date startDate, Date endDate )
     {
-
         return (getCriteria( Restrictions.ge( "dueDate", startDate ), Restrictions.le( "dueDate", endDate ) )).list();
     }
 
     @SuppressWarnings( "unchecked" )
     public Collection<ProgramStageInstance> getProgramStageInstances( Date startDate, Date endDate, Boolean completed )
     {
-
         return (getCriteria( Restrictions.ge( "dueDate", startDate ), Restrictions.le( "dueDate", endDate ),
             Restrictions.eq( "completed", completed ) )).list();
     }
 
-    
     @SuppressWarnings( "unchecked" )
-    public List<ProgramStageInstance> get(OrganisationUnit unit, Date after, Date before, Boolean completed) {
-
+    public List<ProgramStageInstance> get( OrganisationUnit unit, Date after, Date before, Boolean completed )
+    {
         String hql = "from ProgramStageInstance where programInstance.patient.organisationUnit = :unit";
-        
-        if (after != null)
+
+        if ( after != null )
             hql += " and dueDate >= :after";
-        if (before != null) 
+        if ( before != null )
             hql += " and dueDate <= :before";
-        if (completed != null)
+        if ( completed != null )
             hql += " and completed = :completed";
-        
+
         Query q = getQuery( hql ).setEntity( "unit", unit );
 
-        if (after != null)
+        if ( after != null )
             q.setDate( "after", after );
-        if (before != null)
+        if ( before != null )
             q.setDate( "before", before );
-        if (completed != null)
+        if ( completed != null )
             q.setBoolean( "completed", completed );
 
         return q.list();
     }
-    
+
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/nextvisit/DefaultNextVisitGenerator.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/nextvisit/DefaultNextVisitGenerator.java	2009-11-13 15:59:13 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/nextvisit/DefaultNextVisitGenerator.java	2011-03-31 01:55:06 +0000
@@ -48,7 +48,6 @@
 public class DefaultNextVisitGenerator
     implements NextVisitGenerator
 {
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -68,7 +67,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // Next visits implementation
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     public Map<Patient, Set<ProgramStageInstance>> getNextVisits( Collection<ProgramInstance> programInstances )

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/nextvisit/NextVisitGenerator.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/nextvisit/NextVisitGenerator.java	2009-11-13 15:59:13 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/nextvisit/NextVisitGenerator.java	2011-03-31 01:55:06 +0000
@@ -43,5 +43,4 @@
     String ID = NextVisitGenerator.class.getName();
 
     Map<Patient, Set<ProgramStageInstance>> getNextVisits( Collection<ProgramInstance> programInstances );
-
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/programattributevalue/DefaultProgramAttributeValueService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/programattributevalue/DefaultProgramAttributeValueService.java	2010-11-09 02:09:53 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/programattributevalue/DefaultProgramAttributeValueService.java	2011-03-31 01:55:06 +0000
@@ -35,7 +35,6 @@
 
 /**
  * @author Chau Thu Tran
- * 
  * @version DefaultProgramAttributeValue.java Oct 31, 2010 6:09:03 PM
  */
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/DefaultRelationshipService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/DefaultRelationshipService.java	2009-11-20 07:45:12 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/DefaultRelationshipService.java	2011-03-31 01:55:06 +0000
@@ -39,7 +39,6 @@
 public class DefaultRelationshipService
     implements RelationshipService
 {
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -52,7 +51,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // Relationship Implementation
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     public void deleteRelationship( Relationship relationship )
@@ -98,5 +97,5 @@
     public Relationship getRelationship( Patient patientA, Patient patientB, RelationshipType relationshipType )
     {
         return relationshipStore.get( patientA, patientB, relationshipType );
-    }    
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/DefaultRelationshipTypeService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/DefaultRelationshipTypeService.java	2009-11-24 15:39:07 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/DefaultRelationshipTypeService.java	2011-03-31 01:55:06 +0000
@@ -38,7 +38,6 @@
 public class DefaultRelationshipTypeService
     implements RelationshipTypeService
 {
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -51,7 +50,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // RelationshipType Implementation
+    // Implementation methods
     // -------------------------------------------------------------------------
 
     public void deleteRelationshipType( RelationshipType relationshipType )

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/hibernate/HibernateRelationshipStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/hibernate/HibernateRelationshipStore.java	2009-11-20 07:45:12 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/hibernate/HibernateRelationshipStore.java	2011-03-31 01:55:06 +0000
@@ -43,7 +43,6 @@
     extends HibernateGenericStore<Relationship>
     implements RelationshipStore
 {
-
     @SuppressWarnings( "unchecked" )
     public Collection<Relationship> getForPatient( Patient patient )
     {

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/hibernate/HibernateRelationshipTypeStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/hibernate/HibernateRelationshipTypeStore.java	2009-11-24 15:39:07 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/hibernate/HibernateRelationshipTypeStore.java	2011-03-31 01:55:06 +0000
@@ -40,7 +40,6 @@
     extends HibernateGenericStore<RelationshipType>
     implements RelationshipTypeStore
 {
-
     public RelationshipType getRelationshipType( String aIsToB, String bIsToA )
     {
         return (RelationshipType) getCriteria( Restrictions.eq( "aIsToB", aIsToB ), Restrictions.eq( "bIsToA", bIsToA ) )