← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19097: Minor

 

------------------------------------------------------------
revno: 19097
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-05-06 15:36:35 +0200
message:
  Minor
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataanalysis/MinMaxDataAnalysisService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/SchemaUtils.java
  dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ExpressionUtilsTest.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/MinMaxDataAnalysisService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataanalysis/MinMaxDataAnalysisService.java	2015-05-03 13:14:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataanalysis/MinMaxDataAnalysisService.java	2015-05-06 13:36:35 +0000
@@ -29,7 +29,6 @@
  */
 
 import java.util.Collection;
-import java.util.Date;
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.organisationunit.OrganisationUnit;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/SchemaUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/SchemaUtils.java	2015-04-28 08:57:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/SchemaUtils.java	2015-05-06 13:36:35 +0000
@@ -28,19 +28,26 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import com.google.common.collect.Sets;
 import com.google.common.primitives.Primitives;
+
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.schema.annotation.PropertyRange;
 import org.springframework.util.Assert;
 
 import java.util.Collection;
 import java.util.Date;
+import java.util.Set;
+
+import static org.hisp.dhis.schema.PropertyType.*;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
 public final class SchemaUtils
 {
+    private static final Set<PropertyType> PROPS_IGNORE_MINMAX = Sets.newHashSet( REFERENCE, BOOLEAN, DATE, CONSTANT );
+    
     public static void updatePropertyTypes( Property property )
     {
         Assert.notNull( property );
@@ -85,17 +92,10 @@
                 property.setMax( Integer.MAX_VALUE );
             }
 
-            switch ( property.getPropertyType() )
+            if ( PROPS_IGNORE_MINMAX.contains( property.getPropertyType() ) )
             {
-                // min-max for these property types make no sense, so just clear it out
-                case REFERENCE:
-                case BOOLEAN:
-                case DATE:
-                case CONSTANT:
-                {
-                    property.setMin( null );
-                    property.setMax( null );
-                }
+                property.setMin( null );
+                property.setMax( null );
             }
         }
         else

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ExpressionUtilsTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ExpressionUtilsTest.java	2015-04-29 11:33:31 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ExpressionUtilsTest.java	2015-05-06 13:36:35 +0000
@@ -72,10 +72,12 @@
         assertTrue( ExpressionUtils.isTrue( "v2 < 18", vars ) );
         assertTrue( ExpressionUtils.isTrue( "v3 == 'goat'", vars ) );
         assertTrue( ExpressionUtils.isTrue( "v4 == 'horse'", vars ) );
+        assertTrue( ExpressionUtils.isTrue( "v4 == \"horse\"", vars ) );
 
         assertFalse( ExpressionUtils.isTrue( "v1 < 1", vars ) );
         assertFalse( ExpressionUtils.isTrue( "v2 > 18", vars ) );
         assertFalse( ExpressionUtils.isTrue( "v3 == 'cow'", vars ) );
         assertFalse( ExpressionUtils.isTrue( "v4 == 'goat'", vars ) );
+        assertFalse( ExpressionUtils.isTrue( "v4 == \"goat\"", vars ) );
     }
 }