← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3290: Fix bug: Don't add/update value of Validation criteria into Patient module.

 

------------------------------------------------------------
revno: 3290
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-04-06 10:19:11 +0700
message:
  Fix bug: Don't add/update value of Validation criteria into Patient module.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.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/hibernate/HibernatePatientMobileSettingStore.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ValidateValueAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddValidationCriteriaAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/UpdateValidationCriteriaAction.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/PatientService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java	2010-12-27 07:59:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java	2011-04-06 03:19:11 +0000
@@ -31,6 +31,7 @@
 import java.util.Date;
 import java.util.List;
 
+import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
 import org.hisp.dhis.program.Program;
@@ -225,6 +226,6 @@
     
     int countGetPatientsByOrgUnitProgram( OrganisationUnit organisationUnit, Program program );
     
-    Object getObjectValue( String property, String value );
+    Object getObjectValue( String property, String value, I18nFormat format );
     
 }

=== 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	2011-04-01 03:00:35 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2011-04-06 03:19:11 +0000
@@ -110,13 +110,6 @@
         this.relationshipTypeService = relationshipTypeService;
     }
 
-    private I18nFormat format;
-
-    public void setFormat( I18nFormat format )
-    {
-        this.format = format;
-    }
-
     // -------------------------------------------------------------------------
     // Implementation methods
     // -------------------------------------------------------------------------
@@ -502,7 +495,7 @@
     }
 
     @Override
-    public Object getObjectValue( String property, String value )
+    public Object getObjectValue( String property, String value, I18nFormat format )
     {
         try
         {

=== 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	2011-03-31 01:55:06 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientMobileSettingStore.java	2011-04-06 03:19:11 +0000
@@ -49,8 +49,6 @@
         Criteria criteria = session.createCriteria( PatientMobileSetting.class );
         criteria.setCacheable( true );
 
-        System.out.println( criteria.list().size() );
-
         return criteria.list();
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ValidateValueAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ValidateValueAction.java	2011-04-01 03:00:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ValidateValueAction.java	2011-04-06 03:19:11 +0000
@@ -34,6 +34,7 @@
 import org.hisp.dhis.caseentry.state.SelectedStateManager;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientService;
@@ -88,6 +89,8 @@
 
     private int statusCode;
 
+    private I18nFormat format;
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -133,6 +136,11 @@
         this.patientService = patientService;
     }
 
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
     public int getDataElementId()
     {
         return dataElementId;
@@ -265,7 +273,7 @@
                     && leftSide.getDataElement().equals( dataElement ) )
                 {
                     // get left-side value
-                    Object objectValue = patientService.getObjectValue( leftSide.getDataElement().getType(), value );
+                    Object objectValue = patientService.getObjectValue( leftSide.getDataElement().getType(), value, format );
 
                     // get program-stage of right-side
                     comparerogramStageInstance = programStageInstanceService.getProgramStageInstance( programInstance,
@@ -278,7 +286,8 @@
                     if ( patientDataValue != null )
                     {
                         String dbValue = patientDataValue.getValue();
-                        Object compareValue = patientService.getObjectValue( rightSide.getDataElement().getType(), dbValue );
+                        Object compareValue = patientService.getObjectValue( rightSide.getDataElement().getType(),
+                            dbValue, format );
 
                         i = ((Comparable<Object>) objectValue).compareTo( (Comparable<Object>) compareValue );
                     }
@@ -287,7 +296,7 @@
                 else
                 {
                     // get right-side value
-                    Object objectValue = patientService.getObjectValue( rightSide.getDataElement().getType(), value );
+                    Object objectValue = patientService.getObjectValue( rightSide.getDataElement().getType(), value, format );
 
                     comparerogramStageInstance = programStageInstanceService.getProgramStageInstance( programInstance,
                         leftSide.getProgramStage() );
@@ -298,7 +307,8 @@
                     if ( patientDataValue != null )
                     {
                         String dbValue = patientDataValue.getValue();
-                        Object compareValue = patientService.getObjectValue( leftSide.getDataElement().getType(), dbValue );
+                        Object compareValue = patientService.getObjectValue( leftSide.getDataElement().getType(),
+                            dbValue, format );
 
                         i = ((Comparable<Object>) compareValue).compareTo( (Comparable<Object>) objectValue );
                     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddValidationCriteriaAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddValidationCriteriaAction.java	2011-04-03 10:19:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/AddValidationCriteriaAction.java	2011-04-06 03:19:11 +0000
@@ -27,6 +27,7 @@
 
 package org.hisp.dhis.patient.action.validation;
 
+import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.validation.ValidationCriteria;
 import org.hisp.dhis.validation.ValidationCriteriaService;
@@ -45,9 +46,11 @@
     // -------------------------------------------------------------------------
 
     private ValidationCriteriaService validationCriteriaService;
-    
+
     private PatientService patientService;
 
+    private I18nFormat format;
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -76,6 +79,11 @@
         this.patientService = patientService;
     }
 
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
     public void setName( String name )
     {
         this.name = name;
@@ -115,7 +123,7 @@
         criteria.setDescription( description );
         criteria.setProperty( property );
         criteria.setOperator( operator );
-        criteria.setValue( patientService.getObjectValue( property, value ));
+        criteria.setValue( patientService.getObjectValue( property, value, format ) );
 
         validationCriteriaService.saveValidationCriteria( criteria );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/UpdateValidationCriteriaAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/UpdateValidationCriteriaAction.java	2011-04-03 10:19:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/validation/UpdateValidationCriteriaAction.java	2011-04-06 03:19:11 +0000
@@ -27,6 +27,7 @@
 
 package org.hisp.dhis.patient.action.validation;
 
+import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.validation.ValidationCriteria;
 import org.hisp.dhis.validation.ValidationCriteriaService;
@@ -48,6 +49,8 @@
 
     private PatientService patientService;
 
+    private I18nFormat format;
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -78,6 +81,11 @@
         this.patientService = patientService;
     }
 
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
     public void setName( String name )
     {
         this.name = name;
@@ -122,7 +130,7 @@
         criteria.setDescription( description );
         criteria.setProperty( property );
         criteria.setOperator( operator );
-        criteria.setValue( patientService.getObjectValue( property, value ) );
+        criteria.setValue( patientService.getObjectValue( property, value, format ) );
 
         validationCriteriaService.updateValidationCriteria( criteria );