← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19954: replace TEA.ValueType with ValueType Enum, wip

 

------------------------------------------------------------
revno: 19954
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-03 15:15:09 +0700
message:
  replace TEA.ValueType with ValueType Enum, wip
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminderService.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryParams.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceReminderService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityService.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeStoreTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminderServiceTest.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/event/JdbcEventStore.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-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/Attribute.java
  dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/filter/AggregatableTrackedEntityAttributeValueFilter.java
  dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.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/addValidationCriteria.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/attribute.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/caseaggregation.js
  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/updateProgramIndicator.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateValidationCriteria.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/QueryItem.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java	2015-08-02 14:59:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java	2015-09-03 08:15:09 +0000
@@ -28,34 +28,34 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
 import org.hisp.dhis.analytics.AggregationType;
 import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.option.OptionSet;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 import org.hisp.dhis.util.ObjectUtils;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
 /**
- * Class which encapsulates a query parameter and value. Operator and filter 
+ * Class which encapsulates a query parameter and value. Operator and filter
  * are inherited from QueryFilter.
- * 
+ *
  * @author Lars Helge Overland
  */
 public class QueryItem
 {
     private DimensionalObject item;
-    
+
     private LegendSet legendSet;
 
     private List<QueryFilter> filters = new ArrayList<>();
-    
-    private String valueType;
-    
+
+    private ValueType valueType;
+
     private AggregationType aggregationType;
-    
+
     private OptionSet optionSet;
 
     // -------------------------------------------------------------------------
@@ -67,7 +67,7 @@
         this.item = item;
     }
 
-    public QueryItem( DimensionalObject item, LegendSet legendSet, String valueType, AggregationType aggregationType, OptionSet optionSet )
+    public QueryItem( DimensionalObject item, LegendSet legendSet, ValueType valueType, AggregationType aggregationType, OptionSet optionSet )
     {
         this.item = item;
         this.legendSet = legendSet;
@@ -75,71 +75,71 @@
         this.aggregationType = aggregationType;
         this.optionSet = optionSet;
     }
-    
-    public QueryItem( DimensionalObject item, QueryOperator operator, String filter, String valueType, AggregationType aggregationType, OptionSet optionSet )
+
+    public QueryItem( DimensionalObject item, QueryOperator operator, String filter, ValueType valueType, AggregationType aggregationType, OptionSet optionSet )
     {
         this.item = item;
         this.valueType = valueType;
         this.aggregationType = aggregationType;
         this.optionSet = optionSet;
-        
+
         if ( operator != null && filter != null )
         {
             this.filters.add( new QueryFilter( operator, filter ) );
         }
     }
-        
+
     // -------------------------------------------------------------------------
     // Logic
     // -------------------------------------------------------------------------
-    
+
     public String getItemId()
     {
         return item.getUid();
     }
-    
+
     public String getItemName()
     {
         String itemName = item.getUid();
-        
+
         if ( legendSet != null )
         {
             itemName += "_" + legendSet.getUid();
         }
-        
+
         return itemName;
     }
-    
+
     public String getTypeAsString()
     {
         return ObjectUtils.VALUE_TYPE_JAVA_CLASS_MAP.get( valueType ).getName();
     }
-    
+
     public boolean isNumeric()
     {
         return Double.class.equals( ObjectUtils.VALUE_TYPE_JAVA_CLASS_MAP.get( valueType ) );
     }
-    
+
     public boolean hasLegendSet()
     {
         return legendSet != null;
     }
-    
+
     public boolean hasOptionSet()
     {
         return optionSet != null;
     }
-    
+
     public String getLegendSetUid()
     {
         return legendSet != null ? legendSet.getUid() : null;
     }
-    
+
     public String getOptionSetUid()
     {
         return optionSet != null ? optionSet.getUid() : null;
     }
-    
+
     public boolean hasFilter()
     {
         return filters != null && !filters.isEmpty();
@@ -148,19 +148,19 @@
     public static List<QueryItem> getQueryItems( Collection<TrackedEntityAttribute> attributes )
     {
         List<QueryItem> queryItems = new ArrayList<>();
-        
+
         for ( TrackedEntityAttribute attribute : attributes )
         {
             queryItems.add( new QueryItem( attribute, attribute.getLegendSet(), attribute.getValueType(), attribute.getAggregationType(), attribute.hasOptionSet() ? attribute.getOptionSet() : null ) );
         }
-        
+
         return queryItems;
     }
-    
+
     // -------------------------------------------------------------------------
     // hashCode, equals and toString
     // -------------------------------------------------------------------------
-    
+
     @Override
     public int hashCode()
     {
@@ -174,19 +174,19 @@
         {
             return true;
         }
-        
+
         if ( object == null )
         {
             return false;
         }
-        
+
         if ( getClass() != object.getClass() )
         {
             return false;
         }
-        
+
         final QueryItem other = (QueryItem) object;
-        
+
         return item.equals( other.getItem() );
     }
 
@@ -195,7 +195,7 @@
     {
         return "[Item: " + item + ", legend set: " + legendSet + ", filters: " + filters + ", value type: " + valueType + ", optionSet: " + optionSet + "]";
     }
-    
+
     // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------
@@ -230,12 +230,12 @@
         this.filters = filters;
     }
 
-    public String getValueType()
+    public ValueType getValueType()
     {
         return valueType;
     }
 
-    public void setValueType( String valueType )
+    public void setValueType( ValueType valueType )
     {
         this.valueType = valueType;
     }

=== 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 04:42:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java	2015-09-03 08:15:09 +0000
@@ -69,7 +69,7 @@
         INTEGER, INTEGER_POSITIVE, INTEGER_NEGATIVE, INTEGER_ZERO_OR_POSITIVE, NUMBER, UNIT_INTERVAL, PERCENTAGE
     );
 
-    public static List<ValueType> TEXT_TYPES = Lists.newArrayList( TEXT, LONG_TEXT );
+    public static List<ValueType> TEXT_TYPES = Lists.newArrayList( TEXT, LONG_TEXT, LETTER );
 
     public static List<String> INTEGER_TYPE_STRINGS = Lists.newArrayList(
         INTEGER.toString(), INTEGER_POSITIVE.toString(), INTEGER_NEGATIVE.toString(), INTEGER_ZERO_OR_POSITIVE.toString()
@@ -80,7 +80,7 @@
         NUMBER.toString(), UNIT_INTERVAL.toString(), PERCENTAGE.toString()
     );
 
-    public static List<String> TEXT_TYPE_STRINGS = Lists.newArrayList( TEXT.toString(), LONG_TEXT.toString() );
+    public static List<String> TEXT_TYPE_STRINGS = Lists.newArrayList( TEXT.toString(), LONG_TEXT.toString(), LETTER.toString() );
 
     private final Class<?> javaClass;
 
@@ -114,6 +114,11 @@
         return this == TEXT || this == LONG_TEXT;
     }
 
+    public boolean isDate()
+    {
+        return this == DATE || this == DATETIME;
+    }
+
     /**
      * TODO replace string value type on data element with ValueType and remove
      * this method.
@@ -220,4 +225,17 @@
 
         return ValueType.TEXT; // Fall back
     }
+
+    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-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java	2015-08-28 10:23:48 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java	2015-09-03 08:15:09 +0000
@@ -28,9 +28,12 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Set;
-import java.util.regex.Pattern;
-
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import com.google.common.collect.Sets;
 import org.hisp.dhis.analytics.AggregationType;
 import org.hisp.dhis.analytics.EventOutputType;
 import org.hisp.dhis.common.BaseIdentifiableObject;
@@ -42,12 +45,8 @@
 import org.hisp.dhis.common.view.DetailedView;
 import org.hisp.dhis.common.view.ExportView;
 
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-import com.google.common.collect.Sets;
+import java.util.Set;
+import java.util.regex.Pattern;
 
 /**
  * @author Chau Thu Tran
@@ -62,18 +61,18 @@
     public static final String KEY_ATTRIBUTE = "A";
     public static final String KEY_PROGRAM_VARIABLE = "V";
     public static final String KEY_CONSTANT = "C";
-    
+
     public static final String VAR_EXECUTION_DATE = "execution_date";
     public static final String VAR_INCIDENT_DATE = "incident_date";
     public static final String VAR_ENROLLMENT_DATE = "enrollment_date";
     public static final String VAR_CURRENT_DATE = "current_date";
     public static final String VAR_VALUE_COUNT = "value_count";
     public static final String VAR_ZERO_POS_VALUE_COUNT = "zero_pos_value_count";
-    
+
     public static final String VALUE_TYPE_DATE = "date";
     public static final String VALUE_TYPE_INT = "int";
-    
-    private static final String EXPRESSION_REGEXP = "(" + KEY_DATAELEMENT + "|" + KEY_ATTRIBUTE + "|" + KEY_PROGRAM_VARIABLE + "|" + KEY_CONSTANT + ")\\{(\\w+|" + 
+
+    private static final String EXPRESSION_REGEXP = "(" + KEY_DATAELEMENT + "|" + KEY_ATTRIBUTE + "|" + KEY_PROGRAM_VARIABLE + "|" + KEY_CONSTANT + ")\\{(\\w+|" +
         VAR_INCIDENT_DATE + "|" + VAR_ENROLLMENT_DATE + "|" + VAR_CURRENT_DATE + ")" + SEPARATOR_ID + "?(\\w*)\\}";
     private static final String SQL_FUNC_REGEXP = "d2:(.+?)\\(([^,]+)\\,?([^,]*)\\,?([^,]*)\\)";
 
@@ -82,31 +81,31 @@
     public static final Pattern DATAELEMENT_PATTERN = Pattern.compile( KEY_DATAELEMENT + "\\{(\\w{11})" + SEPARATOR_ID + "(\\w{11})\\}" );
     public static final Pattern ATTRIBUTE_PATTERN = Pattern.compile( KEY_ATTRIBUTE + "\\{(\\w{11})\\}" );
     public static final Pattern VALUECOUNT_PATTERN = Pattern.compile( "V\\{(" + VAR_VALUE_COUNT + "|" + VAR_ZERO_POS_VALUE_COUNT + ")\\}" );
-    
+
     public static final String VALID = "valid";
     public static final String EXPRESSION_NOT_WELL_FORMED = "expression_not_well_formed";
     public static final String INVALID_IDENTIFIERS_IN_EXPRESSION = "invalid_identifiers_in_expression";
     public static final String FILTER_NOT_EVALUATING_TO_TRUE_OR_FALSE = "filter_not_evaluating_to_true_or_false";
 
     private Program program;
-    
+
     private String valueType;
 
     private String expression;
-    
+
     private String filter;
-    
+
     private AggregationType aggregationType;
 
     private EventOutputType eventOutputType;
-        
+
     /**
      * Number of decimals to use for indicator value, null implies default.
      */
     private Integer decimals;
 
     private Boolean displayInForm;
-    
+
     private String rootDate;
 
     // -------------------------------------------------------------------------
@@ -130,7 +129,7 @@
     {
         return decimals != null && decimals >= 0;
     }
-    
+
     /**
      * Returns aggregation type, if not exists returns AVERAGE.
      */
@@ -138,21 +137,21 @@
     {
         return aggregationType != null ? aggregationType : AggregationType.AVERAGE;
     }
-    
+
     /**
      * Returns a set of data element and attribute identifiers part of the given
      * input expression.
-     * 
+     *
      * @param input the expression.
      * @return a set of UIDs.
      */
     public static Set<String> getDataElementAndAttributeIdentifiers( String input )
     {
-        return Sets.union( 
+        return Sets.union(
             RegexUtils.getMatches( DATAELEMENT_PATTERN, input, 2 ),
             RegexUtils.getMatches( ATTRIBUTE_PATTERN, input, 1 ) );
     }
-    
+
     // -------------------------------------------------------------------------
     // Getters && Setters
     // -------------------------------------------------------------------------
@@ -283,7 +282,7 @@
         if ( other.getClass().isInstance( this ) )
         {
             ProgramIndicator programIndicator = (ProgramIndicator) other;
-            
+
             if ( strategy.isReplace() )
             {
                 program = programIndicator.getProgram();

=== 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	2015-08-27 15:28:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java	2015-09-03 08:15:09 +0000
@@ -28,27 +28,27 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.HashSet;
-import java.util.Set;
-
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 import org.hisp.dhis.attribute.AttributeValue;
 import org.hisp.dhis.common.BaseDimensionalObject;
 import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.DxfNamespaces;
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.MergeStrategy;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.common.view.DetailedView;
 import org.hisp.dhis.common.view.ExportView;
 import org.hisp.dhis.option.Option;
 import org.hisp.dhis.option.OptionSet;
 import org.hisp.dhis.schema.annotation.PropertyRange;
 
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import java.util.HashSet;
+import java.util.Set;
 
 /**
  * @author Abyot Asalefew
@@ -71,8 +71,8 @@
 
     private String description;
 
-    private String valueType;
-    
+    private ValueType valueType;
+
     private Boolean inherit = false;
 
     private TrackedEntityAttributeGroup attributeGroup;
@@ -115,8 +115,7 @@
 
     }
 
-    public TrackedEntityAttribute( String name, String description, String valueType, Boolean inherit,
-        Boolean displayOnVisitSchedule )
+    public TrackedEntityAttribute( String name, String description, ValueType valueType, Boolean inherit, Boolean displayOnVisitSchedule )
     {
         this.name = name;
         this.description = description;
@@ -134,7 +133,7 @@
      */
     public boolean isNumericType()
     {
-        return TYPE_NUMBER.equals( valueType );
+        return valueType.isNumeric();
     }
 
     /**
@@ -142,7 +141,7 @@
      */
     public boolean isDateType()
     {
-        return TYPE_DATE.equals( valueType );
+        return valueType.isDate();
     }
 
     /**
@@ -169,7 +168,7 @@
         {
             return false;
         }
-        
+
         for ( Option option : getOptionSet().getOptions() )
         {
             if ( value.equals( option.getCode() ) )
@@ -191,7 +190,7 @@
     {
         return optionSet != null;
     }
-    
+
     // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------
@@ -228,12 +227,12 @@
     @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public String getValueType()
+    public ValueType getValueType()
     {
         return valueType;
     }
 
-    public void setValueType( String valueType )
+    public void setValueType( ValueType valueType )
     {
         this.valueType = valueType;
     }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminderService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminderService.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminderService.java	2015-09-03 08:15:09 +0000
@@ -96,7 +96,7 @@
      *         orgunit phone numbers, phone numbers of DHIS users at the orgunit
      *         OR phone numbers of DHIS users in a user group.
      */
-    Set<String> getPhonenumbers( TrackedEntityInstanceReminder reminder, TrackedEntityInstance instance );
+    Set<String> getPhoneNumbers( TrackedEntityInstanceReminder reminder, TrackedEntityInstance instance );
 
     /**
      * Retrieve DHIS users from a template which is defined to send messages to

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryParams.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryParams.java	2015-08-21 02:55:35 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryParams.java	2015-09-03 08:15:09 +0000
@@ -28,15 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.common.DimensionalObject.PERIOD_DIM_ID;
-import static org.hisp.dhis.common.DimensionalObject.DATA_X_DIM_ID;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
 import org.hisp.dhis.analytics.AggregationType;
 import org.hisp.dhis.analytics.DataQueryParams;
 import org.hisp.dhis.analytics.EventOutputType;
@@ -55,6 +46,15 @@
 import org.hisp.dhis.program.ProgramIndicator;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.hisp.dhis.common.DimensionalObject.DATA_X_DIM_ID;
+import static org.hisp.dhis.common.DimensionalObject.PERIOD_DIM_ID;
+
 /**
  * @author Lars Helge Overland
  */
@@ -62,41 +62,41 @@
     extends DataQueryParams
 {
     private Date startDate;
-    
+
     private Date endDate;
-    
+
     private List<QueryItem> items = new ArrayList<>();
-    
+
     private List<QueryItem> itemFilters = new ArrayList<>();
-        
+
     private DimensionalObject value;
-        
+
     private List<ProgramIndicator> itemProgramIndicators = new ArrayList<>();
 
     private ProgramIndicator programIndicator;
-    
+
     private List<String> asc = new ArrayList<>();
-    
+
     private List<String> desc = new ArrayList<>();
-    
+
     private String organisationUnitMode;
-    
+
     private Integer page;
-    
+
     private Integer pageSize;
 
     private SortOrder sortOrder;
-    
+
     private Integer limit;
-    
+
     private EventOutputType outputType;
-    
+
     private boolean collapseDataDimensions;
-    
+
     private boolean coordinatesOnly;
 
     private boolean aggregateData;
-    
+
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -109,7 +109,7 @@
     public EventQueryParams instance()
     {
         EventQueryParams params = new EventQueryParams();
-        
+
         params.dimensions = new ArrayList<>( this.dimensions );
         params.filters = new ArrayList<>( this.filters );
         params.displayProperty = this.displayProperty;
@@ -118,7 +118,7 @@
 
         params.partitions = new Partitions( this.partitions );
         params.periodType = this.periodType;
-        
+
         params.program = this.program;
         params.programStage = this.programStage;
         params.startDate = this.startDate;
@@ -139,45 +139,44 @@
         params.collapseDataDimensions = this.collapseDataDimensions;
         params.coordinatesOnly = this.coordinatesOnly;
         params.aggregateData = this.aggregateData;
-        
+
         params.periodType = this.periodType;
-        
+
         return params;
     }
-    
+
     public static EventQueryParams fromDataQueryParams( DataQueryParams dataQueryParams )
     {
         //TODO indicator filter
-        
         EventQueryParams params = new EventQueryParams();
-        
+
         dataQueryParams.copyTo( params );
-        
+
         for ( NameableObject object : dataQueryParams.getProgramDataElements() )
         {
-            DataElement element = (DataElement) object;            
-            QueryItem item = new QueryItem( element, element.getLegendSet(), element.getType(), element.getAggregationType(), element.getOptionSet() );
+            DataElement element = (DataElement) object;
+            QueryItem item = new QueryItem( element, element.getLegendSet(), element.getValueType(), element.getAggregationType(), element.getOptionSet() );
             params.getItems().add( item );
         }
 
         for ( NameableObject object : dataQueryParams.getProgramAttributes() )
         {
-            TrackedEntityAttribute element = (TrackedEntityAttribute) object;            
+            TrackedEntityAttribute element = (TrackedEntityAttribute) object;
             QueryItem item = new QueryItem( element, element.getLegendSet(), element.getValueType(), element.getAggregationType(), element.getOptionSet() );
             params.getItems().add( item );
-        }        
+        }
 
         for ( NameableObject object : dataQueryParams.getFilterProgramDataElements() )
         {
-            DataElement element = (DataElement) object;            
-            QueryItem item = new QueryItem( element, element.getLegendSet(), element.getType(), element.getAggregationType(), element.getOptionSet() );            
+            DataElement element = (DataElement) object;
+            QueryItem item = new QueryItem( element, element.getLegendSet(), element.getValueType(), element.getAggregationType(), element.getOptionSet() );
             params.getItemFilters().add( item );
         }
 
         for ( NameableObject object : dataQueryParams.getFilterProgramAttributes() )
         {
-            TrackedEntityAttribute element = (TrackedEntityAttribute) object;            
-            QueryItem item = new QueryItem( element, element.getLegendSet(), element.getValueType(), element.getAggregationType(), element.getOptionSet() );            
+            TrackedEntityAttribute element = (TrackedEntityAttribute) object;
+            QueryItem item = new QueryItem( element, element.getLegendSet(), element.getValueType(), element.getAggregationType(), element.getOptionSet() );
             params.getItemFilters().add( item );
         }
 
@@ -186,17 +185,17 @@
             ProgramIndicator programIndicator = (ProgramIndicator) object;
             params.getItemProgramIndicators().add( programIndicator );
         }
-        
+
         params.setAggregateData( true );
         params.removeDimension( DATA_X_DIM_ID );
-        
+
         return params;
     }
 
     // -------------------------------------------------------------------------
     // Logic
     // -------------------------------------------------------------------------
-    
+
     /**
      * Replaces periods with start and end dates, using the earliest start date
      * from the periods as start date and the latest end date from the periods
@@ -205,23 +204,23 @@
     public void replacePeriodsWithStartEndDates()
     {
         List<Period> periods = NameableObjectUtils.asTypedList( getDimensionOrFilterItems( PERIOD_DIM_ID ), Period.class );
-        
+
         for ( Period period : periods )
         {
             Date start = period.getStartDate();
             Date end = period.getEndDate();
-            
-            if ( startDate == null || ( start != null && start.before( startDate ) ) )
+
+            if ( startDate == null || (start != null && start.before( startDate )) )
             {
                 startDate = start;
             }
-            
-            if ( endDate == null || ( end != null && end.after( endDate ) ) )
+
+            if ( endDate == null || (end != null && end.after( endDate )) )
             {
                 endDate = end;
             }
         }
-        
+
         removeDimensionOrFilter( PERIOD_DIM_ID );
     }
 
@@ -233,7 +232,7 @@
     {
         Set<QueryItem> dims = new HashSet<>();
         List<QueryItem> duplicates = new ArrayList<>();
-        
+
         for ( QueryItem dim : items )
         {
             if ( !dims.add( dim ) )
@@ -241,32 +240,32 @@
                 duplicates.add( dim );
             }
         }
-        
+
         return duplicates;
     }
-    
+
     /**
      * Get nameable objects part of items and item filters.
      */
     public Set<NameableObject> getNameableObjectItems()
     {
         Set<NameableObject> objects = new HashSet<NameableObject>();
-        
+
         for ( QueryItem item : ListUtils.union( items, itemFilters ) )
         {
             objects.add( item.getItem() );
         }
-                
+
         return objects;
     }
-    
+
     /**
      * Get legend sets part of items and item filters.
      */
     public Set<Legend> getLegends()
     {
         Set<Legend> legends = new HashSet<>();
-        
+
         for ( QueryItem item : ListUtils.union( items, itemFilters ) )
         {
             if ( item.hasLegendSet() )
@@ -274,17 +273,17 @@
                 legends.addAll( item.getLegendSet().getLegends() );
             }
         }
-        
+
         return legends;
     }
-    
+
     /**
      * Get option sets part of items.
      */
     public Set<OptionSet> getItemOptionSets()
     {
         Set<OptionSet> optionSets = new HashSet<>();
-        
+
         for ( QueryItem item : items )
         {
             if ( item.hasOptionSet() )
@@ -292,7 +291,7 @@
                 optionSets.add( item.getOptionSet() );
             }
         }
-        
+
         return optionSets;
     }
 
@@ -311,7 +310,7 @@
         {
             return value.getAggregationType();
         }
-        
+
         return AggregationType.AVERAGE;
     }
 
@@ -323,10 +322,10 @@
     public boolean isAggregationType( AggregationType aggregationType )
     {
         AggregationType type = getAggregationTypeFallback();
-        
+
         return type != null && type.equals( aggregationType );
-    }    
-    
+    }
+
     /**
      * Indicates whether this query is of the given organisation unit mode.
      */
@@ -350,25 +349,25 @@
     {
         return startDate != null && endDate != null;
     }
-        
+
     public Set<OrganisationUnit> getOrganisationUnitChildren()
     {
         Set<OrganisationUnit> children = new HashSet<>();
-        
+
         for ( NameableObject object : getDimensionOrFilterItems( DimensionalObject.ORGUNIT_DIM_ID ) )
         {
-            OrganisationUnit unit = (OrganisationUnit) object;            
+            OrganisationUnit unit = (OrganisationUnit) object;
             children.addAll( unit.getChildren() );
         }
-        
+
         return children;
     }
-    
+
     public boolean isSorting()
     {
-        return ( asc != null && !asc.isEmpty() ) || ( desc != null && !desc.isEmpty() );
+        return (asc != null && !asc.isEmpty()) || (desc != null && !desc.isEmpty());
     }
-    
+
     public boolean isPaging()
     {
         return page != null || pageSize != null;
@@ -378,7 +377,7 @@
     {
         return page != null && page > 0 ? page : 1;
     }
-    
+
     public int getPageSizeWithDefault()
     {
         return pageSize != null && pageSize >= 0 ? pageSize : 50;
@@ -386,29 +385,29 @@
 
     public int getOffset()
     {
-        return ( getPageWithDefault() - 1 ) * getPageSizeWithDefault();
+        return (getPageWithDefault() - 1) * getPageSizeWithDefault();
     }
-    
+
     public boolean hasSortOrder()
     {
         return sortOrder != null;
     }
-    
+
     public boolean hasLimit()
     {
         return limit != null && limit > 0;
     }
-    
+
     public boolean hasValueDimension()
     {
         return value != null;
     }
-    
+
     public boolean hasProgramIndicatorDimension()
     {
         return programIndicator != null;
     }
-    
+
     /**
      * Indicates whether the program of this query requires registration of
      * tracked entity instances.
@@ -417,7 +416,7 @@
     {
         return program != null && program.isRegistration();
     }
-    
+
     /**
      * Returns a negative integer in case of ascending sort order, a positive in
      * case of descending sort order and 0 in case of no sort order.
@@ -426,7 +425,7 @@
     {
         return SortOrder.ASC.equals( sortOrder ) ? -1 : SortOrder.DESC.equals( sortOrder ) ? 1 : 0;
     }
-    
+
     public String toString()
     {
         return "[" +
@@ -443,7 +442,7 @@
             "Dimensions: " + dimensions + ", " +
             "Filters: " + filters + "]";
     }
-    
+
     // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------
@@ -599,7 +598,7 @@
     {
         this.limit = limit;
     }
-    
+
     public EventOutputType getOutputType()
     {
         return outputType;

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java	2015-08-07 17:59:15 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java	2015-09-03 08:15:09 +0000
@@ -691,7 +691,7 @@
 
         if ( de != null ) //TODO check if part of program
         {
-            return new QueryItem( de, legendSet, de.getType(), de.getAggregationType(), de.getOptionSet() );
+            return new QueryItem( de, legendSet, de.getValueType(), de.getAggregationType(), de.getOptionSet() );
         }
 
         TrackedEntityAttribute at = attributeService.getTrackedEntityAttribute( item );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java	2015-08-30 12:42:15 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java	2015-09-03 08:15:09 +0000
@@ -28,16 +28,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.i18n.I18nUtils.i18n;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-
+import com.google.common.collect.ImmutableMap;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.commons.sqlfunc.ConditionalSqlFunction;
 import org.hisp.dhis.commons.sqlfunc.DaysBetweenSqlFunction;
 import org.hisp.dhis.commons.sqlfunc.OneIfZeroOrPositiveSqlFunction;
@@ -65,7 +57,15 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
-import com.google.common.collect.ImmutableMap;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+
+import static org.hisp.dhis.i18n.I18nUtils.i18n;
 
 /**
  * @author Chau Thu Tran
@@ -78,7 +78,7 @@
         put( OneIfZeroOrPositiveSqlFunction.KEY, new OneIfZeroOrPositiveSqlFunction() ).
         put( DaysBetweenSqlFunction.KEY, new DaysBetweenSqlFunction() ).
         put( ConditionalSqlFunction.KEY, new ConditionalSqlFunction() ).build();
-    
+
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -145,14 +145,14 @@
     {
         i18nService = service;
     }
-    
+
     private StatementBuilder statementBuilder;
 
     public void setStatementBuilder( StatementBuilder statementBuilder )
     {
         this.statementBuilder = statementBuilder;
     }
-    
+
     @Autowired
     private I18nManager i18nManager;
 
@@ -259,7 +259,7 @@
         for ( ProgramIndicator programIndicator : programIndicators )
         {
             String value = getProgramIndicatorValue( programIndicator, programInstance );
-            
+
             if ( value != null )
             {
                 result.put( programIndicator.getDisplayName(), value );
@@ -268,7 +268,7 @@
 
         return result;
     }
-    
+
     @Override
     @Transactional
     public String getExpressionDescription( String expression )
@@ -277,13 +277,13 @@
         {
             return null;
         }
-        
+
         I18n i18n = i18nManager.getI18n();
-        
+
         StringBuffer description = new StringBuffer();
 
         Matcher matcher = ProgramIndicator.EXPRESSION_PATTERN.matcher( expression );
-        
+
         while ( matcher.find() )
         {
             String key = matcher.group( 1 );
@@ -307,7 +307,7 @@
             else if ( ProgramIndicator.KEY_ATTRIBUTE.equals( key ) )
             {
                 TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( uid );
-                
+
                 if ( attribute != null )
                 {
                     matcher.appendReplacement( description, attribute.getDisplayName() );
@@ -316,7 +316,7 @@
             else if ( ProgramIndicator.KEY_CONSTANT.equals( key ) )
             {
                 Constant constant = constantService.getConstant( uid );
-                
+
                 if ( constant != null )
                 {
                     matcher.appendReplacement( description, constant.getDisplayName() );
@@ -325,7 +325,7 @@
             else if ( ProgramIndicator.KEY_PROGRAM_VARIABLE.equals( key ) )
             {
                 String varName = i18n.getString( uid );
-                
+
                 if ( varName != null )
                 {
                     matcher.appendReplacement( description, varName );
@@ -353,16 +353,16 @@
         StringBuffer buffer = new StringBuffer();
 
         Matcher matcher = ProgramIndicator.EXPRESSION_PATTERN.matcher( expression );
-        
+
         while ( matcher.find() )
         {
             String key = matcher.group( 1 );
             String val = matcher.group( 2 );
-            
+
             if ( ProgramIndicator.KEY_DATAELEMENT.equals( key ) )
             {
                 String de = statementBuilder.columnQuote( matcher.group( 3 ) );
-                
+
                 matcher.appendReplacement( buffer, de );
             }
             else if ( ProgramIndicator.KEY_ATTRIBUTE.equals( key ) )
@@ -372,7 +372,7 @@
             else if ( ProgramIndicator.KEY_CONSTANT.equals( key ) )
             {
                 Constant constant = constantService.getConstant( val );
-                
+
                 if ( constant != null )
                 {
                     matcher.appendReplacement( buffer, String.valueOf( constant.getValue() ) );
@@ -381,14 +381,14 @@
             else if ( ProgramIndicator.KEY_PROGRAM_VARIABLE.equals( key ) )
             {
                 String sql = getVariableAsSql( val, expression );
-                
+
                 if ( sql != null )
                 {
                     matcher.appendReplacement( buffer, sql );
                 }
             }
         }
-        
+
         expression = TextUtils.appendTail( matcher, buffer );
 
         // ---------------------------------------------------------------------
@@ -396,25 +396,25 @@
         // ---------------------------------------------------------------------
 
         buffer = new StringBuffer();
-        
+
         matcher = ProgramIndicator.SQL_FUNC_PATTERN.matcher( expression );
-        
+
         while ( matcher.find() )
         {
             String func = matcher.group( 1 );
             String arg1 = matcher.group( 2 );
             String arg2 = matcher.group( 3 );
             String arg3 = matcher.group( 4 );
-            
+
             SqlFunction function = SQL_FUNC_MAP.get( func );
-            
+
             if ( function == null )
             {
                 throw new IllegalStateException( "Function not recognized: " + func );
             }
-            
+
             String result = function.evaluate( arg1, arg2, arg3 );
-            
+
             matcher.appendReplacement( buffer, result );
         }
 
@@ -422,18 +422,18 @@
 
         return expression;
     }
-    
+
     @Override
     @Transactional
     public String expressionIsValid( String expression )
     {
         String expr = getSubstitutedExpression( expression );
-        
+
         if ( ProgramIndicator.INVALID_IDENTIFIERS_IN_EXPRESSION.equals( expr ) )
         {
             return expr;
         }
-        
+
         if ( !ExpressionUtils.isValid( expr, null ) )
         {
             return ProgramIndicator.EXPRESSION_NOT_WELL_FORMED;
@@ -441,7 +441,7 @@
 
         return ProgramIndicator.VALID;
     }
-    
+
     @Override
     @Transactional
     public String filterIsValid( String filter )
@@ -452,19 +452,19 @@
         {
             return expr;
         }
-        
+
         if ( !ExpressionUtils.isBoolean( expr, null ) )
         {
             return ProgramIndicator.FILTER_NOT_EVALUATING_TO_TRUE_OR_FALSE;
         }
-        
+
         return ProgramIndicator.VALID;
-    }    
-    
+    }
+
     /**
      * Generates an expression where all items are substituted with a sample value
      * in order to maintain a valid expression syntax.
-     * 
+     *
      * @param expression the expression.
      */
     private String getSubstitutedExpression( String expression )
@@ -472,7 +472,7 @@
         StringBuffer expr = new StringBuffer();
 
         Matcher matcher = ProgramIndicator.EXPRESSION_PATTERN.matcher( expression );
-        
+
         while ( matcher.find() )
         {
             String key = matcher.group( 1 );
@@ -488,7 +488,7 @@
                 if ( programStage != null && dataElement != null )
                 {
                     String sample = dataElement.isNumericType() ? String.valueOf( 1 ) : dataElement.isDateType() ? "'2000-01-01'" : "'A'";
-                    
+
                     matcher.appendReplacement( expr, sample );
                 }
                 else
@@ -499,11 +499,11 @@
             else if ( ProgramIndicator.KEY_ATTRIBUTE.equals( key ) )
             {
                 TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( uid );
-                
+
                 if ( attribute != null )
                 {
                     String sample = attribute.isNumericType() ? String.valueOf( 1 ) : attribute.isDateType() ? "'2000-01-01'" : "'A'";
-                    
+
                     matcher.appendReplacement( expr, sample );
                 }
                 else
@@ -514,7 +514,7 @@
             else if ( ProgramIndicator.KEY_CONSTANT.equals( key ) )
             {
                 Constant constant = constantService.getConstant( uid );
-                
+
                 if ( constant != null )
                 {
                     matcher.appendReplacement( expr, String.valueOf( constant.getValue() ) );
@@ -529,37 +529,37 @@
                 matcher.appendReplacement( expr, String.valueOf( 1 ) );
             }
         }
-        
+
         matcher.appendTail( expr );
 
         return expr.toString();
     }
-    
+
     @Override
     @Transactional
     public Set<ProgramStageDataElement> getProgramStageDataElementsInExpression( String expression )
     {
         Set<ProgramStageDataElement> elements = new HashSet<>();
-        
+
         Matcher matcher = ProgramIndicator.DATAELEMENT_PATTERN.matcher( expression );
-        
+
         while ( matcher.find() )
         {
             String ps = matcher.group( 1 );
             String de = matcher.group( 2 );
-            
+
             ProgramStage programStage = programStageService.getProgramStage( ps );
             DataElement dataElement = dataElementService.getDataElement( de );
-            
+
             if ( programStage != null && dataElement != null )
             {
                 elements.add( new ProgramStageDataElement( programStage, dataElement ) );
             }
         }
-        
+
         return elements;
     }
-    
+
     @Override
     @Transactional
     public Set<TrackedEntityAttribute> getAttributesInExpression( String expression )
@@ -567,20 +567,20 @@
         Set<TrackedEntityAttribute> attributes = new HashSet<>();
 
         Matcher matcher = ProgramIndicator.ATTRIBUTE_PATTERN.matcher( expression );
-        
+
         while ( matcher.find() )
         {
             String at = matcher.group( 1 );
-            
+
             TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( at );
-            
+
             if ( attribute != null )
             {
                 attributes.add( attribute );
             }
         }
-        
-        return attributes;        
+
+        return attributes;
     }
 
     @Override
@@ -590,33 +590,33 @@
         Set<Constant> constants = new HashSet<>();
 
         Matcher matcher = ExpressionService.CONSTANT_PATTERN.matcher( expression );
-        
+
         while ( matcher.find() )
         {
             String co = matcher.group( 1 );
-            
+
             Constant constant = constantService.getConstant( co );
-            
+
             if ( constant != null )
             {
                 constants.add( constant );
             }
         }
-        
-        return constants;        
+
+        return constants;
     }
-    
+
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------
 
     /**
-     * Get indicator value for the given arguments. If programStageInstance 
-     * argument is null, the program stage instance will be retrieved based on 
+     * Get indicator value for the given arguments. If programStageInstance
+     * argument is null, the program stage instance will be retrieved based on
      * the given program instance in combination with the program stage from the indicator expression.
-     * 
-     * @param indicator the indicator, must be not null.
-     * @param programInstance the program instance, can be null.
+     *
+     * @param indicator            the indicator, must be not null.
+     * @param programInstance      the program instance, can be null.
      * @param programStageInstance the program stage instance, can be null.
      */
     private Double getValue( ProgramIndicator indicator, ProgramInstance programInstance, ProgramStageInstance programStageInstance )
@@ -624,12 +624,12 @@
         StringBuffer buffer = new StringBuffer();
 
         String expression = indicator.getExpression();
-        
+
         Matcher matcher = ProgramIndicator.EXPRESSION_PATTERN.matcher( expression );
 
         int valueCount = 0;
         int zeroPosValueCount = 0;
-        
+
         while ( matcher.find() )
         {
             String key = matcher.group( 1 );
@@ -662,9 +662,9 @@
                     }
 
                     matcher.appendReplacement( buffer, value );
-                    
+
                     valueCount++;
-                    zeroPosValueCount = isZeroOrPositive( value ) ? ( zeroPosValueCount + 1 ) : zeroPosValueCount;
+                    zeroPosValueCount = isZeroOrPositive( value ) ? (zeroPosValueCount + 1) : zeroPosValueCount;
                 }
                 else
                 {
@@ -674,7 +674,7 @@
             else if ( ProgramIndicator.KEY_ATTRIBUTE.equals( key ) )
             {
                 TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( uid );
-                
+
                 if ( attribute != null )
                 {
                     TrackedEntityAttributeValue attributeValue = attributeValueService.getTrackedEntityAttributeValue(
@@ -683,16 +683,16 @@
                     if ( attributeValue != null )
                     {
                         String value = attributeValue.getValue();
-                        
-                        if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_DATE ) )
+
+                        if ( ValueType.DATE == attribute.getValueType() )
                         {
                             value = DateUtils.daysBetween( new Date(), DateUtils.getDefaultDate( value ) ) + " ";
                         }
-                        
+
                         matcher.appendReplacement( buffer, value );
-                        
+
                         valueCount++;
-                        zeroPosValueCount = isZeroOrPositive( value ) ? ( zeroPosValueCount + 1 ) : zeroPosValueCount;
+                        zeroPosValueCount = isZeroOrPositive( value ) ? (zeroPosValueCount + 1) : zeroPosValueCount;
                     }
                     else
                     {
@@ -707,7 +707,7 @@
             else if ( ProgramIndicator.KEY_CONSTANT.equals( key ) )
             {
                 Constant constant = constantService.getConstant( uid );
-                
+
                 if ( constant != null )
                 {
                     matcher.appendReplacement( buffer, String.valueOf( constant.getValue() ) );
@@ -721,7 +721,7 @@
             {
                 Date currentDate = new Date();
                 Date date = null;
-                
+
                 if ( ProgramIndicator.VAR_ENROLLMENT_DATE.equals( uid ) )
                 {
                     date = programInstance.getEnrollmentDate();
@@ -738,7 +738,7 @@
                 {
                     date = currentDate;
                 }
-                
+
                 if ( date != null )
                 {
                     matcher.appendReplacement( buffer, DateUtils.daysBetween( currentDate, date ) + "" );
@@ -754,11 +754,11 @@
 
         buffer = new StringBuffer();
         matcher = ProgramIndicator.VALUECOUNT_PATTERN.matcher( expression );
-        
+
         while ( matcher.find() )
         {
             String var = matcher.group( 1 );
-            
+
             if ( ProgramIndicator.VAR_VALUE_COUNT.equals( var ) )
             {
                 matcher.appendReplacement( buffer, String.valueOf( valueCount ) );
@@ -766,20 +766,20 @@
             else if ( ProgramIndicator.VAR_ZERO_POS_VALUE_COUNT.equals( var ) )
             {
                 matcher.appendReplacement( buffer, String.valueOf( zeroPosValueCount ) );
-            }            
+            }
         }
-        
+
         expression = TextUtils.appendTail( matcher, buffer );
-        
+
         return MathUtils.calculateExpression( expression );
     }
-    
+
     /**
-     * Creates a SQL select clause from the given program indicator variable 
-     * based on the given expression. Wraps the count variables with 
+     * Creates a SQL select clause from the given program indicator variable
+     * based on the given expression. Wraps the count variables with
      * <code>nullif</code> to avoid potential division by zero.
-     * 
-     * @param var the program indicator variable.
+     *
+     * @param var        the program indicator variable.
      * @param expression the program indicator expression.
      * @return a SQL select clause.
      */
@@ -800,26 +800,26 @@
         else if ( ProgramIndicator.VAR_VALUE_COUNT.equals( var ) )
         {
             String sql = "nullif((";
-            
+
             for ( String uid : ProgramIndicator.getDataElementAndAttributeIdentifiers( expression ) )
             {
                 sql += "case when " + statementBuilder.columnQuote( uid ) + " is not null then 1 else 0 end + ";
             }
-            
+
             return TextUtils.removeLast( sql, "+" ) + "),0)";
         }
         else if ( ProgramIndicator.VAR_ZERO_POS_VALUE_COUNT.equals( var ) )
         {
             String sql = "nullif((";
-            
+
             for ( String uid : ProgramIndicator.getDataElementAndAttributeIdentifiers( expression ) )
             {
                 sql += "case when " + statementBuilder.columnQuote( uid ) + " > 0 then 1 else 0 end + ";
             }
-            
+
             return TextUtils.removeLast( sql, "+" ) + "),0)";
         }
-        
+
         return null;
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2015-08-06 20:09:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2015-09-03 08:15:09 +0000
@@ -896,7 +896,7 @@
     {
         I18nFormat format = i18nManager.getI18nFormat();
 
-        Set<String> phoneNumbers = reminderService.getPhonenumbers( reminder, entityInstance );
+        Set<String> phoneNumbers = reminderService.getPhoneNumbers( reminder, entityInstance );
         OutboundSms outboundSms = null;
 
         if ( phoneNumbers.size() > 0 )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramService.java	2015-07-02 07:05:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramService.java	2015-09-03 08:15:09 +0000
@@ -28,16 +28,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.i18n.I18nUtils.i18n;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Matcher;
-
+import com.google.common.collect.Sets;
 import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.i18n.I18nService;
@@ -57,7 +50,14 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
-import com.google.common.collect.Sets;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+
+import static org.hisp.dhis.i18n.I18nUtils.i18n;
 
 /**
  * @author Abyot Asalefew
@@ -113,7 +113,7 @@
 
     @Autowired
     private TrackedEntityAttributeValueService attributeValueService;
-    
+
     // -------------------------------------------------------------------------
     // Implementation methods
     // -------------------------------------------------------------------------
@@ -177,7 +177,7 @@
     }
 
     @Override
-    public List<Program> getPrograms( ProgramType type)
+    public List<Program> getPrograms( ProgramType type )
     {
         return i18n( i18nService, programStore.getByType( type ) );
     }
@@ -201,7 +201,7 @@
     }
 
     @Override
-    public List<Program> getProgramsByCurrentUser( ProgramType type)
+    public List<Program> getProgramsByCurrentUser( ProgramType type )
     {
         return i18n( i18nService, getByCurrentUser( type ) );
     }
@@ -283,7 +283,7 @@
     }
 
     @Override
-    public List<Program> getByCurrentUser( ProgramType type)
+    public List<Program> getByCurrentUser( ProgramType type )
     {
         List<Program> programs = new ArrayList<>();
 
@@ -307,7 +307,7 @@
 
         return programs;
     }
-    
+
 
     @Override
     public String prepareDataEntryFormForAdd( String htmlCode, Program program, Collection<User> healthWorkers,
@@ -466,22 +466,23 @@
             + "\" tabindex=\"" + index + "\" style=\"" + style + "\"";
 
         inputHtml += "\" class=\"" + hidden + " {validate:{required:" + mandatory;
-        if ( TrackedEntityAttribute.TYPE_NUMBER.equals( attribute.getValueType() ) )
+
+        if ( ValueType.NUMBER == attribute.getValueType() )
         {
             inputHtml += ",number:true";
         }
-        else   if ( TrackedEntityAttribute.TYPE_PHONE_NUMBER.equals( attribute.getValueType() ) )
+        else if ( ValueType.PHONE_NUMBER == attribute.getValueType() )
         {
             inputHtml += ",phone:true";
         }
+
         inputHtml += "}}\" ";
 
-
-        if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_PHONE_NUMBER ) )
-        {            
+        if ( ValueType.PHONE_NUMBER == attribute.getValueType() )
+        {
             inputHtml += " phoneNumber value=\"" + value + "\"" + TAG_CLOSE;
         }
-        else if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_TRUE_ONLY ) )
+        else if ( ValueType.TRUE_ONLY == attribute.getValueType() )
         {
             inputHtml += " type='checkbox' value='true' ";
             if ( value.equals( "true" ) )
@@ -489,7 +490,7 @@
                 inputHtml += " checked ";
             }
         }
-        else if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_BOOL ) )
+        else if ( ValueType.BOOLEAN == attribute.getValueType() )
         {
             inputHtml = inputHtml.replaceFirst( "input", "select" ) + ">";
 
@@ -514,7 +515,7 @@
 
             inputHtml += "</select>";
         }
-        else if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_OPTION_SET ) )
+        else if ( ValueType.OPTION_SET == attribute.getValueType() )
         {
             inputHtml = inputHtml.replaceFirst( "input", "select" ) + ">";
             inputHtml += "<option value=\"\" selected>" + i18n.getString( "no_value" ) + "</option>";
@@ -530,18 +531,20 @@
             }
             inputHtml += "</select>";
         }
-        else if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_DATE ) )
+        else if ( ValueType.DATE == attribute.getValueType() )
         {
             String jQueryCalendar = "<script>";
-            if( allowDateInFuture ){
+            if ( allowDateInFuture )
+            {
                 jQueryCalendar += "datePicker";
             }
-            else{
+            else
+            {
                 jQueryCalendar += "datePickerValid";
             }
             jQueryCalendar += "(\"attr" + attribute.getId() + "\", false, false);</script>";
-            
-           inputHtml += " value=\"" + value + "\"" + TAG_CLOSE;
+
+            inputHtml += " value=\"" + value + "\"" + TAG_CLOSE;
             inputHtml += jQueryCalendar;
         }
         else

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2015-08-06 20:09:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2015-09-03 08:15:09 +0000
@@ -489,7 +489,7 @@
     private OutboundSms sendEventMessage( TrackedEntityInstanceReminder reminder,
         ProgramStageInstance programStageInstance, TrackedEntityInstance entityInstance, I18nFormat format )
     {
-        Set<String> phoneNumbers = reminderService.getPhonenumbers( reminder, entityInstance );
+        Set<String> phoneNumbers = reminderService.getPhoneNumbers( reminder, entityInstance );
         OutboundSms outboundSms = null;
 
         if ( phoneNumbers.size() > 0 )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2015-09-02 16:15:15 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2015-09-03 08:15:09 +0000
@@ -28,13 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.sql.ResultSet;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.amplecode.quick.BatchHandler;
 import org.amplecode.quick.BatchHandlerFactory;
 import org.amplecode.quick.StatementHolder;
@@ -49,6 +42,13 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * @author Lars Helge Overland
  */
@@ -728,7 +728,7 @@
         executeSql( "UPDATE program SET version=0 WHERE version IS NULL" );
         executeSql( "update program set categorycomboid = " + defaultCategoryComboId + " where categorycomboid is null" );
         executeSql( "update programstageinstance set attributeOptionCombo = " + defaultOptionComboId + " where attributeOptionCombo is null" );
-        
+
 
         executeSql( "ALTER TABLE datavalue ALTER COLUMN lastupdated TYPE timestamp" );
         executeSql( "ALTER TABLE completedatasetregistration ALTER COLUMN date TYPE timestamp" );
@@ -856,7 +856,7 @@
         executeSql( "drop table aggregatedorgunitdatavalue_temp" );
         executeSql( "drop table aggregatedorgunitindicatorvalue" );
         executeSql( "drop table aggregatedorgunitindicatorvalue_temp" );
-        
+
         oauth2();
 
         upgradeDataValuesWithAttributeOptionCombo();
@@ -894,6 +894,18 @@
         executeSql( "update dataelement set vtype='BOOLEAN' where valuetype='bool' and vtype is null" );
         executeSql( "update dataelement set vtype='TRUE_ONLY' where valuetype='trueOnly' and vtype is null" );
         executeSql( "update dataelement set vtype='USERNAME' where valuetype='username' and vtype is null" );
+
+        executeSql( "update trackedentityattribute set valuetype='TEXT' where valuetype='string'" );
+        executeSql( "update trackedentityattribute set valuetype='PHONE_NUMBER' where valuetype='phoneNumber'" );
+        executeSql( "update trackedentityattribute set valuetype='EMAIL' where valuetype='email'" );
+        executeSql( "update trackedentityattribute set valuetype='NUMBER' where valuetype='number'" );
+        executeSql( "update trackedentityattribute set valuetype='LETTER' where valuetype='letter'" );
+        executeSql( "update trackedentityattribute set valuetype='BOOLEAN' where valuetype='bool'" );
+        executeSql( "update trackedentityattribute set valuetype='TRUE_ONLY' where valuetype='trueOnly'" );
+        executeSql( "update trackedentityattribute set valuetype='DATE' where valuetype='date'" );
+        executeSql( "update trackedentityattribute set valuetype='OPTION_SET' where valuetype='optionSet'" );
+        executeSql( "update trackedentityattribute set valuetype='TRACKER_ASSOCIATE' where valuetype='trackerAssociate'" );
+        executeSql( "update trackedentityattribute set valuetype='USERNAME' where valuetype='users'" );
     }
 
     public void oauth2()

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceReminderService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceReminderService.java	2015-09-03 03:11:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceReminderService.java	2015-09-03 08:15:09 +0000
@@ -28,18 +28,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder.ATTRIBUTE;
-import static org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder.ATTRIBUTE_PATTERN;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Matcher;
-
 import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.program.ProgramInstance;
 import org.hisp.dhis.program.ProgramStageInstance;
@@ -48,6 +38,17 @@
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.user.UserService;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+
+import static org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder.ATTRIBUTE;
+import static org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder.ATTRIBUTE_PATTERN;
+
 /**
  * @author Chau Thu Tran
  */
@@ -188,7 +189,7 @@
 
         return templateMessage;
     }
-    
+
     @Override
     public List<String> getAttributeUids( String message )
     {
@@ -209,66 +210,69 @@
     }
 
     @Override
-    public Set<String> getPhonenumbers( TrackedEntityInstanceReminder reminder, TrackedEntityInstance entityInstance )
+    public Set<String> getPhoneNumbers( TrackedEntityInstanceReminder reminder, TrackedEntityInstance entityInstance )
     {
         Set<String> phoneNumbers = new HashSet<>();
         switch ( reminder.getSendTo() )
         {
-        case TrackedEntityInstanceReminder.SEND_TO_ALL_USERS_IN_ORGUGNIT_REGISTERED:
-            Collection<User> users = entityInstance.getOrganisationUnit().getUsers();
-            for ( User user : users )
-            {
-                if ( user.getPhoneNumber() != null && !user.getPhoneNumber().isEmpty() )
-                {
-                    phoneNumbers.add( user.getPhoneNumber() );
-                }
-            }
-            break;
-        case TrackedEntityInstanceReminder.SEND_TO_ATTRIBUTE_TYPE_USERS:
-            if ( entityInstance.getAttributeValues() != null )
-            {
-                for ( TrackedEntityAttributeValue attributeValue : entityInstance.getAttributeValues() )
-                {
-                    if ( attributeValue.getAttribute().getValueType().equals( TrackedEntityAttribute.TYPE_USERS ) )
-                    {
-                        User user = userService.getUser( Integer.parseInt( attributeValue.getValue() ) );
-                        if ( user.getPhoneNumber() != null && !user.getPhoneNumber().isEmpty() )
-                        {
-                            phoneNumbers.add( user.getPhoneNumber() );
-                        }
-                    }
-                }
-            }
-            break;
-        case TrackedEntityInstanceReminder.SEND_TO_ORGUGNIT_REGISTERED:
-            if ( entityInstance.getOrganisationUnit().getPhoneNumber() != null
-                && !entityInstance.getOrganisationUnit().getPhoneNumber().isEmpty() )
-            {
-                phoneNumbers.add( entityInstance.getOrganisationUnit().getPhoneNumber() );
-            }
-            break;
-        case TrackedEntityInstanceReminder.SEND_TO_USER_GROUP:
-            for ( User user : reminder.getUserGroup().getMembers() )
-            {
-                if ( user.getPhoneNumber() != null && !user.getPhoneNumber().isEmpty() )
-                {
-                    phoneNumbers.add( user.getPhoneNumber() );
-                }
-            }
-            break;
-        default:
-            if ( entityInstance.getAttributeValues() != null )
-            {
-                for ( TrackedEntityAttributeValue attributeValue : entityInstance.getAttributeValues() )
-                {
-                    if ( attributeValue.getAttribute().getValueType().equals( TrackedEntityAttribute.TYPE_PHONE_NUMBER ) )
-                    {
-                        phoneNumbers.add( attributeValue.getValue() );
-                    }
-                }
-            }
-            break;
+            case TrackedEntityInstanceReminder.SEND_TO_ALL_USERS_IN_ORGUGNIT_REGISTERED:
+                Collection<User> users = entityInstance.getOrganisationUnit().getUsers();
+
+                for ( User user : users )
+                {
+                    if ( user.getPhoneNumber() != null && !user.getPhoneNumber().isEmpty() )
+                    {
+                        phoneNumbers.add( user.getPhoneNumber() );
+                    }
+                }
+                break;
+            case TrackedEntityInstanceReminder.SEND_TO_ATTRIBUTE_TYPE_USERS:
+                if ( entityInstance.getAttributeValues() != null )
+                {
+                    for ( TrackedEntityAttributeValue attributeValue : entityInstance.getAttributeValues() )
+                    {
+                        if ( ValueType.USERNAME == attributeValue.getAttribute().getValueType() )
+                        {
+                            User user = userService.getUser( Integer.parseInt( attributeValue.getValue() ) );
+
+                            if ( user.getPhoneNumber() != null && !user.getPhoneNumber().isEmpty() )
+                            {
+                                phoneNumbers.add( user.getPhoneNumber() );
+                            }
+                        }
+                    }
+                }
+                break;
+            case TrackedEntityInstanceReminder.SEND_TO_ORGUGNIT_REGISTERED:
+                if ( entityInstance.getOrganisationUnit().getPhoneNumber() != null
+                    && !entityInstance.getOrganisationUnit().getPhoneNumber().isEmpty() )
+                {
+                    phoneNumbers.add( entityInstance.getOrganisationUnit().getPhoneNumber() );
+                }
+                break;
+            case TrackedEntityInstanceReminder.SEND_TO_USER_GROUP:
+                for ( User user : reminder.getUserGroup().getMembers() )
+                {
+                    if ( user.getPhoneNumber() != null && !user.getPhoneNumber().isEmpty() )
+                    {
+                        phoneNumbers.add( user.getPhoneNumber() );
+                    }
+                }
+                break;
+            default:
+                if ( entityInstance.getAttributeValues() != null )
+                {
+                    for ( TrackedEntityAttributeValue attributeValue : entityInstance.getAttributeValues() )
+                    {
+                        if ( ValueType.PHONE_NUMBER == attributeValue.getAttribute().getValueType() )
+                        {
+                            phoneNumbers.add( attributeValue.getValue() );
+                        }
+                    }
+                }
+                break;
         }
+
         return phoneNumbers;
     }
 
@@ -279,29 +283,29 @@
 
         switch ( reminder.getSendTo() )
         {
-        case TrackedEntityInstanceReminder.SEND_TO_ALL_USERS_IN_ORGUGNIT_REGISTERED:
-            users.addAll( entityInstance.getOrganisationUnit().getUsers() );
-            break;
-        case TrackedEntityInstanceReminder.SEND_TO_ATTRIBUTE_TYPE_USERS:
-            if ( entityInstance.getAttributeValues() != null )
-            {
-                for ( TrackedEntityAttributeValue attributeValue : entityInstance.getAttributeValues() )
+            case TrackedEntityInstanceReminder.SEND_TO_ALL_USERS_IN_ORGUGNIT_REGISTERED:
+                users.addAll( entityInstance.getOrganisationUnit().getUsers() );
+                break;
+            case TrackedEntityInstanceReminder.SEND_TO_ATTRIBUTE_TYPE_USERS:
+                if ( entityInstance.getAttributeValues() != null )
                 {
-                    if ( attributeValue.getAttribute().getValueType().equals( TrackedEntityAttribute.TYPE_USERS ) )
+                    for ( TrackedEntityAttributeValue attributeValue : entityInstance.getAttributeValues() )
                     {
-                        users.add( userService.getUser( Integer.parseInt( attributeValue.getValue() ) ) );
+                        if ( ValueType.USERNAME == attributeValue.getAttribute().getValueType() )
+                        {
+                            users.add( userService.getUser( Integer.parseInt( attributeValue.getValue() ) ) );
+                        }
                     }
                 }
-            }
-            break;
-        case TrackedEntityInstanceReminder.SEND_TO_USER_GROUP:
-            if ( reminder.getUserGroup().getMembers().size() > 0 )
-            {
-                users.addAll( reminder.getUserGroup().getMembers() );
-            }
-            break;
-        default:
-            break;
+                break;
+            case TrackedEntityInstanceReminder.SEND_TO_USER_GROUP:
+                if ( reminder.getUserGroup().getMembers().size() > 0 )
+                {
+                    users.addAll( reminder.getUserGroup().getMembers() );
+                }
+                break;
+            default:
+                break;
         }
         return users;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java	2015-08-25 21:48:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java	2015-09-03 08:15:09 +0000
@@ -39,6 +39,7 @@
 import org.hisp.dhis.common.QueryFilter;
 import org.hisp.dhis.common.QueryItem;
 import org.hisp.dhis.common.QueryOperator;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.event.EventStatus;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -750,9 +751,9 @@
                 if ( attributeValue.getAttribute().getUid().equals( criteria.getProperty() ) )
                 {
                     String value = attributeValue.getValue();
-                    String type = attributeValue.getAttribute().getValueType();
+                    ValueType valueType = attributeValue.getAttribute().getValueType();
 
-                    if ( type.equals( TrackedEntityAttribute.TYPE_NUMBER ) )
+                    if ( valueType.isNumeric() )
                     {
                         int value1 = Integer.parseInt( value );
                         int value2 = Integer.parseInt( criteria.getValue() );
@@ -764,7 +765,7 @@
                             return criteria;
                         }
                     }
-                    else if ( type.equals( TrackedEntityAttribute.TYPE_DATE ) )
+                    else if ( valueType.isDate() )
                     {
                         Date value1 = format.parseDate( value );
                         Date value2 = format.parseDate( criteria.getValue() );
@@ -777,14 +778,12 @@
                     }
                     else
                     {
-                        if ( criteria.getOperator() == ValidationCriteria.OPERATOR_EQUAL_TO
-                            && !value.equals( criteria.getValue() ) )
+                        if ( criteria.getOperator() == ValidationCriteria.OPERATOR_EQUAL_TO && !value.equals( criteria.getValue() ) )
                         {
                             return criteria;
                         }
 
                     }
-
                 }
             }
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityService.java	2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityService.java	2015-09-03 08:15:09 +0000
@@ -120,5 +120,4 @@
     {
         return trackedEntityStore.getAllOrderedName( min, max );
     }
-
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml	2015-09-02 05:15:31 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml	2015-09-03 08:15:09 +0000
@@ -19,7 +19,13 @@
 
     <property name="description" type="text" />
 
-    <property name="valueType" column="valuetype" not-null="true" />
+    <property name="valueType" column="valuetype" length="36" access="property" not-null="false">
+      <type name="org.hibernate.type.EnumType">
+        <param name="enumClass">org.hisp.dhis.common.ValueType</param>
+        <param name="useNamed">true</param>
+        <param name="type">12</param>
+      </type>
+    </property>
 
     <property name="aggregationType" length="40">
       <type name="org.hibernate.type.EnumType">

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java	2015-09-03 03:11:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java	2015-09-03 08:15:09 +0000
@@ -28,22 +28,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.program.ProgramIndicator.KEY_ATTRIBUTE;
-import static org.hisp.dhis.program.ProgramIndicator.KEY_CONSTANT;
-import static org.hisp.dhis.program.ProgramIndicator.KEY_DATAELEMENT;
-import static org.hisp.dhis.program.ProgramIndicator.KEY_PROGRAM_VARIABLE;
-import static org.hisp.dhis.program.ProgramIndicator.VALUE_TYPE_DATE;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
 import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.constant.Constant;
 import org.hisp.dhis.constant.ConstantService;
 import org.hisp.dhis.dataelement.DataElement;
@@ -63,6 +49,14 @@
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import static org.hisp.dhis.program.ProgramIndicator.*;
+import static org.junit.Assert.*;
+
 /**
  * @author Chau Thu Tran
  */
@@ -70,7 +64,7 @@
     extends DhisSpringTest
 {
     private static final String COL_QUOTE = "\"";
-    
+
     @Autowired
     private ProgramIndicatorService programIndicatorService;
 
@@ -154,7 +148,7 @@
 
     private ProgramIndicator indicatorI;
 
-    private ProgramIndicator indicatorJ;    
+    private ProgramIndicator indicatorJ;
 
     @Override
     public void setUpTest()
@@ -228,17 +222,17 @@
 
         programInstance = programInstanceService.enrollTrackedEntityInstance( entityInstance, programA, enrollmentDate,
             incidenDate, organisationUnit );
-        
+
         // TODO enroll twice?
 
         // ---------------------------------------------------------------------
         // TrackedEntityAttribute
         // ---------------------------------------------------------------------
 
-        atA = createTrackedEntityAttribute( 'A', TrackedEntityAttribute.TYPE_NUMBER );
-        atB = createTrackedEntityAttribute( 'B', TrackedEntityAttribute.TYPE_NUMBER );
-        atC = createTrackedEntityAttribute( 'C', TrackedEntityAttribute.TYPE_DATE );
-        atD = createTrackedEntityAttribute( 'D', TrackedEntityAttribute.TYPE_DATE );
+        atA = createTrackedEntityAttribute( 'A', ValueType.NUMBER );
+        atB = createTrackedEntityAttribute( 'B', ValueType.NUMBER );
+        atC = createTrackedEntityAttribute( 'C', ValueType.DATE );
+        atD = createTrackedEntityAttribute( 'D', ValueType.DATE );
 
         attributeService.addTrackedEntityAttribute( atA );
         attributeService.addTrackedEntityAttribute( atB );
@@ -247,10 +241,8 @@
 
         TrackedEntityAttributeValue attributeValueA = new TrackedEntityAttributeValue( atA, entityInstance, "1" );
         TrackedEntityAttributeValue attributeValueB = new TrackedEntityAttributeValue( atB, entityInstance, "2" );
-        TrackedEntityAttributeValue attributeValueC = new TrackedEntityAttributeValue( atC, entityInstance,
-            "2015-01-01" );
-        TrackedEntityAttributeValue attributeValueD = new TrackedEntityAttributeValue( atD, entityInstance,
-            "2015-01-03" );
+        TrackedEntityAttributeValue attributeValueC = new TrackedEntityAttributeValue( atC, entityInstance, "2015-01-01" );
+        TrackedEntityAttributeValue attributeValueD = new TrackedEntityAttributeValue( atD, entityInstance, "2015-01-03" );
 
         attributeValueService.addTrackedEntityAttributeValue( attributeValueA );
         attributeValueService.addTrackedEntityAttributeValue( attributeValueB );
@@ -504,7 +496,7 @@
     public void testGetAnalyticsSQl()
     {
         String expected = COL_QUOTE + deA.getUid() + COL_QUOTE + " + " + COL_QUOTE + atA.getUid() + COL_QUOTE + " > 10";
-        
+
         assertEquals( expected, programIndicatorService.getAnalyticsSQl( indicatorE.getFilter() ) );
     }
 
@@ -515,7 +507,7 @@
         String expected = "case when " + col + " < 0 then 0 else " + col + " end";
         String expression = "d2:zing(" + col + ")";
 
-        assertEquals( expected, programIndicatorService.getAnalyticsSQl( expression ) );        
+        assertEquals( expected, programIndicatorService.getAnalyticsSQl( expression ) );
     }
 
     @Test
@@ -525,7 +517,7 @@
         String expected = "case when " + col + " >= 0 then 1 else 0 end";
         String expression = "d2:oizp(" + col + ")";
 
-        assertEquals( expected, programIndicatorService.getAnalyticsSQl( expression ) );        
+        assertEquals( expected, programIndicatorService.getAnalyticsSQl( expression ) );
     }
 
     @Test
@@ -536,7 +528,7 @@
         String expected = "(cast(" + col2 + " as date) - cast(" + col1 + " as date))";
         String expression = "d2:daysBetween(" + col1 + "," + col2 + ")";
 
-        assertEquals( expected, programIndicatorService.getAnalyticsSQl( expression ) );        
+        assertEquals( expected, programIndicatorService.getAnalyticsSQl( expression ) );
     }
 
     @Test
@@ -546,7 +538,7 @@
         String expected = "case when (" + col1 + " > 3) then 10 else 5 end";
         String expression = "d2:condition('" + col1 + " > 3',10,5)";
 
-        assertEquals( expected, programIndicatorService.getAnalyticsSQl( expression ) );        
+        assertEquals( expected, programIndicatorService.getAnalyticsSQl( expression ) );
     }
 
     @Test( expected = IllegalStateException.class )
@@ -556,9 +548,9 @@
         String expected = "case when " + col + " >= 0 then 1 else " + col + " end";
         String expression = "d2:xyza(" + col + ")";
 
-        assertEquals( expected, programIndicatorService.getAnalyticsSQl( expression ) );        
+        assertEquals( expected, programIndicatorService.getAnalyticsSQl( expression ) );
     }
-    
+
     @Test
     public void testExpressionIsValid()
     {
@@ -578,10 +570,10 @@
         String filterB = KEY_ATTRIBUTE + "{" + atA.getUid() + "} == " + KEY_DATAELEMENT + "{" + psA.getUid() + "." + deA.getUid() + "} - 5";
         String filterC = KEY_ATTRIBUTE + "{invaliduid} == 100";
         String filterD = KEY_ATTRIBUTE + "{" + atA.getUid() + "} + 200";
-        
+
         assertEquals( ProgramIndicator.VALID, programIndicatorService.filterIsValid( filterA ) );
         assertEquals( ProgramIndicator.VALID, programIndicatorService.filterIsValid( filterB ) );
         assertEquals( ProgramIndicator.INVALID_IDENTIFIERS_IN_EXPRESSION, programIndicatorService.filterIsValid( filterC ) );
-        assertEquals( ProgramIndicator.FILTER_NOT_EVALUATING_TO_TRUE_OR_FALSE, programIndicatorService.filterIsValid( filterD ) );        
+        assertEquals( ProgramIndicator.FILTER_NOT_EVALUATING_TO_TRUE_OR_FALSE, programIndicatorService.filterIsValid( filterD ) );
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java	2015-09-03 03:11:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java	2015-09-03 08:15:09 +0000
@@ -40,6 +40,7 @@
 import java.util.Set;
 
 import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.event.EventStatus;
@@ -167,7 +168,7 @@
         entityInstanceService.addTrackedEntityInstance( entityInstanceB );
 
         TrackedEntityAttribute attribute = createTrackedEntityAttribute( 'A' );
-        attribute.setValueType( TrackedEntityAttribute.TYPE_PHONE_NUMBER );
+        attribute.setValueType( ValueType.PHONE_NUMBER );
         attributeService.addTrackedEntityAttribute( attribute );
 
         TrackedEntityAttributeValue attributeValue = createTrackedEntityAttributeValue( 'A', entityInstanceA, attribute );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeServiceTest.java	2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeServiceTest.java	2015-09-03 08:15:09 +0000
@@ -28,16 +28,17 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
 import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.common.ValueType;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 /**
  * @author Chau Thu Tran
  */
@@ -63,7 +64,7 @@
     {
         attributeA = createTrackedEntityAttribute( 'A' );
         attributeB = createTrackedEntityAttribute( 'B' );
-        attributeC = createTrackedEntityAttribute( 'C', TrackedEntityAttribute.TYPE_NUMBER );
+        attributeC = createTrackedEntityAttribute( 'C', ValueType.NUMBER );
 
         List<TrackedEntityAttribute> attributesA = new ArrayList<>();
         attributesA.add( attributeA );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeStoreTest.java	2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeStoreTest.java	2015-09-03 08:15:09 +0000
@@ -28,18 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
 import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.common.ValueType;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.*;
+
 /**
  * @author Chau Thu Tran
  */
@@ -65,7 +63,7 @@
     {
         attributeA = createTrackedEntityAttribute( 'A' );
         attributeB = createTrackedEntityAttribute( 'B' );
-        attributeC = createTrackedEntityAttribute( 'C', TrackedEntityAttribute.TYPE_NUMBER );
+        attributeC = createTrackedEntityAttribute( 'C', ValueType.NUMBER );
 
         List<TrackedEntityAttribute> attributesA = new ArrayList<>();
         attributesA.add( attributeA );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminderServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminderServiceTest.java	2015-09-03 03:11:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminderServiceTest.java	2015-09-03 08:15:09 +0000
@@ -28,14 +28,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
 import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.mock.MockI18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -54,6 +48,13 @@
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 /**
  * @author Chau Thu Tran
  */
@@ -192,10 +193,10 @@
     }
 
     @Test
-    public void testGetPhonenumbers()
+    public void testGetPhoneNumbers()
     {
         TrackedEntityAttribute attribute = createTrackedEntityAttribute( 'A' );
-        attribute.setValueType( TrackedEntityAttribute.TYPE_PHONE_NUMBER );
+        attribute.setValueType( ValueType.PHONE_NUMBER );
         attributeService.addTrackedEntityAttribute( attribute );
 
         TrackedEntityAttributeValue attributeValue = createTrackedEntityAttributeValue( 'A', entityInstance, attribute );
@@ -205,7 +206,7 @@
         entityInstance.getAttributeValues().add( attributeValue );
         entityInstanceService.updateTrackedEntityInstance( entityInstance );
 
-        Set<String> phoneNumbers = reminderService.getPhonenumbers( reminderA, entityInstance );
+        Set<String> phoneNumbers = reminderService.getPhoneNumbers( reminderA, entityInstance );
         assertEquals( 1, phoneNumbers.size() );
         assertTrue( phoneNumbers.contains( "123456789" ) );
     }

=== 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	2015-08-06 20:09:10 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java	2015-09-03 08:15:09 +0000
@@ -35,6 +35,7 @@
 import org.hisp.dhis.common.OrganisationUnitSelectionMode;
 import org.hisp.dhis.common.QueryItem;
 import org.hisp.dhis.common.QueryOperator;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.commons.collection.CachingMap;
 import org.hisp.dhis.dbms.DbmsManager;
 import org.hisp.dhis.dxf2.events.event.Note;
@@ -619,34 +620,30 @@
             importConflicts.add( new ImportConflict( "Attribute.value", "Value length is greater than 256 chars." ) );
         }
 
-        if ( TrackedEntityAttribute.TYPE_NUMBER.equals( teAttribute.getValueType() )
-            && !MathUtils.isNumeric( attribute.getValue() ) )
+        if ( ValueType.NUMBER == teAttribute.getValueType() && !MathUtils.isNumeric( attribute.getValue() ) )
         {
             importConflicts.add( new ImportConflict( "Attribute.value", "Value is not numeric." ) );
         }
-        else if ( TrackedEntityAttribute.TYPE_BOOL.equals( teAttribute.getValueType() )
-            && !MathUtils.isBool( attribute.getValue() ) )
+        else if ( ValueType.BOOLEAN == teAttribute.getValueType() && !MathUtils.isBool( attribute.getValue() ) )
         {
             importConflicts.add( new ImportConflict( "Attribute.value", "Value is not boolean." ) );
         }
-        else if ( TrackedEntityAttribute.TYPE_DATE.equals( teAttribute.getValueType() )
-            && !DateUtils.dateIsValid( attribute.getValue() ) )
+        else if ( ValueType.DATE == teAttribute.getValueType() && !DateUtils.dateIsValid( attribute.getValue() ) )
         {
             importConflicts.add( new ImportConflict( "Attribute.value", "Value is not date." ) );
         }
-        else if ( TrackedEntityAttribute.TYPE_TRUE_ONLY.equals( teAttribute.getValueType() )
-            && "true".equals( attribute.getValue() ) )
+        else if ( ValueType.TRUE_ONLY == teAttribute.getValueType() && "true".equals( attribute.getValue() ) )
         {
             importConflicts.add( new ImportConflict( "Attribute.value", "Value is not true (true-only value type)." ) );
         }
-        else if ( TrackedEntityAttribute.TYPE_USERS.equals( teAttribute.getValueType() ) )
+        else if ( ValueType.USERNAME == teAttribute.getValueType() )
         {
             if ( userService.getUserCredentialsByUsername( attribute.getValue() ) == null )
             {
                 importConflicts.add( new ImportConflict( "Attribute.value", "Value is not pointing to a valid username." ) );
             }
         }
-        else if ( TrackedEntityAttribute.TYPE_OPTION_SET.equals( teAttribute.getValueType() )
+        else if ( ValueType.OPTION_SET == teAttribute.getValueType()
             && !teAttribute.getOptionSet().getOptionCodes().contains( attribute.getValue() ) )
         {
             importConflicts.add( new ImportConflict( "Attribute.value", "Value is not pointing to a valid option code." ) );

=== 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-07-15 09:45:45 +0000
+++ 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
@@ -28,18 +28,11 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.common.IdentifiableObjectUtils.getIdList;
-import static org.hisp.dhis.commons.util.TextUtils.getCommaDelimitedString;
-import static org.hisp.dhis.system.util.DateUtils.getMediumDateString;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.commons.util.SqlHelper;
 import org.hisp.dhis.dxf2.common.IdSchemes;
 import org.hisp.dhis.dxf2.events.report.EventRow;
@@ -53,8 +46,15 @@
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.support.rowset.SqlRowSet;
 
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.hisp.dhis.common.IdentifiableObjectUtils.getIdList;
+import static org.hisp.dhis.commons.util.TextUtils.getCommaDelimitedString;
+import static org.hisp.dhis.system.util.DateUtils.getMediumDateString;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -106,8 +106,8 @@
                 event.setProgram( IdSchemes.getValue( rowSet.getString( "p_uid" ), rowSet.getString( "p_code" ), idSchemes.getProgramIdScheme() ) );
                 event.setProgramStage( IdSchemes.getValue( rowSet.getString( "ps_uid" ), rowSet.getString( "ps_code" ), idSchemes.getProgramStageIdScheme() ) );
                 event.setOrgUnit( IdSchemes.getValue( rowSet.getString( "ou_uid" ), rowSet.getString( "ou_code" ), idSchemes.getOrgUnitIdScheme() ) );
-                ProgramType programTye =  ProgramType.fromValue(rowSet.getString( "p_type" ) );
-                
+                ProgramType programTye = ProgramType.fromValue( rowSet.getString( "p_type" ) );
+
                 if ( programTye != ProgramType.WITHOUT_REGISTRATION )
                 {
                     event.setEnrollment( rowSet.getString( "pi_uid" ) );
@@ -244,7 +244,7 @@
                 Attribute attribute = new Attribute();
                 attribute.setValue( rowSet.getString( "pav_value" ) );
                 attribute.setDisplayName( rowSet.getString( "ta_name" ) );
-                attribute.setType( rowSet.getString( "ta_valuetype" ) );
+                attribute.setValueType( ValueType.fromValue( rowSet.getString( "ta_valuetype" ) ) );
                 attribute.setAttribute( rowSet.getString( "ta_uid" ) );
 
                 eventRow.getAttributes().add( attribute );

=== 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	2015-08-26 10:26:31 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java	2015-09-03 08:15:09 +0000
@@ -35,6 +35,7 @@
 import org.hisp.dhis.common.OrganisationUnitSelectionMode;
 import org.hisp.dhis.common.QueryItem;
 import org.hisp.dhis.common.QueryOperator;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.commons.collection.CachingMap;
 import org.hisp.dhis.dbms.DbmsManager;
 import org.hisp.dhis.dxf2.importsummary.ImportConflict;
@@ -146,7 +147,7 @@
         trackedEntityInstance.setTrackedEntity( entityInstance.getTrackedEntity().getUid() );
         trackedEntityInstance.setCreated( entityInstance.getCreated().toString() );
         trackedEntityInstance.setLastUpdated( entityInstance.getLastUpdated().toString() );
-        trackedEntityInstance.setInactive( entityInstance.isInactive());
+        trackedEntityInstance.setInactive( entityInstance.isInactive() );
 
         Collection<Relationship> relationships = relationshipService.getRelationshipsForTrackedEntityInstance( entityInstance );
 
@@ -181,7 +182,7 @@
 
             attribute.setDisplayName( attributeValue.getAttribute().getDisplayName() );
             attribute.setAttribute( attributeValue.getAttribute().getUid() );
-            attribute.setType( attributeValue.getAttribute().getValueType() );
+            attribute.setValueType( attributeValue.getAttribute().getValueType() );
             attribute.setCode( attributeValue.getAttribute().getCode() );
             attribute.setValue( attributeValue.getValue() );
 
@@ -328,12 +329,12 @@
             importSummary.getImportCount().incrementIgnored();
 
             return importSummary;
-        }        
-        
+        }
+
         entityInstance.setInactive( trackedEntityInstance.isInactive() );
-        
+
         removeRelationships( entityInstance );
-        removeAttributeValues( entityInstance );        
+        removeAttributeValues( entityInstance );
         teiService.updateTrackedEntityInstance( entityInstance );
 
         updateRelationships( trackedEntityInstance, entityInstance );
@@ -570,30 +571,30 @@
             importConflicts.add( new ImportConflict( "Attribute.value", "Value length is greater than 256 chars for attribute: " + attribute ) );
         }
 
-        if ( TrackedEntityAttribute.TYPE_NUMBER.equals( teAttribute.getValueType() ) && !MathUtils.isNumeric( attribute.getValue() ) )
+        if ( ValueType.NUMBER == teAttribute.getValueType() && !MathUtils.isNumeric( attribute.getValue() ) )
         {
             importConflicts.add( new ImportConflict( "Attribute.value", "Value is not numeric for attribute: " + attribute ) );
         }
-        else if ( TrackedEntityAttribute.TYPE_BOOL.equals( teAttribute.getValueType() ) && !MathUtils.isBool( attribute.getValue() ) )
+        else if ( ValueType.BOOLEAN == teAttribute.getValueType() && !MathUtils.isBool( attribute.getValue() ) )
         {
             importConflicts.add( new ImportConflict( "Attribute.value", "Value is not boolean for attribute: " + attribute ) );
         }
-        else if ( TrackedEntityAttribute.TYPE_DATE.equals( teAttribute.getValueType() ) && !DateUtils.dateIsValid( attribute.getValue() ) )
+        else if ( ValueType.DATE == teAttribute.getValueType() && !DateUtils.dateIsValid( attribute.getValue() ) )
         {
             importConflicts.add( new ImportConflict( "Attribute.value", "Value is not date for attribute: " + attribute ) );
         }
-        else if ( TrackedEntityAttribute.TYPE_TRUE_ONLY.equals( teAttribute.getValueType() ) && !"true".equals( attribute.getValue() ) )
+        else if ( ValueType.TRUE_ONLY == teAttribute.getValueType() && !"true".equals( attribute.getValue() ) )
         {
             importConflicts.add( new ImportConflict( "Attribute.value", "Value is not true (true-only value type) for attribute: " + attribute ) );
         }
-        else if ( TrackedEntityAttribute.TYPE_USERS.equals( teAttribute.getValueType() ) )
+        else if ( ValueType.USERNAME == teAttribute.getValueType() )
         {
             if ( userService.getUserCredentialsByUsername( attribute.getValue() ) == null )
             {
                 importConflicts.add( new ImportConflict( "Attribute.value", "Value is not pointing to a valid username for attribute: " + attribute ) );
             }
         }
-        else if ( TrackedEntityAttribute.TYPE_OPTION_SET.equals( teAttribute.getValueType() ) && !teAttribute.isValidOptionValue( attribute.getValue() ) )
+        else if ( ValueType.OPTION_SET == teAttribute.getValueType() && !teAttribute.isValidOptionValue( attribute.getValue() ) )
         {
             importConflicts.add( new ImportConflict( "Attribute.value", "Value is not pointing to a valid option for attribute: " + attribute ) );
         }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/Attribute.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/Attribute.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/Attribute.java	2015-09-03 08:15:09 +0000
@@ -32,6 +32,7 @@
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 import org.hisp.dhis.common.DxfNamespaces;
+import org.hisp.dhis.common.ValueType;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -43,7 +44,7 @@
 
     private String attribute;
 
-    private String type;
+    private ValueType valueType;
 
     private String code;
 
@@ -58,10 +59,10 @@
         this.value = value;
     }
 
-    public Attribute( String attribute, String type, String value )
+    public Attribute( String attribute, ValueType valueType, String value )
     {
         this.attribute = attribute;
-        this.type = type;
+        this.valueType = valueType;
         this.value = value;
     }
 
@@ -91,14 +92,14 @@
 
     @JsonProperty
     @JacksonXmlProperty( isAttribute = true )
-    public String getType()
+    public ValueType getValueType()
     {
-        return type;
+        return valueType;
     }
 
-    public void setType( String type )
+    public void setValueType( ValueType valueType )
     {
-        this.type = type;
+        this.valueType = valueType;
     }
 
     @JsonProperty
@@ -139,7 +140,7 @@
             return false;
         if ( displayName != null ? !displayName.equals( attribute1.displayName ) : attribute1.displayName != null )
             return false;
-        if ( type != null ? !type.equals( attribute1.type ) : attribute1.type != null )
+        if ( valueType != null ? !valueType.equals( attribute1.valueType ) : attribute1.valueType != null )
             return false;
         if ( code != null ? !code.equals( attribute1.code ) : attribute1.code != null )
             return false;
@@ -154,7 +155,7 @@
     {
         int result = displayName != null ? displayName.hashCode() : 0;
         result = 31 * result + (attribute != null ? attribute.hashCode() : 0);
-        result = 31 * result + (type != null ? type.hashCode() : 0);
+        result = 31 * result + (valueType != null ? valueType.hashCode() : 0);
         result = 31 * result + (code != null ? code.hashCode() : 0);
         result = 31 * result + (value != null ? value.hashCode() : 0);
         return result;
@@ -164,6 +165,6 @@
     public String toString()
     {
         return "Attribute{" + "displayName='" + displayName + '\'' + ", attribute='" + attribute + '\'' + ", type='"
-            + type + '\'' + ", code='" + code + '\'' + ", value='" + value + '\'' + '}';
+            + valueType + '\'' + ", code='" + code + '\'' + ", value='" + value + '\'' + '}';
     }
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java'
--- dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java	2015-09-03 03:11:47 +0000
+++ dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java	2015-09-03 08:15:09 +0000
@@ -896,7 +896,8 @@
             if ( isExist )
             {
                 TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( Integer.parseInt( attributeId ) );
-                if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_NUMBER ) )
+
+                if ( ValueType.NUMBER == attribute.getValueType() )
                 {
                     sql += " AND cast( _pav.value as " + statementBuilder.getDoubleColumnType() + " )  ";
                 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2015-09-03 03:11:47 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2015-09-03 08:15:09 +0000
@@ -41,9 +41,6 @@
 import org.hisp.dhis.api.mobile.model.LWUITmodel.Notification;
 import org.hisp.dhis.api.mobile.model.LWUITmodel.Patient;
 import org.hisp.dhis.api.mobile.model.LWUITmodel.PatientList;
-import org.hisp.dhis.api.mobile.model.LWUITmodel.Section;
-import org.hisp.dhis.api.mobile.model.OptionSet;
-import org.hisp.dhis.api.mobile.model.PatientAttribute;
 import org.hisp.dhis.api.mobile.model.Task;
 import org.hisp.dhis.api.mobile.model.comparator.ActivityComparator;
 import org.hisp.dhis.api.mobile.model.comparator.TrackedEntityAttributeValueSortOrderComparator;
@@ -55,6 +52,7 @@
 import org.hisp.dhis.common.QueryFilter;
 import org.hisp.dhis.common.QueryItem;
 import org.hisp.dhis.common.QueryOperator;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.event.EventStatus;
@@ -812,11 +810,13 @@
         {
             if ( value != null )
             {
+                /*
                 org.hisp.dhis.api.mobile.model.PatientAttribute patientAttribute = new org.hisp.dhis.api.mobile.model.PatientAttribute(
                     value.getAttribute().getName(), value.getValue(), value.getAttribute().getValueType(), false, value
                     .getAttribute().getDisplayInListNoProgram(), new OptionSet() );
 
                 patientAtts.add( patientAttribute );
+                */
             }
         }
 
@@ -1416,14 +1416,15 @@
     {
         List<org.hisp.dhis.api.mobile.model.PatientAttribute> list = new ArrayList<>();
 
+        /*
         for ( TrackedEntityAttribute patientAtt : getPatientAtts( null ) )
         {
             list.add( new PatientAttribute( patientAtt.getName(), null, patientAtt.getValueType(), false, patientAtt
                 .getDisplayInListNoProgram(), new OptionSet() ) );
         }
+        */
 
         return list;
-
     }
 
     @Override
@@ -1431,6 +1432,7 @@
     {
         List<org.hisp.dhis.api.mobile.model.PatientAttribute> list = new ArrayList<>();
 
+        /*
         for ( TrackedEntityAttribute pa : getPatientAtts( programId ) )
         {
             PatientAttribute patientAttribute = new PatientAttribute();
@@ -1442,6 +1444,7 @@
 
             list.add( patientAttribute );
         }
+        */
 
         return list;
     }
@@ -1926,7 +1929,7 @@
                 for ( TrackedEntityAttributeValue attrValue : programStageInstance.getProgramInstance()
                     .getEntityInstance().getAttributeValues() )
                 {
-                    if ( attrValue.getAttribute().getValueType().equals( "phoneNumber" ) )
+                    if ( ValueType.PHONE_NUMBER == attrValue.getAttribute().getValueType() )
                     {
                         User user = new User();
                         user.setPhoneNumber( attrValue.getValue() );
@@ -1934,8 +1937,7 @@
                     }
 
                 }
-                smsSender.sendMessage( lostEvent.getName(), lostEvent.getSMS(), currentUserService.getCurrentUser(),
-                    recipientsList, false );
+                smsSender.sendMessage( lostEvent.getName(), lostEvent.getSMS(), currentUserService.getCurrentUser(), recipientsList, false );
             }
 
             notification.setMessage( "Success" );
@@ -2440,7 +2442,7 @@
     {
         I18nFormat format = i18nManager.getI18nFormat();
 
-        Set<String> phoneNumbers = reminderService.getPhonenumbers( reminder, entityInstance );
+        Set<String> phoneNumbers = reminderService.getPhoneNumbers( reminder, entityInstance );
         OutboundSms outboundSms = null;
 
         if ( phoneNumbers.size() > 0 )

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java	2015-09-03 03:11:47 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java	2015-09-03 08:15:09 +0000
@@ -35,6 +35,7 @@
 import org.hisp.dhis.api.mobile.model.OptionSet;
 import org.hisp.dhis.api.mobile.model.Program;
 import org.hisp.dhis.api.mobile.model.ProgramStage;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.program.ProgramStageDataElement;
 import org.hisp.dhis.program.ProgramStageSection;
@@ -314,7 +315,7 @@
 
         org.hisp.dhis.api.mobile.model.PatientAttribute mobileAttribute = new org.hisp.dhis.api.mobile.model.PatientAttribute();
         mobileAttribute.setName( pa.getName() );
-        mobileAttribute.setType( pa.getValueType() );
+        // mobileAttribute.setType( pa.getValueType() );
         mobileAttribute.setValue( "" );
 
         if ( ppa.isDisplayInList() )
@@ -328,7 +329,7 @@
 
         mobileAttribute.setMandatory( ppa.isMandatory() );
 
-        if ( pa.getValueType().equals( TrackedEntityAttribute.TYPE_OPTION_SET ) )
+        if ( ValueType.OPTION_SET == pa.getValueType() )
         {
             OptionSet optionSet = new OptionSet();
 

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/filter/AggregatableTrackedEntityAttributeValueFilter.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/filter/AggregatableTrackedEntityAttributeValueFilter.java	2015-07-12 14:19:35 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/filter/AggregatableTrackedEntityAttributeValueFilter.java	2015-09-03 08:15:09 +0000
@@ -28,24 +28,23 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Set;
-
+import com.google.common.collect.Sets;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.commons.filter.Filter;
-import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 
-import com.google.common.collect.Sets;
+import java.util.Set;
 
 public class AggregatableTrackedEntityAttributeValueFilter
     implements Filter<TrackedEntityAttribute>
 {
     public static final AggregatableTrackedEntityAttributeValueFilter INSTANCE = new AggregatableTrackedEntityAttributeValueFilter();
-    
-    private static final Set<String> TYPES = Sets.newHashSet( TrackedEntityAttribute.TYPE_NUMBER, DataElement.VALUE_TYPE_INT,
-        TrackedEntityAttribute.TYPE_BOOL, TrackedEntityAttribute.TYPE_OPTION_SET );
-    
+
+    private static final Set<ValueType> TYPES = Sets.newHashSet(
+        ValueType.INTEGER, ValueType.INTEGER_POSITIVE, ValueType.INTEGER_NEGATIVE, ValueType.INTEGER_ZERO_OR_POSITIVE, ValueType.NUMBER,
+        ValueType.UNIT_INTERVAL, ValueType.PERCENTAGE, ValueType.BOOLEAN, ValueType.OPTION_SET );
+
     //TODO Option set is not robust as it might contain any value type, needs to change with new Enum is in place
-
     @Override
     public boolean retain( TrackedEntityAttribute object )
     {

=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2015-09-03 04:42:52 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2015-09-03 08:15:09 +0000
@@ -1364,7 +1364,7 @@
 
         attribute.setName( "Attribute" + uniqueChar );
         attribute.setDescription( "Attribute" + uniqueChar );
-        attribute.setValueType( TrackedEntityAttribute.TYPE_STRING );
+        attribute.setValueType( ValueType.TEXT );
 
         return attribute;
     }
@@ -1373,14 +1373,14 @@
      * @param uniqueChar A unique character to identify the object.
      * @return TrackedEntityAttribute
      */
-    public static TrackedEntityAttribute createTrackedEntityAttribute( char uniqueChar, String type )
+    public static TrackedEntityAttribute createTrackedEntityAttribute( char uniqueChar, ValueType valueType )
     {
         TrackedEntityAttribute attribute = new TrackedEntityAttribute();
         attribute.setAutoFields();
 
         attribute.setName( "Attribute" + uniqueChar );
         attribute.setDescription( "Attribute" + uniqueChar );
-        attribute.setValueType( type );
+        attribute.setValueType( valueType );
 
         return attribute;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsAction.java	2015-09-03 08:15:09 +0000
@@ -172,7 +172,7 @@
         reminder.setTemplateMessage( msg );
         reminder.setSendTo( sendTo );
 
-        Set<String> phoneNumbers = reminderService.getPhonenumbers( reminder, programStageInstance
+        Set<String> phoneNumbers = reminderService.getPhoneNumbers( reminder, programStageInstance
             .getProgramInstance().getEntityInstance() );
 
         try
@@ -212,7 +212,7 @@
         reminder.setTemplateMessage( msg );
         reminder.setSendTo( sendTo );
 
-        Set<String> phoneNumbers = reminderService.getPhonenumbers( reminder, programInstance.getEntityInstance() );
+        Set<String> phoneNumbers = reminderService.getPhoneNumbers( reminder, programInstance.getEntityInstance() );
 
         try
         {

=== 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-08-02 12:27:56 +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 08:15:09 +0000
@@ -29,10 +29,10 @@
  */
 
 import com.opensymphony.xwork2.Action;
-
 import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.analytics.AggregationType;
 import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.legend.LegendService;
 import org.hisp.dhis.option.OptionService;
 import org.hisp.dhis.period.PeriodService;
@@ -121,9 +121,9 @@
     {
         this.valueType = valueType;
     }
-    
+
     private String aggregationType;
-    
+
     public void setAggregationType( String aggregationType )
     {
         this.aggregationType = aggregationType;
@@ -206,18 +206,18 @@
         trackedEntityAttribute.setShortName( StringUtils.trimToNull( shortName ) );
         trackedEntityAttribute.setCode( StringUtils.trimToNull( code ) );
         trackedEntityAttribute.setDescription( StringUtils.trimToNull( description ) );
-        trackedEntityAttribute.setValueType( valueType );
+        trackedEntityAttribute.setValueType( ValueType.fromValue( valueType ) );
         trackedEntityAttribute.setAggregationType( AggregationType.fromValue( aggregationType ) );
         trackedEntityAttribute.setExpression( expression );
         trackedEntityAttribute.setDisplayOnVisitSchedule( false );
 
-        unique = (unique == null) ? false : true;
+        unique = unique != null;
         trackedEntityAttribute.setUnique( unique );
 
-        inherit = (inherit == null) ? false : true;
+        inherit = inherit != null;
         trackedEntityAttribute.setInherit( inherit );
 
-        confidential = (confidential == null) ? false : true;
+        confidential = confidential != null;
         trackedEntityAttribute.setConfidential( confidential );
 
         if ( unique )

=== 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-08-02 12:27:56 +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 08:15:09 +0000
@@ -29,13 +29,12 @@
  */
 
 import com.opensymphony.xwork2.Action;
-
 import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.analytics.AggregationType;
 import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.legend.LegendService;
 import org.hisp.dhis.option.OptionService;
-import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.system.util.AttributeUtils;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 import org.hisp.dhis.trackedentity.TrackedEntityAttributeService;
@@ -75,9 +74,6 @@
     private OptionService optionService;
 
     @Autowired
-    private PeriodService periodService;
-
-    @Autowired
     private LegendService legendService;
 
     @Autowired
@@ -130,7 +126,7 @@
     }
 
     private String aggregationType;
-    
+
     public void setAggregationType( String aggregationType )
     {
         this.aggregationType = aggregationType;
@@ -213,19 +209,19 @@
         trackedEntityAttribute.setShortName( StringUtils.trimToNull( shortName ) );
         trackedEntityAttribute.setCode( StringUtils.trimToNull( code ) );
         trackedEntityAttribute.setDescription( StringUtils.trimToNull( description ) );
-        trackedEntityAttribute.setValueType( valueType );
+        trackedEntityAttribute.setValueType( ValueType.fromValue( valueType ) );
         trackedEntityAttribute.setAggregationType( AggregationType.fromValue( aggregationType ) );
         trackedEntityAttribute.setExpression( expression );
         trackedEntityAttribute.setDisplayOnVisitSchedule( false );
         trackedEntityAttribute.setOptionSet( null );
 
-        unique = (unique != null);
+        unique = unique != null;
         trackedEntityAttribute.setUnique( unique );
 
-        inherit = (inherit != null);
+        inherit = inherit != null;
         trackedEntityAttribute.setInherit( inherit );
 
-        confidential = (confidential != null);
+        confidential = confidential != null;
         trackedEntityAttribute.setConfidential( confidential );
 
         if ( unique )

=== 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-08-02 12:27:56 +0000
+++ 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
@@ -82,27 +82,27 @@
 		</td>		
 		<td></td>				
 	</tr>
-	
+
     <tr>
-        <td><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-        <td>
-            <select id="valueType" name="valueType" onchange="typeOnChange();">
-                <option value="number" selected="selected">$i18n.getString( "number" )</option>
-                <option value="string">$i18n.getString( "text" )</option>
-                <option value="letter">$i18n.getString( "letter_only" )</option>
-                <option value="bool">$i18n.getString( "yes_no" )</option>
-				<option value="trueOnly">$i18n.getString( "yes_only" )</option>
-                <option value="date">$i18n.getString( "date" )</option>
-                <option value="phoneNumber">$i18n.getString( "phone_number" )</option>
-                <option value="phoneNumber">$i18n.getString( "email" )</option>
-                <option value="trackerAssociate">$i18n.getString( "tracker_associate" )</option>
-                <option value="users">$i18n.getString( "users" )</option>
-                <option value="optionSet">$i18n.getString( "option_set" )</option>
-            </select>
-        </td>
-        <td></td>
+      <td><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+      <td>
+        <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="LETTER">$i18n.getString( "letter_only" )</option>
+          <option value="BOOLEAN">$i18n.getString( "yes_no" )</option>
+          <option value="TRUE_ONLY">$i18n.getString( "yes_only" )</option>
+          <option value="DATE">$i18n.getString( "date" )</option>
+          <option value="PHONE_NUMBER">$i18n.getString( "phone_number" )</option>
+          <option value="EMAIL">$i18n.getString( "email" )</option>
+          <option value="TRACKER_ASSOCIATE">$i18n.getString( "tracker_associate" )</option>
+          <option value="USERNAME">$i18n.getString( "users" )</option>
+          <option value="OPTION_SET">$i18n.getString( "option_set" )</option>
+        </select>
+      </td>
+      <td></td>
     </tr>
-    
+
     <tr>
         <td><label for="aggregationType">$i18n.getString( "aggregation_type" )</label></td>
         <td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addValidationCriteria.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addValidationCriteria.vm	2015-04-16 07:08:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addValidationCriteria.vm	2015-09-03 08:15:09 +0000
@@ -24,7 +24,7 @@
 					<select id='property' name='property' style='width:120px' onChange="showDivValue();">
 						<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
 						#foreach($programAttribute in $program.programAttributes)
-							#if( $programAttribute.attribute.valueType!='trackerAssociate')
+							#if( $programAttribute.attribute.valueType!='TRACKER_ASSOCIATE')
 								#set($opt="")
 								#foreach($option in $programAttribute.attribute.optionSet.options)
 									#set($opt=$opt + ';' + $option.code + ':' + $option.name )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/attribute.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/attribute.js	2015-04-08 04:43:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/attribute.js	2015-09-03 08:15:09 +0000
@@ -1,127 +1,126 @@
-
 $(function() {
   dhis2.contextmenu.makeContextMenu({
     menuId: 'contextMenu',
     menuItemActiveClass: 'contextMenuItemActive'
   });
+
+  typeOnChange();
 });
 
 // -----------------------------------------------------------------------------
 // View details
 // -----------------------------------------------------------------------------
 
-function showUpdateAttributeForm( context ) {
+function showUpdateAttributeForm(context) {
   location.href = 'showUpdateAttributeForm.action?id=' + context.id;
 }
 
-function showAttributeDetails( context ) {
-	jQuery.getJSON( 'getAttribute.action', { id: context.id },
-		function ( json ) {
-			setInnerHTML( 'nameField', json.attribute.name );	
-			setInnerHTML( 'descriptionField', json.attribute.description );
-			setInnerHTML( 'optionSetField', json.attribute.optionSet );
-			setInnerHTML( 'idField', json.attribute.uid );
-			
-			var unique = ( json.attribute.unique == 'true') ? i18n_yes : i18n_no;
-			setInnerHTML( 'uniqueField', unique );
-			
-			var inherit = ( json.attribute.inherit == 'true') ? i18n_yes : i18n_no;
-			setInnerHTML( 'inheritField', inherit );
-			
-			var confidential = ( json.attribute.confidential == 'true') ? i18n_yes : i18n_no;
-			setInnerHTML( 'confidentialField', confidential );
-			
-			var valueType = json.attribute.valueType;
-			var typeMap = attributeTypeMap();
-			setInnerHTML( 'valueTypeField', typeMap[valueType] );   
-
-			if(json.attribute.unique == 'true'){
-				var orgunitScope = json.attribute.orgunitScope;
-				var programScope = json.attribute.programScope;
-				if( orgunitScope=='false' && programScope=='false' ){
-					setInnerHTML( 'scopeField', i18n_whole_system);
-				}
-				else if(orgunitScope=='true' && programScope=='false' ){
-					setInnerHTML( 'scopeField', i18n_orgunit);
-				}
-				else if(orgunitScope=='false' && programScope=='true' ){
-					setInnerHTML( 'scopeField', i18n_program);
-				}	
-				else{
-					setInnerHTML( 'scopeField', i18n_program_within_orgunit);
-				}
-			}
-			
-			showDetails();
-	});
+function showAttributeDetails(context) {
+  jQuery.getJSON('getAttribute.action', { id: context.id },
+    function(json) {
+      setInnerHTML('nameField', json.attribute.name);
+      setInnerHTML('descriptionField', json.attribute.description);
+      setInnerHTML('optionSetField', json.attribute.optionSet);
+      setInnerHTML('idField', json.attribute.uid);
+
+      var unique = ( json.attribute.unique == 'true') ? i18n_yes : i18n_no;
+      setInnerHTML('uniqueField', unique);
+
+      var inherit = ( json.attribute.inherit == 'true') ? i18n_yes : i18n_no;
+      setInnerHTML('inheritField', inherit);
+
+      var confidential = ( json.attribute.confidential == 'true') ? i18n_yes : i18n_no;
+      setInnerHTML('confidentialField', confidential);
+
+      var valueType = json.attribute.valueType;
+      var typeMap = attributeTypeMap();
+      setInnerHTML('valueTypeField', typeMap[valueType]);
+
+      if( json.attribute.unique == 'true' ) {
+        var orgunitScope = json.attribute.orgunitScope;
+        var programScope = json.attribute.programScope;
+        if( orgunitScope == 'false' && programScope == 'false' ) {
+          setInnerHTML('scopeField', i18n_whole_system);
+        }
+        else if( orgunitScope == 'true' && programScope == 'false' ) {
+          setInnerHTML('scopeField', i18n_orgunit);
+        }
+        else if( orgunitScope == 'false' && programScope == 'true' ) {
+          setInnerHTML('scopeField', i18n_program);
+        }
+        else {
+          setInnerHTML('scopeField', i18n_program_within_orgunit);
+        }
+      }
+
+      showDetails();
+    });
 }
 
-function attributeTypeMap()
-{
-	var typeMap = [];
-	typeMap['number'] = i18n_number;
-	typeMap['string'] = i18n_text;
-	typeMap['bool'] = i18n_yes_no;
-	typeMap['trueOnly'] = i18n_yes_only;
-	typeMap['date'] = i18n_date;
-	typeMap['phoneNumber'] = i18n_phone_number;
-	typeMap['trackerAssociate'] = i18n_tracker_associate;
-	typeMap['optionSet'] = i18n_option_set;
-	return typeMap;
+function attributeTypeMap() {
+  var typeMap = [];
+  typeMap['NUMBER'] = i18n_number;
+  typeMap['TEXT'] = i18n_text;
+  typeMap['BOOLEAN'] = i18n_yes_no;
+  typeMap['TRUE_ONLY'] = i18n_yes_only;
+  typeMap['DATE'] = i18n_date;
+  typeMap['PHONE_NUMBER'] = i18n_phone_number;
+  typeMap['TRACKER_ASSOCIATE'] = i18n_tracker_associate;
+  typeMap['OPTION_SET'] = i18n_option_set;
+  return typeMap;
 }
 
 // -----------------------------------------------------------------------------
 // Remove Attribute
 // -----------------------------------------------------------------------------
 
-function removeAttribute( context )
-{
-	removeItem( context.id, context.name, i18n_confirm_delete, 'removeAttribute.action' );
+function removeAttribute(context) {
+  removeItem(context.id, context.name, i18n_confirm_delete, 'removeAttribute.action');
 }
 
 
 function typeOnChange() {
-	var type = getFieldValue('valueType');
-
-	hideById("optionSetRow");
-	disable("optionSetId");
-	hideById("trackedEntityRow");
-	disable("trackedEntityId");
-
-	if( type == "optionSet" ) {
-		showById("optionSetRow");
-		enable("optionSetId");
-	}
-	else if( type == "trackerAssociate" ) {
-		showById("trackedEntityRow");
-		enable("trackedEntityId");
-	}
-
-	if( type == "number" || type == 'string' || type == 'letter' || type == 'phoneNumber' ) {
-		enable("unique");
-	}
-	else {
-		disable("unique");
-	}
+  var type = getFieldValue('valueType');
+
+  hideById("optionSetRow");
+  disable("optionSetId");
+  hideById("trackedEntityRow");
+  disable("trackedEntityId");
+
+  if( type == "OPTION_SET" ) {
+    showById("optionSetRow");
+    enable("optionSetId");
+  }
+  else if( type == "TRACKER_ASSOCIATE" ) {
+    showById("trackedEntityRow");
+    enable("trackedEntityId");
+  }
+
+  if( type == "NUMBER" || type == 'TEXT' || type == 'LETTER' || type == 'PHONE_NUMBER' ) {
+    enable("unique");
+  }
+  else {
+    disable("unique");
+  }
 }
 
-function uniqueOnChange(){
-	if( $('#unique').attr('checked')=="checked") {
-		jQuery('[name=uniqueTR]').show();
-		jQuery('#valueType [value=bool]').hide();
-		jQuery('#valueType [value=trueOnly]').hide();
-		jQuery('#valueType [value=date]').hide();
-		jQuery('#valueType [value=trackerAssociate]').hide();
-		jQuery('#valueType [value=users]').hide();
-		jQuery('#valueType [value=optionSet]').hide();
-	}
-	else {
-		jQuery('[name=uniqueTR]').hide();
-		jQuery('#valueType [value=bool]').show();
-		jQuery('#valueType [value=trueOnly]').show();
-		jQuery('#valueType [value=date]').show();
-		jQuery('#valueType [value=trackerAssociate]').show();
-		jQuery('#valueType [value=users]').show();
-		jQuery('#valueType [value=optionSet]').show();
-	}
+function uniqueOnChange() {
+  if( $('#unique').attr('checked') == "checked" ) {
+    jQuery('[name=uniqueTR]').show();
+    jQuery('#valueType [value=BOOLEAN]').hide();
+    jQuery('#valueType [value=TRUE_ONLY]').hide();
+    jQuery('#valueType [value=DATE]').hide();
+    jQuery('#valueType [value=TRACKER_ASSOCIATE]').hide();
+    jQuery('#valueType [value=USERNAME]').hide();
+    jQuery('#valueType [value=OPTION_SET]').hide();
+  }
+  else {
+    jQuery('[name=uniqueTR]').hide();
+    jQuery('#valueType [value=BOOLEAN]').show();
+    jQuery('#valueType [value=TRUE_ONLY]').show();
+    jQuery('#valueType [value=DATE]').show();
+    jQuery('#valueType [value=TRACKER_ASSOCIATE]').show();
+    jQuery('#valueType [value=USERNAME]').show();
+    jQuery('#valueType [value=OPTION_SET]').show();
+  }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/caseaggregation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/caseaggregation.js	2015-02-26 13:29:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/caseaggregation.js	2015-09-03 08:15:09 +0000
@@ -4,7 +4,7 @@
 
 function getDataElementsByDataset() {
   var dataSets = document.getElementById('dataSets');
-  var dataSetId = dataSets.options[ dataSets.selectedIndex ].value;
+  var dataSetId = dataSets.options[dataSets.selectedIndex].value;
   setFieldValue('aggregationDataElementId', '');
   setFieldValue('aggregationDataElementInput', '');
 
@@ -24,12 +24,12 @@
     .autocomplete({
       delay: 0,
       minLength: 0,
-      source: function( request, response ) {
+      source: function(request, response) {
         $.ajax({
           url: "getDataElementsByDataset.action?id=" + getFieldValue('dataSets') + "&query=" + input.val(),
           dataType: "json",
-          success: function( data ) {
-            response($.map(data.dataElements, function( item ) {
+          success: function(data) {
+            response($.map(data.dataElements, function(item) {
               return {
                 label: item.name,
                 id: item.id
@@ -38,15 +38,15 @@
           }
         });
       },
-      select: function( event, ui ) {
+      select: function(event, ui) {
         input.val(ui.item.value);
         setFieldValue('aggregationDataElementId', ui.item.id);
         input.autocomplete("close");
       },
-      change: function( event, ui ) {
+      change: function(event, ui) {
         if( !ui.item ) {
           var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex($(this).val()) + "$", "i"),
-            valid = false;
+          valid = false;
           select.children("option").each(function() {
             if( $(this).text().match(matcher) ) {
               this.selected = valid = true;
@@ -64,7 +64,7 @@
       }
     }).addClass("ui-widget");
 
-  input.data("uiAutocomplete")._renderItem = function( ul, item ) {
+  input.data("uiAutocomplete")._renderItem = function(ul, item) {
     return $("<li></li>")
       .data("item.autocomplete", item)
       .append("<a>" + item.label + "</a>")
@@ -122,7 +122,7 @@
   }
 
   jQuery.getJSON('getParamsByProgram.action', { programId: programId }
-    , function( json ) {
+    , function(json) {
       enable('programProperty');
       var programstage = jQuery('#programStageId');
 
@@ -141,7 +141,7 @@
       getTrackedEntityDataElements();
 
       clearListById('caseProperty');
-	  clearListById('casePropertyBackups');
+      clearListById('casePropertyBackups');
       var type = jQuery('#programId option:selected').attr('programType');
       if( type != '3' ) {
         var caseProperty = jQuery('#caseProperty');
@@ -150,8 +150,8 @@
           var id = json.attributes[i].id;
           var name = json.attributes[i].name;
           var optionSet = json.attributes[i].optionSet;
-         
- 		  caseProperty.append("<option value='" + id + "' title='" + name + "' optionSet='" + optionSet + "'>" + name + "</option>");
+
+          caseProperty.append("<option value='" + id + "' title='" + name + "' optionSet='" + optionSet + "'>" + name + "</option>");
           casePropertyBackups.append("<option value='" + id + "' title='" + name + "' optionSet='" + optionSet + "'>" + name + "</option>");
         }
       }
@@ -165,7 +165,7 @@
   clearListById('orgunitProgramStageId');
 
   jQuery.getJSON('getProgramStages.action', { id: programId }
-    , function( json ) {
+    , function(json) {
       enable('programProperty');
       var programstage = jQuery('#orgunitProgramStageId');
 
@@ -194,7 +194,7 @@
       programId: getFieldValue('programId'),
       programStageId: programStageId
     }
-    , function( json ) {
+    , function(json) {
       if( programStageId != '' ) {
         enable('programStageProperty');
       }
@@ -209,7 +209,7 @@
       var deSumId = jQuery('#deSumId');
       deSumId.append("<option value='' >" + i18n_please_select + "</option>");
       for( i in json.dataElements ) {
-		var id =  json.dataElements[i].localid;
+        var id = json.dataElements[i].localid;
         dataElements.append("<option value='" + id + "' title='" + json.dataElements[i].name + "' dename='" + json.dataElements[i].name + "' decode='" + json.dataElements[i].code + "' optionSet='" + json.dataElements[i].optionset + "' valuetype='" + json.dataElements[i].type + "'>" + json.dataElements[i].name + "</option>");
         dataElementBackups.append("<option value='" + id + "' title='" + json.dataElements[i].name + "' dename='" + json.dataElements[i].name + "' decode='" + json.dataElements[i].code + "' optionSet='" + json.dataElements[i].optionset + "' valuetype='" + json.dataElements[i].type + "'>" + json.dataElements[i].name + "</option>");
         if( json.dataElements[i].type == 'int' ) {
@@ -224,7 +224,7 @@
 // Insert items into Condition
 //-----------------------------------------------------------------
 
-function insertDataElement( element ) {
+function insertDataElement(element) {
   var progamId = getFieldValue('programId');
   var programStageId = getFieldValue('programStageId');
   programStageId = ( programStageId == "" ) ? "*" : programStageId;
@@ -234,7 +234,7 @@
   getConditionDescription();
 }
 
-function insertInfo( element, isProgramStageProperty ) {
+function insertInfo(element, isProgramStageProperty) {
   var id = "";
   if( isProgramStageProperty ) {
     id = getFieldValue('programStageId');
@@ -248,12 +248,12 @@
   getConditionDescription();
 }
 
-function insertOperator( value ) {
+function insertOperator(value) {
   insertTextCommon('aggregationCondition', ' ' + value + ' ');
   getConditionDescription();
 }
 
-function insertBoolValue( value ) {
+function insertBoolValue(value) {
   insertTextCommon("aggregationCondition", " ='" + value + "' ");
   getConditionDescription();
 }
@@ -262,7 +262,7 @@
 // Remove Case Aggregation Condition
 // -----------------------------------------------------------------------------
 
-function removeCaseAggregation( context ) {
+function removeCaseAggregation(context) {
   removeItem(context.id, context.name, i18n_confirm_delete, 'removeCaseAggregation.action');
 }
 
@@ -270,12 +270,12 @@
 // View details
 // -----------------------------------------------------------------------------
 
-function showUpdateCaseAggregationForm( context ) {
+function showUpdateCaseAggregationForm(context) {
   location.href = 'showUpdateCaseAggregationForm.action?id=' + context.id;
 }
 
-function showCaseAggregationDetails( context ) {
-  jQuery.getJSON('getCaseAggregation.action', { id: context.id }, function( json ) {
+function showCaseAggregationDetails(context) {
+  jQuery.getJSON('getCaseAggregation.action', { id: context.id }, function(json) {
     setInnerHTML('nameField', json.caseAggregation.name);
     setInnerHTML('operatorField', json.caseAggregation.operator);
     setInnerHTML('aggregationDataElementField', json.caseAggregation.aggregationDataElement);
@@ -295,7 +295,7 @@
   $.postUTF8('getCaseAggregationDescription.action',
     {
       condition: getFieldValue('aggregationCondition')
-    }, function( data ) {
+    }, function(data) {
       byId('aggregationDescription').innerHTML = data;
     }, 'html');
 }
@@ -311,7 +311,7 @@
       condition: getFieldValue('aggregationCondition'),
       deSumId: getFieldValue('deSumId'),
       operator: operator
-    }, function( json ) {
+    }, function(json) {
       var type = json.response;
 
       if( type == "input" ) {
@@ -323,10 +323,10 @@
     });
 }
 
-function getoptionSetValues( sourceId, targetId ) {
+function getoptionSetValues(sourceId, targetId) {
   clearListById(targetId);
 
-  var optionSetValues = jQuery('select[id=' + sourceId + '] option:selected').attr('optionSet');
+  var optionSetValues = jQuery('select[id=' + sourceId + '] option:selected').attr('TRACKER_ASSOCIATE');
   if( optionSetValues ) {
     var arrValues = new Array();
     arrValues = optionSetValues.replace(/[//[]+/g, '').replace(/]/g, '').split(', ');
@@ -344,13 +344,13 @@
   }
 }
 
-function insertSingleValue( elementId ) {
+function insertSingleValue(elementId) {
   var element = byId(elementId);
   insertTextCommon('aggregationCondition', "=" + element.options[element.selectedIndex].value);
   getConditionDescription();
 }
 
-function insertMultiValues( elementId ) {
+function insertMultiValues(elementId) {
   var list = jQuery('select[id=' + elementId + '] option')
   if( list.length == 0 ) {
     return;
@@ -374,11 +374,11 @@
   $.get('getCaseAggConditionByDataset.action',
     {
       dataSetId: getFieldValue('dataSetId'),
-	  key: getFieldValue('key')
+      key: getFieldValue('key')
     }
-    , function( html ) {
+    , function(html) {
       setInnerHTML('list', html);
-	  setTableStyles();
+      setTableStyles();
     });
 }
 
@@ -386,7 +386,7 @@
   window.location.href = 'showAddCaseAggregationForm.action?dataSetId=' + getFieldValue('dataSetId');
 }
 
-function operatorOnchange( operator ) {
+function operatorOnchange(operator) {
   if( operator == 'sum' || operator == 'avg'
     || operator == 'min' || operator == 'max' ) {
     enable('deSumId');
@@ -396,7 +396,7 @@
   }
 }
 
-function filterDataElement( event, value, fieldName, backupFieldsName ) {
+function filterDataElement(event, value, fieldName, backupFieldsName) {
   // Remove all options in data element fields
   var field = jQuery('#' + fieldName + " option ").remove();
   var valueType = getFieldValue('deValueType');
@@ -415,18 +415,18 @@
 
 }
 
-function filterAttribute( event, value, fieldName, backupFieldsName ) {
+function filterAttribute(event, value, fieldName, backupFieldsName) {
   // Remove all options in data element fields
   var field = jQuery('#' + fieldName + " option ").remove();
   jQuery('#' + backupFieldsName + " option ").each(function() {
     var option = jQuery(this);
-     if( option.text().toLowerCase().indexOf(value.toLowerCase()) != -1 ) {
-        jQuery('#' + fieldName).append("<option value='" + option.attr('value') + "' title='" + option.attr('value') + "' optionSet='" + option.attr('optionSet') + "' >" + option.text() + "</option>");
-      }
+    if( option.text().toLowerCase().indexOf(value.toLowerCase()) != -1 ) {
+      jQuery('#' + fieldName).append("<option value='" + option.attr('value') + "' title='" + option.attr('value') + "' optionSet='" + option.attr('optionSet') + "' >" + option.text() + "</option>");
+    }
   });
 }
 
-function sortByOnChange( sortBy ) {
+function sortByOnChange(sortBy) {
   if( sortBy == 1 ) {
     jQuery('#dataElements').each(function() {
 
@@ -434,7 +434,7 @@
       var selectedValue = $(this).val();
 
       // sort it out
-      $(this).html($("option", $(this)).sort(function( a, b ) {
+      $(this).html($("option", $(this)).sort(function(a, b) {
         return $(a).attr('dename') == $(b).attr('dename') ? 0 : $(a).attr('dename') < $(b).attr('dename') ? -1 : 1
       }));
 
@@ -450,7 +450,7 @@
       var selectedValue = $(this).val();
 
       // sort it out
-      $(this).html($("option", $(this)).sort(function( a, b ) {
+      $(this).html($("option", $(this)).sort(function(a, b) {
         return $(a).attr('decode') == $(b).attr('decode') ? 0 : $(a).attr('decode') < $(b).attr('decode') ? -1 : 1
       }));
 
@@ -461,7 +461,7 @@
   }
 }
 
-function displayNameOnChange( displayName ) {
+function displayNameOnChange(displayName) {
   // display - name
   if( displayName == '1' ) {
     jQuery('#dataElements option').each(function() {
@@ -505,113 +505,110 @@
   window.location.href = 'caseAggregation.action?dataSetId=' + dataSetId;
 }
 
-function attributeAutocompletedField( idField, optionSetUid, btnId, optionId )
-{
-	$("#" + btnId).unbind('click');
-	enable(btnId);
-	var input = jQuery( "#" + idField );
-	var select = jQuery( "#attributeId" );
-	input.autocomplete({
-		  delay: 0,
-		  minLength: 0,
-		  source: function( request, response ) {
-			$.ajax({
-			    url: "getOptions.action?id=" + optionSetUid + "&query=" + input.val(),
-				dataType: "json",
-			    success: function( data ) {
-				response( $.map( data.options, function ( item ) {
-					return {
-						label: item.n,
-						id: item.c
-					};
-				} ));
-			  }
-			});
-		  },
-		  select: function( event, ui ) {
-			input.val(ui.item.label);
-			jQuery("#" + optionId).append( "<option value='" + ui.item.id + "'>" + ui.item.label + "</option>" );
-			input.autocomplete("close");
-			
-			return false;
-		  },
-		  change: function( event, ui ) {
-			if( !ui.item ) {
-			  var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex($(this).val()) + "$", "i"),
-				valid = false;
-			  select.children("option").each(function() {
-				if( $(this).text().match(matcher) ) {
-				  this.selected = valid = true;
-				  return false;
-				}
-			  });
-			  if( !valid ) {
-				// remove invalid value, as it didn't match anything
-				$(this).val("");
-				select.val("");
-				input.data("uiAutocomplete").term = "";
-				return false;
-			  }
-			}
-		  }
-		}).addClass("ui-widget");
-
-	input.data("uiAutocomplete")._renderItem = function( ul, item ) {
-		return $("<li></li>")
-		  .data("item.autocomplete", item)
-		  .append("<a>" + item.label + "</a>")
-		  .appendTo(ul);
-	  };
-
-	var wrapper = this.wrapper = $("<span style='width:200px'>")
-		.addClass("ui-combobox")
-		.insertAfter(input);
-
-	var button = $("#" + btnId)
-		.attr("tabIndex", -1)
-		.attr("title", i18n_show_all_items)
-		.appendTo(wrapper)
-		.button({
-		  icons: {
-			primary: "ui-icon-triangle-1-s"
-		  },
-		  text: false
-		})
-		.click(function() {
-		  // close if already visible
-		  if( input.autocomplete("widget").is(":visible") ) {
-			input.autocomplete("close");
-			return;
-		  }
-		  // work around a bug (likely same cause as #5265)
-		  $(this).blur();
-		  // pass empty string as value to search for, displaying all results
-		  input.autocomplete("search", "");
-		  input.focus();
-		});
-}
-
-function split( val ) {
-  return val.split( /,\s*/ );
-}
-
-function getSuggestedValues( _this, suggestedField, btnId, optionId )
-{
-	clearListById(optionId);
-	var field = jQuery( '#' + suggestedField );
-	var option =  jQuery("#" + _this.id + " option:selected" );
-	if( option.attr('optionset') != "" ){
-		attributeAutocompletedField( suggestedField, option.attr('optionset'), btnId, optionId );
-		enable(suggestedField);
-		jQuery( '#' + btnId ).css("display", "");
-	}
-	else{
-		disable(suggestedField);
-		jQuery( '#' + btnId ).css("display", "none");
-	}
-}
-
-function removeOption( elementId )
-{
-	jQuery('#' + elementId + ' option:selected').remove();
+function attributeAutocompletedField(idField, optionSetUid, btnId, optionId) {
+  $("#" + btnId).unbind('click');
+  enable(btnId);
+  var input = jQuery("#" + idField);
+  var select = jQuery("#attributeId");
+  input.autocomplete({
+    delay: 0,
+    minLength: 0,
+    source: function(request, response) {
+      $.ajax({
+        url: "getOptions.action?id=" + optionSetUid + "&query=" + input.val(),
+        dataType: "json",
+        success: function(data) {
+          response($.map(data.options, function(item) {
+            return {
+              label: item.n,
+              id: item.c
+            };
+          }));
+        }
+      });
+    },
+    select: function(event, ui) {
+      input.val(ui.item.label);
+      jQuery("#" + optionId).append("<option value='" + ui.item.id + "'>" + ui.item.label + "</option>");
+      input.autocomplete("close");
+
+      return false;
+    },
+    change: function(event, ui) {
+      if( !ui.item ) {
+        var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex($(this).val()) + "$", "i"),
+        valid = false;
+        select.children("option").each(function() {
+          if( $(this).text().match(matcher) ) {
+            this.selected = valid = true;
+            return false;
+          }
+        });
+        if( !valid ) {
+          // remove invalid value, as it didn't match anything
+          $(this).val("");
+          select.val("");
+          input.data("uiAutocomplete").term = "";
+          return false;
+        }
+      }
+    }
+  }).addClass("ui-widget");
+
+  input.data("uiAutocomplete")._renderItem = function(ul, item) {
+    return $("<li></li>")
+      .data("item.autocomplete", item)
+      .append("<a>" + item.label + "</a>")
+      .appendTo(ul);
+  };
+
+  var wrapper = this.wrapper = $("<span style='width:200px'>")
+    .addClass("ui-combobox")
+    .insertAfter(input);
+
+  var button = $("#" + btnId)
+    .attr("tabIndex", -1)
+    .attr("title", i18n_show_all_items)
+    .appendTo(wrapper)
+    .button({
+      icons: {
+        primary: "ui-icon-triangle-1-s"
+      },
+      text: false
+    })
+    .click(function() {
+      // close if already visible
+      if( input.autocomplete("widget").is(":visible") ) {
+        input.autocomplete("close");
+        return;
+      }
+      // work around a bug (likely same cause as #5265)
+      $(this).blur();
+      // pass empty string as value to search for, displaying all results
+      input.autocomplete("search", "");
+      input.focus();
+    });
+}
+
+function split(val) {
+  return val.split(/,\s*/);
+}
+
+function getSuggestedValues(_this, suggestedField, btnId, optionId) {
+  clearListById(optionId);
+  var field = jQuery('#' + suggestedField);
+  var option = jQuery("#" + _this.id + " option:selected");
+  if( option.attr('optionset') != "" ) {
+    attributeAutocompletedField(suggestedField, option.attr('optionset'), btnId, optionId);
+    enable(suggestedField);
+    jQuery('#' + btnId).css("display", "");
+  }
+  else {
+    disable(suggestedField);
+    jQuery('#' + btnId).css("display", "none");
+  }
+}
+
+function removeOption(elementId) {
+  jQuery('#' + elementId + ' option:selected').remove();
 }

=== 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-08-02 12:27:56 +0000
+++ 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
@@ -79,27 +79,26 @@
 		</td>		
 		<td></td>				
 	</tr>
-	
-    <tr>
+      <tr>
         <td><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
         <td>
-            <select id="valueType" name="valueType" onchange="typeOnChange();">
-                <option value="number" #if( $attribute.valueType == 'number' ) selected="selected" #end>$i18n.getString( "number" )</option>
-                <option value="string" #if( $attribute.valueType == 'string' ) selected="selected" #end>$i18n.getString( "text" )</option>
-                <option value="letter" #if( $attribute.valueType == 'letter' ) selected="selected" #end>$i18n.getString( "letter_only" )</option>
-				<option value="bool" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'bool' ) selected="selected" #end>$i18n.getString( "yes_no" )</option>
-                <option value="trueOnly" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'trueOnly' ) selected="selected" #end >$i18n.getString( "yes_only" )</option>
-                <option value="date" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'date' ) selected="selected" #end>$i18n.getString( "date" )</option>
-                <option value="phoneNumber" #if( $attribute.valueType == 'phoneNumber' ) selected="selected" #end>$i18n.getString( "phone_number" )</option>
-                <option value="email" #if( $attribute.valueType == 'email' ) selected="selected" #end>$i18n.getString( "email" )</option>
-                <option value="trackerAssociate" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'trackerAssociate' ) selected="selected" #end>$i18n.getString( "tracker_associate" )</option>
-                <option value="users" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'users' ) selected="selected" #end>$i18n.getString( "users" )</option>
-                <option value="optionSet" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'optionSet' ) selected="selected" #end>$i18n.getString( "option_set" )</option>
-            </select>
+          <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="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>
+            <option value="DATE" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'DATE' ) selected="selected" #end>$i18n.getString( "date" )</option>
+            <option value="PHONE_NUMBER" #if( $attribute.valueType == 'PHONE_NUMBER' ) selected="selected" #end>$i18n.getString( "phone_number" )</option>
+            <option value="EMAIL" #if( $attribute.valueType == 'EMAIL' ) selected="selected" #end>$i18n.getString( "email" )</option>
+            <option value="TRACKER_ASSOCIATE" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'TRACKER_ASSOCIATE' ) selected="selected" #end>$i18n.getString( "tracker_associate" )</option>
+            <option value="USERNAME" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'USERNAME' ) selected="selected" #end>$i18n.getString( "users" )</option>
+            <option value="OPTION_SET" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'OPTION_SET' ) selected="selected" #end>$i18n.getString( "option_set" )</option>
+          </select>
         </td>
-    </tr>
+      </tr>
 
-    <tr>
+      <tr>
         <td><label for="aggregationType">$i18n.getString( "aggregation_type" )</label></td>
         <td>
             <select id="aggregationType" name="aggregationType">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramIndicator.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramIndicator.vm	2015-08-28 10:23:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramIndicator.vm	2015-09-03 08:15:09 +0000
@@ -65,17 +65,17 @@
 	<tr>
         <td><label for="aggregationType">$i18n.getString( "aggregation_type" )</label></td>
         <td>
-            <select id="aggregationType" name="aggregationType">
-                <option value="AVERAGE"#if( $programIndicator.aggregationType == 'AVERAGE' ) selected="selected"#end>$i18n.getString( "average" )</option>
-                <option value="SUM"#if( $programIndicator.aggregationType == 'SUM' ) selected="selected"#end>$i18n.getString( "sum" )</option>
-                <option value="COUNT"#if( $programIndicator.aggregationType == 'COUNT' ) selected="selected"#end>$i18n.getString( "count" )</option>
-                <option value="STDDEV"#if( $programIndicator.aggregationType == 'STDDEV' ) selected="selected"#end>$i18n.getString( "stddev" )</option>
-                <option value="VARIANCE"#if( $programIndicator.aggregationType == 'VARIANCE' ) selected="selected"#end>$i18n.getString( "variance" )</option>
-                <option value="MIN"#if( $programIndicator.aggregationType == 'MIN' ) selected="selected"#end>$i18n.getString( "min" )</option>
-                <option value="MAX"#if( $programIndicator.aggregationType == 'MAX' ) selected="selected"#end>$i18n.getString( "max" )</option>
-	            <option value="CUSTOM"#if( $programIndicator.aggregationType == 'CUSTOM' ) selected="selected"#end>$i18n.getString( "custom" )</option>
-            </select>
-        </td>
+          <select id="aggregationType" name="aggregationType">
+            <option value="AVERAGE"#if( $programIndicator.aggregationType == 'AVERAGE' ) selected="selected"#end>$i18n.getString( "average" )</option>
+            <option value="SUM"#if( $programIndicator.aggregationType == 'SUM' ) selected="selected"#end>$i18n.getString( "sum" )</option>
+            <option value="COUNT"#if( $programIndicator.aggregationType == 'COUNT' ) selected="selected"#end>$i18n.getString( "count" )</option>
+            <option value="STDDEV"#if( $programIndicator.aggregationType == 'STDDEV' ) selected="selected"#end>$i18n.getString( "stddev" )</option>
+            <option value="VARIANCE"#if( $programIndicator.aggregationType == 'VARIANCE' ) selected="selected"#end>$i18n.getString( "variance" )</option>
+            <option value="MIN"#if( $programIndicator.aggregationType == 'MIN' ) selected="selected"#end>$i18n.getString( "min" )</option>
+            <option value="MAX"#if( $programIndicator.aggregationType == 'MAX' ) selected="selected"#end>$i18n.getString( "max" )</option>
+            <option value="CUSTOM"#if( $programIndicator.aggregationType == 'CUSTOM' ) selected="selected"#end>$i18n.getString( "custom" )</option>
+          </select>
+				</td>
     </tr>    
     <tr>
     	<td><label for="eventOutputType">$i18n.getString( "event_output_type" )</label></td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateValidationCriteria.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateValidationCriteria.vm	2015-04-16 07:08:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateValidationCriteria.vm	2015-09-03 08:15:09 +0000
@@ -28,7 +28,7 @@
 								<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
 								#set($attribute = '')
 								#foreach($programAttribute in $program.programAttributes)
-									#if( $programAttribute.attribute.valueType!='trackerAssociate')
+									#if( $programAttribute.attribute.valueType!='TRACKER_ASSOCIATE')
 										set($opt="")
 										#foreach($option in $programAttribute.attribute.optionSet.options)
 											#set($opt=$opt + ';' + $option.code + ':' + $option.name )