dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17495
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6979: Validation code cleanup
------------------------------------------------------------
revno: 6979
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-05-17 18:47:13 +0200
message:
Validation code cleanup
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java
dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java
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/GetMinMaxValidationParamsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/RemoveMinMaxValueAction.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-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java 2011-05-22 13:02:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java 2012-05-17 16:47:13 +0000
@@ -75,14 +75,14 @@
public Double getStandardDeviation( DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo, OrganisationUnit organisationUnit )
{
- final String sql = statementBuilder.getStandardDeviation(dataElement.getId(), categoryOptionCombo.getId(), organisationUnit.getId() );
+ final String sql = statementBuilder.getStandardDeviation( dataElement.getId(), categoryOptionCombo.getId(), organisationUnit.getId() );
return statementManager.getHolder().queryForDouble( sql );
}
public Double getAverage( DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo, OrganisationUnit organisationUnit )
{
- final String sql = statementBuilder.getStandardDeviation(dataElement.getId(), categoryOptionCombo.getId(), organisationUnit.getId() );
+ final String sql = statementBuilder.getAverage( dataElement.getId(), categoryOptionCombo.getId(), organisationUnit.getId() );
return statementManager.getHolder().queryForDouble( sql );
}
=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java 2012-03-19 07:56:03 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java 2012-05-17 16:47:13 +0000
@@ -129,7 +129,6 @@
"WHERE dataelementid='" + dataElementId + "' " +
"AND categoryoptioncomboid='" + categoryOptionComboId + "' " +
"AND sourceid='" + organisationUnitId + "'";
-
}
public String getAverage( int dataElementId, int categoryOptionComboId, int organisationUnitId )
=== 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 2012-02-02 20:01:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GenerateMinMaxValuesAction.java 2012-05-17 16:47:13 +0000
@@ -43,9 +43,7 @@
/**
* @author Chau Thu Tran
- * @version $Id$
*/
-
public class GenerateMinMaxValuesAction
implements Action
{
@@ -63,11 +61,6 @@
private SelectionTreeManager selectionTreeManager;
- public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
- {
- this.selectionTreeManager = selectionTreeManager;
- }
-
// -------------------------------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------------------------------
@@ -82,14 +75,29 @@
// Setters
// -------------------------------------------------------------------------------------------------
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ public void setMinMaxValuesGenerationService( MinMaxValuesGenerationService minMaxValuesGenerationService )
+ {
+ this.minMaxValuesGenerationService = minMaxValuesGenerationService;
+ }
+
+ public void setMinMaxDataElementService( MinMaxDataElementService minMaxDataElementService )
+ {
+ this.minMaxDataElementService = minMaxDataElementService;
+ }
+
public void setSystemSettingManager( SystemSettingManager systemSettingManager )
{
this.systemSettingManager = systemSettingManager;
}
- public void setDataSetService( DataSetService dataSetService )
+ public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
{
- this.dataSetService = dataSetService;
+ this.selectionTreeManager = selectionTreeManager;
}
public void setMessage( String message )
@@ -107,16 +115,6 @@
this.i18n = i18n;
}
- public void setMinMaxValuesGenerationService( MinMaxValuesGenerationService minMaxValuesGenerationService )
- {
- this.minMaxValuesGenerationService = minMaxValuesGenerationService;
- }
-
- public void setMinMaxDataElementService( MinMaxDataElementService minMaxDataElementService )
- {
- this.minMaxDataElementService = minMaxDataElementService;
- }
-
public void setDataSets( Integer[] dataSets )
{
this.dataSets = dataSets;
@@ -130,12 +128,6 @@
public String execute()
throws Exception
{
- // if ( dataSetIds == null )
- // {
- // selectionTreeManager.clearSelectedOrganisationUnits();
- // return INPUT;
- // }
-
Collection<OrganisationUnit> orgUnits = selectionTreeManager.getReloadedSelectedOrganisationUnits();
if ( orgUnits == null || orgUnits.size() == 0 )
@@ -144,25 +136,20 @@
return INPUT;
}
- // Get factor
Double factor = (Double) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_FACTOR_OF_DEVIATION,
2.0 );
for ( Integer dataSetId : dataSets )
{
- // Get dataset
DataSet dataSet = dataSetService.getDataSet( dataSetId );
for ( OrganisationUnit orgUnit : orgUnits )
{
if ( orgUnit.getDataSets().contains( dataSet ) )
{
-
- // Get min/max values for dataelements into dataset
Collection<MinMaxDataElement> minMaxDataElements = (Collection<MinMaxDataElement>) minMaxValuesGenerationService
.getMinMaxValues( orgUnit, dataSet.getDataElements(), factor );
- // Save min / max value
for ( MinMaxDataElement minMaxDataElement : minMaxDataElements )
{
MinMaxDataElement minMaxValue = minMaxDataElementService.getMinMaxDataElement(
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GetMinMaxValidationParamsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GetMinMaxValidationParamsAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GetMinMaxValidationParamsAction.java 2012-05-17 16:47:13 +0000
@@ -36,8 +36,6 @@
/**
* @author Chau Thu Tran
- * @version $Id$
- *
*/
public class GetMinMaxValidationParamsAction
implements Action
=== 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 2012-02-02 20:01:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/RemoveMinMaxValueAction.java 2012-05-17 16:47:13 +0000
@@ -27,10 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/**
- * @author Chau Thu Tran
- * @version $Id$
- */
import java.util.Collection;
import org.hisp.dhis.dataset.DataSet;
@@ -45,6 +41,9 @@
import com.opensymphony.xwork2.Action;
+/**
+ * @author Chau Thu Tran
+ */
public class RemoveMinMaxValueAction
implements Action
{
@@ -137,30 +136,23 @@
return INPUT;
}
- // Get factor
- Double factor = (Double) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_FACTOR_OF_DEVIATION,
- 2.0 );
+ Double factor = (Double) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_FACTOR_OF_DEVIATION, 2.0 );
for ( Integer dataSetId : dataSets )
{
- // Get dataset
DataSet dataSet = dataSetService.getDataSet( dataSetId );
for ( OrganisationUnit orgUnit : orgUnits )
{
if ( orgUnit.getDataSets().contains( dataSet ) )
{
-
- // Get min/max values for dataelements into dataset
Collection<MinMaxDataElement> minMaxDataElements = (Collection<MinMaxDataElement>) minMaxValuesGenerationService
.getMinMaxValues( orgUnit, dataSet.getDataElements(), factor );
- // Save min / max value
for ( MinMaxDataElement minMaxDataElement : minMaxDataElements )
{
MinMaxDataElement minMaxValue = minMaxDataElementService.getMinMaxDataElement(
- minMaxDataElement.getSource(), minMaxDataElement.getDataElement(), minMaxDataElement
- .getOptionCombo() );
+ minMaxDataElement.getSource(), minMaxDataElement.getDataElement(), minMaxDataElement.getOptionCombo() );
if ( minMaxValue != null )
{