← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1765: Improve the min/max value functionality.

 

------------------------------------------------------------
revno: 1765
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-04-12 10:47:20 +0700
message:
  Improve the min/max value functionality.
removed:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/MinMaxValuesGeneratingService.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/MinMaxGeneratingAction.java
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/validation/
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/validation/MinMaxValuesGenerationService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/validation/
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/validation/DefaultMinMaxValuesGenerationService.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GenerateMinMaxValuesAction.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataanalysis/DataAnalysisService.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.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/resources/struts.xml
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/dataanalysis/GetAnalysisAction.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/dataanalysis/DataAnalysisService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataanalysis/DataAnalysisService.java	2010-04-08 14:13:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataanalysis/DataAnalysisService.java	2010-04-12 03:47:20 +0000
@@ -30,6 +30,7 @@
 import java.util.Collection;
 
 import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.datavalue.DeflatedDataValue;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 
@@ -42,6 +43,6 @@
 {
     String ID = DataAnalysisService.class.getName();
 
-    Collection<?> analyse( OrganisationUnit organisationUnit, Collection<DataElement> dataElements,
+    Collection<DeflatedDataValue> analyse( OrganisationUnit organisationUnit, Collection<DataElement> dataElements,
         Collection<Period> periods, Double stdDevFactor );
 }

=== added directory 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/validation'
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/validation/MinMaxValuesGenerationService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/validation/MinMaxValuesGenerationService.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/validation/MinMaxValuesGenerationService.java	2010-04-12 03:47:20 +0000
@@ -0,0 +1,47 @@
+package org.hisp.dhis.minmax.validation;
+
+/*
+ * Copyright (c) 2004-2009, 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.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.minmax.MinMaxDataElement;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+
+/**
+ * @author Chau Thu Tran
+ * @version $Id$
+ */
+public interface MinMaxValuesGenerationService
+{
+    String ID = MinMaxValuesGenerationService.class.getName();
+
+    Collection<MinMaxDataElement> getMinMaxValues( OrganisationUnit organisationUnit, Collection<DataElement> dataElements,
+        Collection<Period> periods, Double stdDevFactor );
+}

=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/MinMaxValuesGeneratingService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/MinMaxValuesGeneratingService.java	2010-04-07 13:38:05 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/MinMaxValuesGeneratingService.java	1970-01-01 00:00:00 +0000
@@ -1,72 +0,0 @@
-package org.hisp.dhis.dataanalysis;
-
-import static org.hisp.dhis.system.util.MathUtils.isEqual;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.minmax.MinMaxDataElement;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.period.Period;
-
-public class MinMaxValuesGeneratingService
-    implements DataAnalysisService
-{ // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataAnalysisStore dataAnalysisStore;
-
-    public void setDataAnalysisStore( DataAnalysisStore dataAnalysisStore )
-    {
-        this.dataAnalysisStore = dataAnalysisStore;
-    }
-
-    // -------------------------------------------------------------------------
-    // MinMaxValuesGeneratingService implementation
-    // -------------------------------------------------------------------------
-
-    public final Collection<MinMaxDataElement> analyse( OrganisationUnit organisationUnit,
-        Collection<DataElement> dataElements, Collection<Period> periods, Double stdDevFactor )
-    {
-        Collection<MinMaxDataElement> minMaxDataElements = new ArrayList<MinMaxDataElement>();
-
-        for ( DataElement dataElement : dataElements )
-        {
-            if ( dataElement.getType().equals( DataElement.VALUE_TYPE_INT ) )
-            {
-                Collection<DataElementCategoryOptionCombo> categoryOptionCombos = dataElement.getCategoryCombo()
-                    .getOptionCombos();
-
-                for ( DataElementCategoryOptionCombo categoryOptionCombo : categoryOptionCombos )
-                {
-                    Double stdDev = dataAnalysisStore.getStandardDeviation( dataElement, categoryOptionCombo,
-                        organisationUnit );
-                    
-                    if ( !isEqual( stdDev, 0.0 ) ) // No values found or no
-                    {
-                        Double avg = dataAnalysisStore.getAverage( dataElement, categoryOptionCombo, organisationUnit );
-
-                        double deviation = stdDev * stdDevFactor;
-                        Double lowerBound = avg - deviation;
-                        Double upperBound = avg + deviation;
-
-                        MinMaxDataElement minMaxDataElement = new MinMaxDataElement();
-                        minMaxDataElement.setDataElement( dataElement );
-                        minMaxDataElement.setOptionCombo( categoryOptionCombo );
-                        minMaxDataElement.setSource(  organisationUnit );
-                        minMaxDataElement.setMin( lowerBound.intValue() );
-                        minMaxDataElement.setMax( upperBound.intValue() );
-
-                        minMaxDataElements.add( minMaxDataElement );
-                    }
-                }
-            }
-        }
-
-        return minMaxDataElements;
-    }
-
-}

=== added directory 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/validation'
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/validation/DefaultMinMaxValuesGenerationService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/validation/DefaultMinMaxValuesGenerationService.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/validation/DefaultMinMaxValuesGenerationService.java	2010-04-12 03:47:20 +0000
@@ -0,0 +1,105 @@
+package org.hisp.dhis.minmax.validation;
+
+/*
+ * Copyright (c) 2004-2009, 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 static org.hisp.dhis.system.util.MathUtils.isEqual;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.hisp.dhis.dataanalysis.DataAnalysisStore;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.minmax.MinMaxDataElement;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+
+/**
+ * @author Chau Thu Tran
+ * @version $Id$
+ */
+public class DefaultMinMaxValuesGenerationService
+    implements MinMaxValuesGenerationService
+{ 
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private DataAnalysisStore dataAnalysisStore;
+
+    public void setDataAnalysisStore( DataAnalysisStore dataAnalysisStore )
+    {
+        this.dataAnalysisStore = dataAnalysisStore;
+    }
+
+    // -------------------------------------------------------------------------
+    // Implementation
+    // -------------------------------------------------------------------------
+
+    public final Collection<MinMaxDataElement> getMinMaxValues( OrganisationUnit organisationUnit,
+        Collection<DataElement> dataElements, Collection<Period> periods, Double stdDevFactor )
+    {
+        Collection<MinMaxDataElement> minMaxDataElements = new ArrayList<MinMaxDataElement>();
+
+        for ( DataElement dataElement : dataElements )
+        {
+            if ( dataElement.getType().equals( DataElement.VALUE_TYPE_INT ) )
+            {
+                Collection<DataElementCategoryOptionCombo> categoryOptionCombos = dataElement.getCategoryCombo()
+                    .getOptionCombos();
+
+                for ( DataElementCategoryOptionCombo categoryOptionCombo : categoryOptionCombos )
+                {
+                    Double stdDev = dataAnalysisStore.getStandardDeviation( dataElement, categoryOptionCombo,
+                        organisationUnit );
+                    
+                    if ( !isEqual( stdDev, 0.0 ) ) // No values found or no
+                    {
+                        Double avg = dataAnalysisStore.getAverage( dataElement, categoryOptionCombo, organisationUnit );
+
+                        double deviation = stdDev * stdDevFactor;
+                        Double lowerBound = avg - deviation;
+                        Double upperBound = avg + deviation;
+
+                        MinMaxDataElement minMaxDataElement = new MinMaxDataElement();
+                        minMaxDataElement.setDataElement( dataElement );
+                        minMaxDataElement.setOptionCombo( categoryOptionCombo );
+                        minMaxDataElement.setSource(  organisationUnit );
+                        minMaxDataElement.setMin( lowerBound.intValue() );
+                        minMaxDataElement.setMax( upperBound.intValue() );
+
+                        minMaxDataElements.add( minMaxDataElement );
+                    }
+                }
+            }
+        }
+
+        return minMaxDataElements;
+    }
+
+}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2010-04-09 17:04:21 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2010-04-12 03:47:20 +0000
@@ -380,12 +380,6 @@
       ref="org.hisp.dhis.dataanalysis.jdbc.DataAnalysisStore"/>  
   </bean>
   
-  <bean id="org.hisp.dhis.dataanalysis.MinMaxValuesGeneratingService" 
-    class="org.hisp.dhis.dataanalysis.MinMaxValuesGeneratingService">
-    <property name="dataAnalysisStore"
-      ref="org.hisp.dhis.dataanalysis.jdbc.DataAnalysisStore"/>
-  </bean>
-  
   <bean id="dataAnalysisServiceProvider"
 	class="org.hisp.dhis.common.ServiceProvider">
 	<property name="services">
@@ -406,10 +400,6 @@
                 <key><value>followup</value></key>
                 <ref bean="org.hisp.dhis.dataanalysis.FollowupAnalysisService"/>
             </entry>
-            <!-- <entry>
-                <key><value>minmax</value></key>
-                <ref bean="org.hisp.dhis.dataanalysis.MinMaxValuesGeneratingService"/>
-            </entry> -->
 		</map>		
 	</property>
   </bean>
@@ -706,6 +696,14 @@
     </property>
   </bean>
   
+  <!-- Min/Max validation -->
+  
+ <bean id="org.hisp.dhis.minmax.validation.MinMaxValuesGenerationService"
+    class="org.hisp.dhis.minmax.validation.DefaultMinMaxValuesGenerationService">
+    <property name="dataAnalysisStore"
+      ref="org.hisp.dhis.dataanalysis.jdbc.DataAnalysisStore"/>
+  </bean>
+  
   <!-- AOP definitions -->
   
   <aop:config>

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.java	2010-04-07 13:38:05 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.java	2010-04-12 03:47:20 +0000
@@ -162,10 +162,10 @@
         // Min-max and outlier analysis
         // ---------------------------------------------------------------------
 
-        Collection<DeflatedDataValue> stdDevs = (Collection<DeflatedDataValue>)stdDevOutlierAnalysisService.
+        Collection<DeflatedDataValue> stdDevs = stdDevOutlierAnalysisService.
             analyse( orgUnit, dataSet.getDataElements(), ListUtils.getCollection( period ), STD_DEV );
 
-        Collection<DeflatedDataValue> minMaxs = (Collection<DeflatedDataValue>)minMaxOutlierAnalysisService.
+        Collection<DeflatedDataValue> minMaxs = minMaxOutlierAnalysisService.
             analyse( orgUnit, dataSet.getDataElements(), ListUtils.getCollection( period ), null );
         
         dataValues = CollectionUtils.union( stdDevs, minMaxs );

=== added 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	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GenerateMinMaxValuesAction.java	2010-04-12 03:47:20 +0000
@@ -0,0 +1,229 @@
+package org.hisp.dhis.dataadmin.action.minmaxvalidation;
+
+/*
+ * Copyright (c) 2004-2007, 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 java.util.Date;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.minmax.MinMaxDataElement;
+import org.hisp.dhis.minmax.MinMaxDataElementService;
+import org.hisp.dhis.minmax.validation.MinMaxValuesGenerationService;
+import org.hisp.dhis.options.SystemSettingManager;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $Id$
+ */
+
+public class GenerateMinMaxValuesAction
+    implements Action
+{
+    // -------------------------------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------------------------------
+
+    private OrganisationUnitSelectionManager organisationUnitSelectionManager;
+
+    private DataSetService dataSetService;
+
+    private PeriodService periodService;
+
+    private MinMaxValuesGenerationService minMaxValuesGenerationService;
+
+    private MinMaxDataElementService minMaxDataElementService;
+
+    private SystemSettingManager systemSettingManager;
+
+    // -------------------------------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------------------------------
+
+    private Integer[] dataSetIds;
+
+    private String startDateStr;
+
+    private String endDateStr;
+
+    private String message;
+
+    private I18nFormat format;
+
+    private I18n i18n;
+
+    // -------------------------------------------------------------------------------------------------
+    // Setters
+    // -------------------------------------------------------------------------------------------------
+
+    public void setOrganisationUnitSelectionManager( OrganisationUnitSelectionManager organisationUnitSelectionManager )
+    {
+        this.organisationUnitSelectionManager = organisationUnitSelectionManager;
+    }
+
+    public void setSystemSettingManager( SystemSettingManager systemSettingManager )
+    {
+        this.systemSettingManager = systemSettingManager;
+    }
+
+    public void setDataSetService( DataSetService dataSetService )
+    {
+        this.dataSetService = dataSetService;
+    }
+
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    }
+
+    public void setMessage( String message )
+    {
+        this.message = message;
+    }
+
+    public String getMessage()
+    {
+        return message;
+    }
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    public void setMinMaxValuesGenerationService( MinMaxValuesGenerationService minMaxValuesGenerationService )
+    {
+        this.minMaxValuesGenerationService = minMaxValuesGenerationService;
+    }
+
+    public void setMinMaxDataElementService( MinMaxDataElementService minMaxDataElementService )
+    {
+        this.minMaxDataElementService = minMaxDataElementService;
+    }
+
+    public void setDataSetIds( Integer[] dataSetIds )
+    {
+        this.dataSetIds = dataSetIds;
+    }
+
+    public void setStartDateStr( String startDateStr )
+    {
+        this.startDateStr = startDateStr;
+    }
+
+    public void setEndDateStr( String endDateStr )
+    {
+        this.endDateStr = endDateStr;
+    }
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
+    // -------------------------------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        if ( startDateStr == null || endDateStr == null )
+        {
+            return INPUT;
+        }
+        
+        Collection<OrganisationUnit> orgUnits = organisationUnitSelectionManager.getSelectedOrganisationUnits();
+
+        if ( orgUnits == null )
+        {
+            message = i18n.getString( "not_choose_organisation" );
+            return INPUT;
+        }
+        
+        // Get startDate and endDate
+        Date startDate = format.parseDate( startDateStr.trim() );
+        Date endDate = format.parseDate( endDateStr.trim() );
+
+        // Get factor
+        Double factor = (Double) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_FACTOR_OF_DEVIATION );
+
+        for ( Integer dataSetId : dataSetIds )
+        {
+            // Get dataset
+            DataSet dataSet = dataSetService.getDataSet( dataSetId );
+
+            for ( OrganisationUnit orgUnit : orgUnits )
+            {
+                if ( orgUnit.getDataSets().contains( dataSet ) )
+                {
+                    // Get periods
+                    Collection<Period> periods = periodService.getPeriodsBetweenDates( dataSet.getPeriodType(),
+                        startDate, endDate );
+
+                    // Get min/max values for dataelements into dataset
+                    Collection<MinMaxDataElement> minMaxDataElements = (Collection<MinMaxDataElement>) minMaxValuesGenerationService
+                        .getMinMaxValues( orgUnit, dataSet.getDataElements(), periods, factor );
+
+                    // Save min / max value
+                    for ( MinMaxDataElement minMaxDataElement : minMaxDataElements )
+                    {
+                        MinMaxDataElement minMaxValue = minMaxDataElementService.getMinMaxDataElement(
+                            minMaxDataElement.getSource(), minMaxDataElement.getDataElement(), minMaxDataElement
+                                .getOptionCombo() );
+
+                        if ( minMaxValue != null )
+                        {
+                            minMaxValue.setMax( minMaxDataElement.getMax() );
+                            minMaxValue.setMin( minMaxDataElement.getMin() );
+                            minMaxDataElementService.updateMinMaxDataElement( minMaxValue );
+                        }
+                        else
+                        {
+                            minMaxDataElement.setGenerated( true );
+                            minMaxDataElementService.addMinMaxDataElement( minMaxDataElement );
+                        }
+                    }
+                }
+            }
+        }
+
+        message = i18n.getString( "generate_values_success" );
+
+        return SUCCESS;
+    }
+}

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/MinMaxGeneratingAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/MinMaxGeneratingAction.java	2010-04-07 13:38:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/MinMaxGeneratingAction.java	1970-01-01 00:00:00 +0000
@@ -1,230 +0,0 @@
-package org.hisp.dhis.dataadmin.action.minmaxvalidation;
-
-/*
- * Copyright (c) 2004-2007, 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 java.util.Date;
-
-import org.hisp.dhis.dataanalysis.DataAnalysisService;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.minmax.MinMaxDataElement;
-import org.hisp.dhis.minmax.MinMaxDataElementService;
-import org.hisp.dhis.options.SystemSettingManager;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Chau Thu Tran
- * @version $Id$
- */
-
-public class MinMaxGeneratingAction
-    implements Action
-{
-    // -------------------------------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------------------------------
-
-    private OrganisationUnitSelectionManager organisationUnitSelectionManager;
-
-    private DataSetService dataSetService;
-
-    private PeriodService periodService;
-
-    private DataAnalysisService minMaxValuesGeneratingService;
-
-    private MinMaxDataElementService minMaxDataElementService;
-
-    private SystemSettingManager systemSettingManager;
-
-    // -------------------------------------------------------------------------------------------------
-    // Input
-    // -------------------------------------------------------------------------------------------------
-
-    private Integer[] dataSetIds;
-
-    private String startDateStr;
-
-    private String endDateStr;
-
-    private String message;
-
-    private I18nFormat format;
-
-    private I18n i18n;
-
-    // -------------------------------------------------------------------------------------------------
-    // Setters
-    // -------------------------------------------------------------------------------------------------
-
-    public void setOrganisationUnitSelectionManager( OrganisationUnitSelectionManager organisationUnitSelectionManager )
-    {
-        this.organisationUnitSelectionManager = organisationUnitSelectionManager;
-    }
-
-    public void setSystemSettingManager( SystemSettingManager systemSettingManager )
-    {
-        this.systemSettingManager = systemSettingManager;
-    }
-
-    public void setDataSetService( DataSetService dataSetService )
-    {
-        this.dataSetService = dataSetService;
-    }
-
-    public void setPeriodService( PeriodService periodService )
-    {
-        this.periodService = periodService;
-    }
-
-    public void setMessage( String message )
-    {
-        this.message = message;
-    }
-
-    public String getMessage()
-    {
-        return message;
-    }
-
-    public void setI18n( I18n i18n )
-    {
-        this.i18n = i18n;
-    }
-
-    public void setMinMaxValuesGeneratingService( DataAnalysisService minMaxValuesGeneratingService )
-    {
-        this.minMaxValuesGeneratingService = minMaxValuesGeneratingService;
-    }
-
-    public void setMinMaxDataElementService( MinMaxDataElementService minMaxDataElementService )
-    {
-        this.minMaxDataElementService = minMaxDataElementService;
-    }
-
-    public void setDataSetIds( Integer[] dataSetIds )
-    {
-        this.dataSetIds = dataSetIds;
-    }
-
-    public void setStartDateStr( String startDateStr )
-    {
-        this.startDateStr = startDateStr;
-    }
-
-    public void setEndDateStr( String endDateStr )
-    {
-        this.endDateStr = endDateStr;
-    }
-
-    public void setFormat( I18nFormat format )
-    {
-        this.format = format;
-    }
-
-    // -------------------------------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------------------------------
-
-    @Override
-    public String execute()
-        throws Exception
-    {
-        Collection<OrganisationUnit> orgUnits = organisationUnitSelectionManager.getSelectedOrganisationUnits();
-
-        if ( orgUnits == null )
-        {
-            message = i18n.getString( "not_choose_organisation" );
-            return INPUT;
-        }
-
-        if ( startDateStr == null || endDateStr == null )
-        {
-            return INPUT;
-        }
-
-        // Get startDate and endDate
-        Date startDate = format.parseDate( startDateStr.trim() );
-        ;
-        Date endDate = format.parseDate( endDateStr.trim() );
-
-        // Get factor
-        Double factor = (Double) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_FACTOR_OF_DEVIATION );
-
-        for ( Integer dataSetId : dataSetIds )
-        {
-            // Get dataset
-            DataSet dataSet = dataSetService.getDataSet( dataSetId );
-
-            for ( OrganisationUnit orgUnit : orgUnits )
-            {
-                if ( orgUnit.getDataSets().contains( dataSet ) )
-                {
-                    // Get periods
-                    Collection<Period> periods = periodService.getPeriodsBetweenDates( dataSet.getPeriodType(),
-                        startDate, endDate );
-
-                    // Get min/max values for dataelements into dataset
-                    Collection<MinMaxDataElement> minMaxDataElements = (Collection<MinMaxDataElement>) minMaxValuesGeneratingService
-                        .analyse( orgUnit, dataSet.getDataElements(), periods, factor );
-
-                    // Save min / max value
-                    for ( MinMaxDataElement minMaxDataElement : minMaxDataElements )
-                    {
-                        MinMaxDataElement minMaxValue = minMaxDataElementService.getMinMaxDataElement(
-                            minMaxDataElement.getSource(), minMaxDataElement.getDataElement(), minMaxDataElement
-                                .getOptionCombo() );
-
-                        if ( minMaxValue != null )
-                        {
-                            minMaxValue.setMax( minMaxDataElement.getMax() );
-                            minMaxValue.setMin( minMaxDataElement.getMin() );
-                            minMaxDataElementService.updateMinMaxDataElement( minMaxValue );
-                        }
-                        else
-                        {
-                            minMaxDataElement.setGenerated( true );
-                            minMaxDataElementService.addMinMaxDataElement( minMaxDataElement );
-                        }
-                    }
-                }
-            }
-        }
-
-        message = i18n.getString( "generate_values_success" );
-
-        return SUCCESS;
-    }
-}

=== 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	2010-04-07 12:27:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml	2010-04-12 03:47:20 +0000
@@ -343,8 +343,8 @@
 	</bean>
 
 	<bean
-		id="org.hisp.dhis.dataadmin.action.minmaxvalidation.MinMaxGeneratingAction"
-		class="org.hisp.dhis.dataadmin.action.minmaxvalidation.MinMaxGeneratingAction">
+		id="org.hisp.dhis.dataadmin.action.minmaxvalidation.GenerateMinMaxValuesAction"
+		class="org.hisp.dhis.dataadmin.action.minmaxvalidation.GenerateMinMaxValuesAction">
 		<property name="organisationUnitSelectionManager">
 			<ref bean="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
 		</property>
@@ -352,8 +352,8 @@
 			<ref bean="org.hisp.dhis.dataset.DataSetService" />
 		</property>
 		<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
-		<property name="minMaxValuesGeneratingService"
-			ref="org.hisp.dhis.dataanalysis.MinMaxValuesGeneratingService" />
+		<property name="minMaxValuesGenerationService"
+			ref="org.hisp.dhis.minmax.validation.MinMaxValuesGenerationService" />
 		<property name="minMaxDataElementService"
 			ref="org.hisp.dhis.minmax.MinMaxDataElementService" />
 		<property name="systemSettingManager">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml	2010-04-07 12:27:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml	2010-04-12 03:47:20 +0000
@@ -370,7 +370,7 @@
 		<!-- Min/Max validation -->
 		
 		<action name="getMinMaxValidationParams"
-			class="org.hisp.dhis.dataadmin.action.minmaxvalidation.MinMaxGeneratingAction">
+			class="org.hisp.dhis.dataadmin.action.minmaxvalidation.GenerateMinMaxValuesAction">
 			<result name="success" type="chain">
 				getMinMaxValidationParamsChain</result>
 			<result name="input" type="chain">

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/dataanalysis/GetAnalysisAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/dataanalysis/GetAnalysisAction.java	2010-04-07 20:55:29 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/dataanalysis/GetAnalysisAction.java	2010-04-12 03:47:20 +0000
@@ -220,7 +220,7 @@
         {
             log.info( "Data analysis type: " + key );
             
-            dataValues = (Collection<DeflatedDataValue>) service.analyse( organisationUnit, dataElements, periods, standardDeviation );
+            dataValues = service.analyse( organisationUnit, dataElements, periods, standardDeviation );
         }
         
         return SUCCESS;