← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2627: Fix bug: Exception thrown while generating any min-max values.

 

------------------------------------------------------------
revno: 2627
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-01-19 13:43:16 +0700
message:
  Fix bug:  Exception thrown while generating any min-max values.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GenerateMinMaxValuesAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/RemoveMinMaxValueAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/minMaxValidation.js


--
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-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GenerateMinMaxValuesAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GenerateMinMaxValuesAction.java	2010-09-30 05:37:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GenerateMinMaxValuesAction.java	2011-01-19 06:43:16 +0000
@@ -67,12 +67,12 @@
     {
         this.selectionTreeManager = selectionTreeManager;
     }
-    
+
     // -------------------------------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------------------------------
 
-    private Integer[] dataSetIds;
+    private Integer[] dataSets;
 
     private String message;
 
@@ -117,9 +117,9 @@
         this.minMaxDataElementService = minMaxDataElementService;
     }
 
-    public void setDataSetIds( Integer[] dataSetIds )
+    public void setDataSets( Integer[] dataSets )
     {
-        this.dataSetIds = dataSetIds;
+        this.dataSets = dataSets;
     }
 
     // -------------------------------------------------------------------------------------------------
@@ -130,15 +130,15 @@
     public String execute()
         throws Exception
     {
-//        if ( dataSetIds == null )
-//        {
-//            selectionTreeManager.clearSelectedOrganisationUnits();
-//            return INPUT;
-//        }
-        
+        // if ( dataSetIds == null )
+        // {
+        // selectionTreeManager.clearSelectedOrganisationUnits();
+        // return INPUT;
+        // }
+
         Collection<OrganisationUnit> orgUnits = selectionTreeManager.getReloadedSelectedOrganisationUnits();
 
-        if ( orgUnits == null || orgUnits.size() ==0 )
+        if ( orgUnits == null || orgUnits.size() == 0 )
         {
             message = i18n.getString( "not_choose_organisation" );
             return INPUT;
@@ -148,7 +148,7 @@
         Double factor = (Double) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_FACTOR_OF_DEVIATION,
             2.0 );
 
-        for ( Integer dataSetId : dataSetIds )
+        for ( Integer dataSetId : dataSets )
         {
             // Get dataset
             DataSet dataSet = dataSetService.getDataSet( dataSetId );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/RemoveMinMaxValueAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/RemoveMinMaxValueAction.java	2010-09-30 05:37:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/RemoveMinMaxValueAction.java	2011-01-19 06:43:16 +0000
@@ -41,19 +41,18 @@
 import org.hisp.dhis.minmax.validation.MinMaxValuesGenerationService;
 import org.hisp.dhis.options.SystemSettingManager;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.oust.manager.SelectionTreeManager;
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 
 import com.opensymphony.xwork2.Action;
 
 public class RemoveMinMaxValueAction
-implements Action
+    implements Action
 {
     // -------------------------------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------------------------------
-
-    private OrganisationUnitSelectionManager organisationUnitSelectionManager;
-
+    
     private DataSetService dataSetService;
 
     private MinMaxValuesGenerationService minMaxValuesGenerationService;
@@ -62,11 +61,13 @@
 
     private SystemSettingManager systemSettingManager;
 
+    private SelectionTreeManager selectionTreeManager;
+
     // -------------------------------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------------------------------
 
-    private Integer[] dataSetIds;
+    private Integer[] dataSets;
 
     private String message;
 
@@ -75,10 +76,10 @@
     // -------------------------------------------------------------------------------------------------
     // Setters
     // -------------------------------------------------------------------------------------------------
-
-    public void setOrganisationUnitSelectionManager( OrganisationUnitSelectionManager organisationUnitSelectionManager )
+    
+    public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
     {
-        this.organisationUnitSelectionManager = organisationUnitSelectionManager;
+        this.selectionTreeManager = selectionTreeManager;
     }
 
     public void setSystemSettingManager( SystemSettingManager systemSettingManager )
@@ -116,9 +117,9 @@
         this.minMaxDataElementService = minMaxDataElementService;
     }
 
-    public void setDataSetIds( Integer[] dataSetIds )
+    public void setDataSets( Integer[] dataSets )
     {
-        this.dataSetIds = dataSetIds;
+        this.dataSets = dataSets;
     }
 
     // -------------------------------------------------------------------------------------------------
@@ -128,9 +129,10 @@
     @Override
     public String execute()
         throws Exception
-    {  
-        Collection<OrganisationUnit> orgUnits = organisationUnitSelectionManager.getSelectedOrganisationUnits();
-        if ( orgUnits == null || orgUnits.size() ==0 )
+    {
+        Collection<OrganisationUnit> orgUnits = selectionTreeManager.getReloadedSelectedOrganisationUnits();
+
+        if ( orgUnits == null || orgUnits.size() == 0 )
         {
             message = i18n.getString( "not_choose_organisation" );
             return INPUT;
@@ -140,7 +142,7 @@
         Double factor = (Double) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_FACTOR_OF_DEVIATION,
             2.0 );
 
-        for ( Integer dataSetId : dataSetIds )
+        for ( Integer dataSetId : dataSets )
         {
             // Get dataset
             DataSet dataSet = dataSetService.getDataSet( dataSetId );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml	2011-01-06 17:07:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml	2011-01-19 06:43:16 +0000
@@ -256,8 +256,8 @@
 	<bean
 		id="org.hisp.dhis.dataadmin.action.minmaxvalidation.RemoveMinMaxValueAction"
 		class="org.hisp.dhis.dataadmin.action.minmaxvalidation.RemoveMinMaxValueAction">
-		<property name="organisationUnitSelectionManager">
-			<ref bean="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+		<property name="selectionTreeManager">
+			<ref bean="org.hisp.dhis.oust.manager.SelectionTreeManager"/>
 		</property>
 		<property name="dataSetService">
 			<ref bean="org.hisp.dhis.dataset.DataSetService" />

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/minMaxValidation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/minMaxValidation.js	2010-12-29 21:48:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/minMaxValidation.js	2011-01-19 06:43:16 +0000
@@ -2,8 +2,20 @@
 	var request = new Request();
 	request.setResponseTypeXML( 'xmlObject' );
 	request.setCallbackSuccess( minMaxValueCompleted );	
-	request.sendAsPost(getParamString('dataSetIds', 'datatSetIds'));
+
+	var datasetIds = "";
+	var datasetField = byId( 'dataSetIds' ); 
+	for (var i = 0; i < datasetField.options.length; i++)
+	{
+		if (datasetField.options[ i ].selected)
+		{
+		  datasetIds+= "dataSets=" + datasetField.options[ i ].value + "&";
+		}
+	}
+	
+	request.sendAsPost( datasetIds );
 	request.send( 'generateMinMaxValue.action' );
+	
 }
 
 function minMaxValueCompleted( xmlObject ) {
@@ -51,7 +63,18 @@
 	var request = new Request();
 	request.setResponseTypeXML( 'xmlObject' );
 	request.setCallbackSuccess( minMaxValueCompleted );	
-	request.sendAsPost(getParamString('dataSetIds', 'dataSetIds'));
+	
+	var datasetIds = "";
+	var datasetField = byId( 'dataSetIds' ); 
+	for (var i = 0; i < datasetField.options.length; i++)
+	{
+		if (datasetField.options[ i ].selected)
+		{
+		  datasetIds+= "dataSets=" + datasetField.options[ i ].value + "&";
+		}
+	}
+	
+	request.sendAsPost( datasetIds );
 	request.send( 'removeMinMaxValue.action' );
 	
 }
\ No newline at end of file