dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39744
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20151: minor, use AggregationType in ValidationUtils
------------------------------------------------------------
revno: 20151
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-09-15 12:39:53 +0700
message:
minor, use AggregationType in ValidationUtils
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/analytics/AggregationType.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.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/analytics/AggregationType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/analytics/AggregationType.java 2015-08-21 01:47:02 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/analytics/AggregationType.java 2015-09-15 05:39:53 +0000
@@ -55,7 +55,7 @@
private final String value;
- private AggregationType( String value )
+ AggregationType( String value )
{
this.value = value;
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2015-09-14 18:06:48 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java 2015-09-15 05:39:53 +0000
@@ -32,6 +32,7 @@
import org.apache.commons.validator.routines.DateValidator;
import org.apache.commons.validator.routines.EmailValidator;
import org.apache.commons.validator.routines.UrlValidator;
+import org.hisp.dhis.analytics.AggregationType;
import org.hisp.dhis.common.ValueType;
import org.hisp.dhis.commons.util.TextUtils;
import org.hisp.dhis.dataelement.DataElement;
@@ -43,8 +44,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import static org.hisp.dhis.dataelement.DataElement.*;
-
/**
* @author Lars Helge Overland
*/
@@ -388,10 +387,10 @@
*/
public static boolean dataValueIsZeroAndInsignificant( String value, DataElement dataElement )
{
- String aggOperator = dataElement.getAggregationOperator();
+ AggregationType aggregationType = dataElement.getAggregationType();
return dataElement.getValueType().isNumeric() && MathUtils.isZero( value ) && !dataElement.isZeroIsSignificant() &&
- !(AGGREGATION_OPERATOR_AVERAGE_SUM.equals( aggOperator ) || AGGREGATION_OPERATOR_AVERAGE.equals( aggOperator ));
+ !(aggregationType == AggregationType.AVERAGE_SUM_ORG_UNIT || aggregationType == AggregationType.AVERAGE);
}
/**