← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19958: Removed ValueType fromValue

 

------------------------------------------------------------
revno: 19958
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-03 11:36:38 +0200
message:
  Removed ValueType fromValue
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm


--
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/common/ValueType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java	2015-09-03 09:26:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java	2015-09-03 09:36:38 +0000
@@ -225,18 +225,4 @@
 
         return ValueType.TEXT; // Fall back
     }
-
-    //TODO remove and replace with ValueType.valueOf
-    public static ValueType fromValue( String value )
-    {
-        for ( ValueType valueType : ValueType.values() )
-        {
-            if ( valueType.toString().equalsIgnoreCase( value ) )
-            {
-                return valueType;
-            }
-        }
-
-        return null;
-    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java	2015-09-03 08:15:09 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java	2015-09-03 09:36:38 +0000
@@ -241,10 +241,12 @@
 
             if ( rowSet.getString( "pav_value" ) != null && rowSet.getString( "ta_uid" ) != null )
             {
+                String valueType = rowSet.getString( "ta_valuetype" );
+                
                 Attribute attribute = new Attribute();
                 attribute.setValue( rowSet.getString( "pav_value" ) );
                 attribute.setDisplayName( rowSet.getString( "ta_name" ) );
-                attribute.setValueType( ValueType.fromValue( rowSet.getString( "ta_valuetype" ) ) );
+                attribute.setValueType( valueType != null ? ValueType.valueOf( valueType.toUpperCase() ) : null );
                 attribute.setAttribute( rowSet.getString( "ta_uid" ) );
 
                 eventRow.getAttributes().add( attribute );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java	2015-09-03 08:15:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java	2015-09-03 09:36:38 +0000
@@ -115,9 +115,9 @@
         this.description = description;
     }
 
-    private String valueType;
+    private ValueType valueType;
 
-    public void setValueType( String valueType )
+    public void setValueType( ValueType valueType )
     {
         this.valueType = valueType;
     }
@@ -206,7 +206,7 @@
         trackedEntityAttribute.setShortName( StringUtils.trimToNull( shortName ) );
         trackedEntityAttribute.setCode( StringUtils.trimToNull( code ) );
         trackedEntityAttribute.setDescription( StringUtils.trimToNull( description ) );
-        trackedEntityAttribute.setValueType( ValueType.fromValue( valueType ) );
+        trackedEntityAttribute.setValueType( valueType );
         trackedEntityAttribute.setAggregationType( AggregationType.fromValue( aggregationType ) );
         trackedEntityAttribute.setExpression( expression );
         trackedEntityAttribute.setDisplayOnVisitSchedule( false );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java	2015-09-03 08:15:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java	2015-09-03 09:36:38 +0000
@@ -118,9 +118,9 @@
         this.description = description;
     }
 
-    private String valueType;
+    private ValueType valueType;
 
-    public void setValueType( String valueType )
+    public void setValueType( ValueType valueType )
     {
         this.valueType = valueType;
     }
@@ -209,7 +209,7 @@
         trackedEntityAttribute.setShortName( StringUtils.trimToNull( shortName ) );
         trackedEntityAttribute.setCode( StringUtils.trimToNull( code ) );
         trackedEntityAttribute.setDescription( StringUtils.trimToNull( description ) );
-        trackedEntityAttribute.setValueType( ValueType.fromValue( valueType ) );
+        trackedEntityAttribute.setValueType( valueType );
         trackedEntityAttribute.setAggregationType( AggregationType.fromValue( aggregationType ) );
         trackedEntityAttribute.setExpression( expression );
         trackedEntityAttribute.setDisplayOnVisitSchedule( false );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm	2015-09-03 08:15:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm	2015-09-03 09:36:38 +0000
@@ -89,6 +89,7 @@
         <select id="valueType" name="valueType" onchange="typeOnChange();">
           <option value="NUMBER" selected="selected">$i18n.getString( "number" )</option>
           <option value="TEXT">$i18n.getString( "text" )</option>
+          <option value="LONG_TEXT">$i18n.getString( "long_text" )</option>
           <option value="LETTER">$i18n.getString( "letter_only" )</option>
           <option value="BOOLEAN">$i18n.getString( "yes_no" )</option>
           <option value="TRUE_ONLY">$i18n.getString( "yes_only" )</option>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm	2015-09-03 08:15:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm	2015-09-03 09:36:38 +0000
@@ -85,6 +85,7 @@
           <select id="valueType" name="valueType" onchange="typeOnChange();">
             <option value="NUMBER" #if( $attribute.valueType == 'NUMBER' ) selected="selected" #end>$i18n.getString( "number" )</option>
             <option value="TEXT" #if( $attribute.valueType == 'TEXT' ) selected="selected" #end>$i18n.getString( "text" )</option>
+            <option value="LONG_TEXT" #if( $attribute.valueType == 'LONG_TEXT' ) selected="selected" #end>$i18n.getString( "long_text" )</option>
             <option value="LETTER" #if( $attribute.valueType == 'LETTER' ) selected="selected" #end>$i18n.getString( "letter_only" )</option>
             <option value="BOOLEAN" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'BOOLEAN' ) selected="selected" #end>$i18n.getString( "yes_no" )</option>
             <option value="TRUE_ONLY" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'TRUE_ONLY' ) selected="selected" #end >$i18n.getString( "yes_only" )</option>