← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16149: Validation, method naming fix

 

------------------------------------------------------------
revno: 16149
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-07-16 14:15:52 +0200
message:
  Validation, method naming fix
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/Validator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/ValidatorThread.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/validation/Validator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/Validator.java	2014-07-16 11:19:08 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/Validator.java	2014-07-16 12:15:52 +0000
@@ -57,7 +57,7 @@
      * Evaluates validation rules for a collection of organisation units.
      * This method breaks the job down by organisation unit. It assigns the
      * evaluation for each organisation unit to a task that can be evaluated
-     * independently in a multithreaded environment.
+     * independently in a multi-threaded environment.
      * 
      * @param sources the organisation units in which to run the validation rules
      * @param periods the periods of data to check

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/ValidatorThread.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/ValidatorThread.java	2014-07-16 11:19:08 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/ValidatorThread.java	2014-07-16 12:15:52 +0000
@@ -97,29 +97,30 @@
                 if ( !rules.isEmpty() )
                 {
                     Set<DataElement> recursiveCurrentDataElements = getRecursiveCurrentDataElements( rules );
+                    
                     for ( Period period : periodTypeX.getPeriods() )
                     {
-                        MapMap<Integer, DataElementOperand, Date> lastUpdatedMap2 = new MapMap<Integer, DataElementOperand, Date>();
-                        SetMap<Integer, DataElementOperand> incompleteValuesMap2 = new SetMap<Integer, DataElementOperand>();
-                        MapMap<Integer, DataElementOperand, Double> currentValueMap2 = getValueMap2( periodTypeX,
-                                periodTypeX.getDataElements(), sourceDataElements, recursiveCurrentDataElements,
-                                periodTypeX.getAllowedPeriodTypes(), period, sourceX.getSource(), lastUpdatedMap2, incompleteValuesMap2 );
+                        MapMap<Integer, DataElementOperand, Date> lastUpdatedMap = new MapMap<Integer, DataElementOperand, Date>();
+                        SetMap<Integer, DataElementOperand> incompleteValuesMap = new SetMap<Integer, DataElementOperand>();
+                        MapMap<Integer, DataElementOperand, Double> currentValueMap = getValueMap( periodTypeX,
+                            periodTypeX.getDataElements(), sourceDataElements, recursiveCurrentDataElements,
+                            periodTypeX.getAllowedPeriodTypes(), period, sourceX.getSource(), lastUpdatedMap, incompleteValuesMap );
                         
                         log.trace( "Source " + sourceX.getSource().getName()
                             + " [" + period.getStartDate() + " - " + period.getEndDate() + "]"
-                            + " currentValueMap2[" + currentValueMap2.size() + "]" );
+                            + " currentValueMap[" + currentValueMap.size() + "]" );
 
                         for ( ValidationRule rule : rules )
                         {
-                            if ( evaluateCheck( currentValueMap2, lastUpdatedMap2, rule ) )
+                            if ( evaluateCheck( currentValueMap, lastUpdatedMap, rule ) )
                             {
                                 Map<Integer, Double> leftSideValues = getExpressionValueMap( rule.getLeftSide(),
-                                        currentValueMap2, incompleteValuesMap2 );
+                                        currentValueMap, incompleteValuesMap );
 
                                 if ( !leftSideValues.isEmpty() || Operator.compulsory_pair.equals( rule.getOperator() ) )
                                 {
                                     Map<Integer, Double> rightSideValues = getRightSideValue( sourceX.getSource(), periodTypeX, period, rule,
-                                            currentValueMap2, sourceDataElements );
+                                            currentValueMap, sourceDataElements );
 
                                     if ( !rightSideValues.isEmpty() || Operator.compulsory_pair.equals( rule.getOperator() ) )
                                     {
@@ -437,7 +438,7 @@
         {
             Set<DataElement> dataElements = rule.getRightSide().getDataElementsInExpression();
             SetMap<Integer, DataElementOperand> incompleteValuesMap = new SetMap<Integer, DataElementOperand>();
-            MapMap<Integer, DataElementOperand, Double> dataValueMapByAttributeCombo = getValueMap2( periodTypeX, dataElements,
+            MapMap<Integer, DataElementOperand, Double> dataValueMapByAttributeCombo = getValueMap( periodTypeX, dataElements,
                 sourceDataElements, dataElements, allowedPeriodTypes, period, source, null, incompleteValuesMap );
             sampleValuesMap.putValueMap( getExpressionValueMap( rule.getRightSide(), dataValueMapByAttributeCombo, incompleteValuesMap ) );
         }
@@ -448,7 +449,7 @@
      * combo.
      *
      * @param expression expression to evaluate.
-     * @param valueMap2 Map of value maps, by attribute option combo.
+     * @param valueMap Map of value maps, by attribute option combo.
      * @param incompleteValuesMap map of values that were incomplete.
      * @return map of values.
      */
@@ -544,7 +545,7 @@
      *        but not from all children, mapped by attribute option combo.
      * @return map of attribute option combo to map of values found.
      */
-    private MapMap<Integer, DataElementOperand, Double> getValueMap2( PeriodTypeExtended periodTypeX,
+    private MapMap<Integer, DataElementOperand, Double> getValueMap( PeriodTypeExtended periodTypeX,
             Collection<DataElement> ruleDataElements, Collection<DataElement> sourceDataElements,
             Set<DataElement> recursiveDataElements, Collection<PeriodType> allowedPeriodTypes, Period period,
             OrganisationUnit source, MapMap<Integer, DataElementOperand, Date> lastUpdatedMap,
@@ -586,7 +587,7 @@
             for ( OrganisationUnit child : source.getChildren() )
             {
                 Collection<DataElement> childDataElements = periodTypeX.getSourceDataElements().get( child );
-                MapMap<Integer, DataElementOperand, Double> childMap = getValueMap2( periodTypeX,
+                MapMap<Integer, DataElementOperand, Double> childMap = getValueMap( periodTypeX,
                     recursiveDataElementsNeeded, childDataElements, recursiveDataElementsNeeded, allowedPeriodTypes,
                     period, child, lastUpdatedMap, incompleteValuesMap );