← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14862: renamed TrackedEntityAttribute.TYPE_INT => TYPE_NUMBER (since it actually is a numeric attribute)...

 

------------------------------------------------------------
revno: 14862
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-04-15 10:48:38 +0700
message:
  renamed TrackedEntityAttribute.TYPE_INT => TYPE_NUMBER (since it actually is a numeric attribute). Updated validation.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityFormService.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeServiceTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeStoreTest.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SaveMobileProgramEnrollmentAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.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/trackedentity/TrackedEntityAttribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java	2014-04-13 13:14:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java	2014-04-15 03:48:38 +0000
@@ -59,7 +59,7 @@
 
     public static final String TYPE_STRING = "string";
 
-    public static final String TYPE_INT = "number";
+    public static final String TYPE_NUMBER = "number";
 
     public static final String VALUE_TYPE_LETTER = "letter";
 
@@ -135,7 +135,7 @@
      */
     public boolean isNumericType()
     {
-        return TYPE_INT.equals( valueType );
+        return TYPE_NUMBER.equals( valueType );
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java	2014-04-14 05:11:56 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java	2014-04-15 03:48:38 +0000
@@ -627,7 +627,7 @@
             importConflicts.add( new ImportConflict( "Attribute.value", "Value length is greater than 256 chars." ) );
         }
 
-        if ( TrackedEntityAttribute.TYPE_INT.equals( teAttribute.getValueType() ) && !MathUtils.isInteger( attribute.getValue() ) )
+        if ( TrackedEntityAttribute.TYPE_NUMBER.equals( teAttribute.getValueType() ) && !MathUtils.isNumeric( attribute.getValue() ) )
         {
             importConflicts.add( new ImportConflict( "Attribute.value", "Value is not integer." ) );
         }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java	2014-04-14 05:11:56 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java	2014-04-15 03:48:38 +0000
@@ -461,7 +461,7 @@
             importConflicts.add( new ImportConflict( "Attribute.value", "Value length is greater than 256 chars." ) );
         }
 
-        if ( TrackedEntityAttribute.TYPE_INT.equals( teAttribute.getValueType() ) && !MathUtils.isInteger( attribute.getValue() ) )
+        if ( TrackedEntityAttribute.TYPE_NUMBER.equals( teAttribute.getValueType() ) && !MathUtils.isNumeric( attribute.getValue() ) )
         {
             importConflicts.add( new ImportConflict( "Attribute.value", "Value is not integer." ) );
         }

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityFormService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityFormService.java	2014-03-28 07:24:57 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityFormService.java	2014-04-15 03:48:38 +0000
@@ -286,7 +286,7 @@
             + "\" tabindex=\"" + index + "\" style=\"" + style + "\"";
 
         inputHtml += "\" class=\"" + hidden + " {validate:{required:" + mandatory;
-        if ( TrackedEntityAttribute.TYPE_INT.equals( attribute.getValueType() ) )
+        if ( TrackedEntityAttribute.TYPE_NUMBER.equals( attribute.getValueType() ) )
         {
             inputHtml += ",number:true";
         }

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java	2014-04-12 15:32:37 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java	2014-04-15 03:48:38 +0000
@@ -543,7 +543,7 @@
 
                         String type = attributeValue.getAttribute().getValueType();
                         // For integer type
-                        if ( type.equals( TrackedEntityAttribute.TYPE_INT ) )
+                        if ( type.equals( TrackedEntityAttribute.TYPE_NUMBER ) )
                         {
                             int value1 = Integer.parseInt( value );
                             int value2 = Integer.parseInt( criteria.getValue() );

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeServiceTest.java	2014-03-20 15:05:57 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeServiceTest.java	2014-04-15 03:48:38 +0000
@@ -66,7 +66,7 @@
     {
         attributeA = createTrackedEntityAttribute( 'A' );
         attributeB = createTrackedEntityAttribute( 'B' );
-        attributeC = createTrackedEntityAttribute( 'C', TrackedEntityAttribute.TYPE_INT );
+        attributeC = createTrackedEntityAttribute( 'C', TrackedEntityAttribute.TYPE_NUMBER );
 
         List<TrackedEntityAttribute> attributesA = new ArrayList<TrackedEntityAttribute>();
         attributesA.add( attributeA );
@@ -86,7 +86,7 @@
         assertTrue( attributes.contains( attributeA ) );
         assertTrue( attributes.contains( attributeB ) );
 
-        attributes = attributeStore.getByValueType( TrackedEntityAttribute.TYPE_INT );
+        attributes = attributeStore.getByValueType( TrackedEntityAttribute.TYPE_NUMBER );
         assertEquals( 1, attributes.size() );
         assertTrue( attributes.contains( attributeC ) );
 

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeStoreTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeStoreTest.java	2014-03-20 15:05:57 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeStoreTest.java	2014-04-15 03:48:38 +0000
@@ -68,7 +68,7 @@
     {
         attributeA = createTrackedEntityAttribute( 'A' );
         attributeB = createTrackedEntityAttribute( 'B' );
-        attributeC = createTrackedEntityAttribute( 'C', TrackedEntityAttribute.TYPE_INT );
+        attributeC = createTrackedEntityAttribute( 'C', TrackedEntityAttribute.TYPE_NUMBER );
 
         List<TrackedEntityAttribute> attributesA = new ArrayList<TrackedEntityAttribute>();
         attributesA.add( attributeA );
@@ -169,7 +169,7 @@
         assertTrue( attributes.contains( attributeA ) );
         assertTrue( attributes.contains( attributeB ) );
 
-        attributes = attributeService.getTrackedEntityAttributesByValueType( TrackedEntityAttribute.TYPE_INT );
+        attributes = attributeService.getTrackedEntityAttributesByValueType( TrackedEntityAttribute.TYPE_NUMBER );
         assertEquals( 1, attributes.size() );
         assertTrue( attributes.contains( attributeC ) );
 

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SaveMobileProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SaveMobileProgramEnrollmentAction.java	2014-03-20 07:14:38 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SaveMobileProgramEnrollmentAction.java	2014-04-15 03:48:38 +0000
@@ -280,7 +280,7 @@
                     }
                     else */
                     if ( value.trim().length() > 0
-                        && patientAttribute.getValueType().equals( TrackedEntityAttribute.TYPE_INT )
+                        && patientAttribute.getValueType().equals( TrackedEntityAttribute.TYPE_NUMBER )
                         && !MathUtils.isInteger( value ) )
                     {
                         this.validationMap.put( key, "is_invalid_number" );

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java	2014-03-26 07:41:18 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java	2014-04-15 03:48:38 +0000
@@ -314,7 +314,7 @@
                  * else
                  */
                 if ( value.trim().length() > 0
-                    && patientAttribute.getValueType().equals( TrackedEntityAttribute.TYPE_INT )
+                    && patientAttribute.getValueType().equals( TrackedEntityAttribute.TYPE_NUMBER )
                     && !MathUtils.isInteger( value ) )
                 {
                     this.validationMap.put( key, "is_invalid_number" );