← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14810: Display attribute values which has displayInList property active; Remove Age value type of tracke...

 

------------------------------------------------------------
revno: 14810
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-04-12 20:12:30 +0800
message:
  Display attribute values which has displayInList property active; Remove Age value type of tracked entity attribute.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/AddRepresentativeAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/AddTrackedEntityInstanceAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/GetTrackedEntityInstanceAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SaveAttributeAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/UpdateTrackedEntityInstanceAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ValidateTrackedEntityInstanceAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramAttributes.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java	2014-03-26 21:55:22 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java	2014-04-12 12:12:30 +0000
@@ -28,9 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Calendar;
-import java.util.Date;
-
 import org.hisp.dhis.common.BaseDimensionalObject;
 import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.DxfNamespaces;
@@ -79,8 +76,6 @@
 
     public static final String TYPE_USERS = "users";
 
-    public static final String TYPE_AGE = "age";
-
     public static final String VALUE_TYPE_LOCAL_ID = "localId";
 
     private String description;
@@ -334,47 +329,7 @@
     // -------------------------------------------------------------------------
     // Static methods
     // -------------------------------------------------------------------------
-
-    public static Date getDateFromAge( int age )
-    {
-        Calendar todayCalendar = Calendar.getInstance();
-        todayCalendar.clear( Calendar.MILLISECOND );
-        todayCalendar.clear( Calendar.SECOND );
-        todayCalendar.clear( Calendar.MINUTE );
-        todayCalendar.set( Calendar.HOUR_OF_DAY, 0 );
-
-        todayCalendar.add( Calendar.YEAR, -1 * age );
-
-        return todayCalendar.getTime();
-    }
-
-    public static int getAgeFromDate( Date date )
-    {
-        if ( date == null )
-        {
-            return -1;
-        }
-
-        Calendar birthCalendar = Calendar.getInstance();
-        birthCalendar.setTime( date );
-
-        Calendar todayCalendar = Calendar.getInstance();
-
-        int age = todayCalendar.get( Calendar.YEAR ) - birthCalendar.get( Calendar.YEAR );
-
-        if ( todayCalendar.get( Calendar.MONTH ) < birthCalendar.get( Calendar.MONTH ) )
-        {
-            age--;
-        }
-        else if ( todayCalendar.get( Calendar.MONTH ) == birthCalendar.get( Calendar.MONTH )
-            && todayCalendar.get( Calendar.DAY_OF_MONTH ) < birthCalendar.get( Calendar.DAY_OF_MONTH ) )
-        {
-            age--;
-        }
-
-        return age;
-    }
-
+    
     @Override
     public void mergeWith( IdentifiableObject other )
     {

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2014-03-28 11:28:37 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2014-04-12 12:12:30 +0000
@@ -279,7 +279,6 @@
 
     public List<Grid> getProgramInstanceReport( TrackedEntityInstance instance, I18n i18n )
     {
-        I18nFormat format = i18nManager.getI18nFormat();
         
         List<Grid> grids = new ArrayList<Grid>();
 
@@ -317,14 +316,6 @@
                 attrGrid.addRow();
                 attrGrid.addValue( attributeValue.getAttribute().getDisplayName() );
                 String value = attributeValue.getValue();
-
-                if ( attributeValue.getAttribute().getValueType().equals( TrackedEntityAttribute.TYPE_AGE )
-                    && value != null )
-                {
-                    Date date = format.parseDate( value );
-                    value = TrackedEntityAttribute.getAgeFromDate( date ) + "";
-                }
-
                 attrGrid.addValue( value );
             }
 

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java	2014-04-12 04:55:36 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java	2014-04-12 12:12:30 +0000
@@ -30,7 +30,10 @@
 
 import static org.hisp.dhis.common.IdentifiableObjectUtils.getIdentifiers;
 import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString;
-import static org.hisp.dhis.system.util.TextUtils.*;
+import static org.hisp.dhis.system.util.TextUtils.getTokens;
+import static org.hisp.dhis.system.util.TextUtils.removeLastAnd;
+import static org.hisp.dhis.system.util.TextUtils.removeLastComma;
+import static org.hisp.dhis.system.util.TextUtils.removeLastOr;
 import static org.hisp.dhis.trackedentity.TrackedEntityInstance.PREFIX_PROGRAM;
 import static org.hisp.dhis.trackedentity.TrackedEntityInstance.PREFIX_PROGRAM_EVENT_BY_STATUS;
 import static org.hisp.dhis.trackedentity.TrackedEntityInstance.PREFIX_PROGRAM_INSTANCE;
@@ -527,7 +530,8 @@
 
                 if ( rs != null && rs.intValue() > 0 )
                 {
-                    return TrackedEntityInstanceService.ERROR_DUPLICATE_IDENTIFIER + TrackedEntityInstanceService.SAPERATOR + rs.intValue();
+                    return TrackedEntityInstanceService.ERROR_DUPLICATE_IDENTIFIER
+                        + TrackedEntityInstanceService.SAPERATOR + rs.intValue();
                 }
             }
         }
@@ -559,49 +563,40 @@
                     {
                         value = attributeValue.getValue();
 
-                        if ( attributeValue.getAttribute().getValueType().equals( TrackedEntityAttribute.TYPE_AGE ) )
-                        {
-                            value = TrackedEntityAttribute.getAgeFromDate( format.parseDate( value ) ) + "";
-                        }
-
-                        if ( !value.isEmpty() )
-                        {
-                            String type = attributeValue.getAttribute().getValueType();
-                            // For integer type
-                            if ( type.equals( TrackedEntityAttribute.TYPE_AGE )
-                                || type.equals( TrackedEntityAttribute.TYPE_INT ) )
-                            {
-                                int value1 = Integer.parseInt( value );
-                                int value2 = Integer.parseInt( criteria.getValue() );
-
-                                if ( (criteria.getOperator() == ValidationCriteria.OPERATOR_LESS_THAN && value1 >= value2)
-                                    || (criteria.getOperator() == ValidationCriteria.OPERATOR_EQUAL_TO && value1 != value2)
-                                    || (criteria.getOperator() == ValidationCriteria.OPERATOR_GREATER_THAN && value1 <= value2) )
-                                {
-                                    return criteria;
-                                }
-                            }
-                            // For Date type
-                            else if ( type.equals( TrackedEntityAttribute.TYPE_DATE ) )
-                            {
-                                Date value1 = format.parseDate( value );
-                                Date value2 = format.parseDate( criteria.getValue() );
-                                int i = value1.compareTo( value2 );
-                                if ( i != criteria.getOperator() )
-                                {
-                                    return criteria;
-                                }
-                            }
-                            // For other types
-                            else
-                            {
-                                if ( criteria.getOperator() == ValidationCriteria.OPERATOR_EQUAL_TO
-                                    && !value.equals( criteria.getValue() ) )
-                                {
-                                    return criteria;
-                                }
-
-                            }
+                        String type = attributeValue.getAttribute().getValueType();
+                        // For integer type
+                        if ( type.equals( TrackedEntityAttribute.TYPE_INT ) )
+                        {
+                            int value1 = Integer.parseInt( value );
+                            int value2 = Integer.parseInt( criteria.getValue() );
+
+                            if ( (criteria.getOperator() == ValidationCriteria.OPERATOR_LESS_THAN && value1 >= value2)
+                                || (criteria.getOperator() == ValidationCriteria.OPERATOR_EQUAL_TO && value1 != value2)
+                                || (criteria.getOperator() == ValidationCriteria.OPERATOR_GREATER_THAN && value1 <= value2) )
+                            {
+                                return criteria;
+                            }
+                        }
+                        // For Date type
+                        else if ( type.equals( TrackedEntityAttribute.TYPE_DATE ) )
+                        {
+                            Date value1 = format.parseDate( value );
+                            Date value2 = format.parseDate( criteria.getValue() );
+                            int i = value1.compareTo( value2 );
+                            if ( i != criteria.getOperator() )
+                            {
+                                return criteria;
+                            }
+                        }
+                        // For other types
+                        else
+                        {
+                            if ( criteria.getOperator() == ValidationCriteria.OPERATOR_EQUAL_TO
+                                && !value.equals( criteria.getValue() ) )
+                            {
+                                return criteria;
+                            }
+
                         }
 
                     }

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java	2014-04-04 17:58:28 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java	2014-04-12 12:12:30 +0000
@@ -291,7 +291,7 @@
         
         executeSql( "update trackedentityattribute set valuetype='string' where valuetype='combo' and  optionsetid is null" );
 
-        executeSql( "UPDATE trackedentityattribute SET valuetype='string' WHERE valuetype='localId';" );
+        executeSql( "UPDATE trackedentityattribute SET valuetype='number' WHERE valuetype='age'" );
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/AddRepresentativeAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/AddRepresentativeAction.java	2014-03-19 06:44:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/AddRepresentativeAction.java	2014-04-12 12:12:30 +0000
@@ -36,7 +36,6 @@
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.struts2.ServletActionContext;
-import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
@@ -62,8 +61,6 @@
 
     private TrackedEntityAttributeService attributeService;
 
-    private I18nFormat format;
-
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -116,18 +113,13 @@
                     attributeValue.setEntityInstance( entityInstance );
                     attributeValue.setAttribute( attribute );
                     attributeValue.setValue( value.trim() );
-
-                    if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_AGE ) )
-                    {
-                        value = format.formatDate( TrackedEntityAttribute.getDateFromAge( Integer.parseInt( value ) ) );
-                    }
-                    
                     entityInstanceAttributeValues.add( attributeValue );
                 }
             }
         }
 
-        entityInstanceService.createTrackedEntityInstance( entityInstance, null, relationshipTypeId, entityInstanceAttributeValues );
+        entityInstanceService.createTrackedEntityInstance( entityInstance, null, relationshipTypeId,
+            entityInstanceAttributeValues );
 
         return SUCCESS;
 
@@ -147,11 +139,6 @@
         this.attributeService = attributeService;
     }
 
-    public void setFormat( I18nFormat format )
-    {
-        this.format = format;
-    }
-
     public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
     {
         this.selectionManager = selectionManager;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/AddTrackedEntityInstanceAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/AddTrackedEntityInstanceAction.java	2014-04-11 09:56:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/AddTrackedEntityInstanceAction.java	2014-04-12 12:12:30 +0000
@@ -36,7 +36,6 @@
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.struts2.ServletActionContext;
-import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 import org.hisp.dhis.program.Program;
@@ -89,8 +88,6 @@
     @Autowired
     private TrackedEntityAttributeValueService attributeValueService;
 
-    private I18nFormat format;
-
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -162,11 +159,6 @@
                     attributeValue.setEntityInstance( entityInstance );
                     attributeValue.setAttribute( attribute );
 
-                    if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_AGE ) )
-                    {
-                        value = format.formatDate( TrackedEntityAttribute.getDateFromAge( Integer.parseInt( value ) ) );
-                    }
-                    
                     attributeValue.setValue( value.trim() );
                     attributeValues.add( attributeValue );
                 }
@@ -272,11 +264,6 @@
         this.entityInstanceService = entityInstanceService;
     }
 
-    public void setFormat( I18nFormat format )
-    {
-        this.format = format;
-    }
-
     public void setAttributeService( TrackedEntityAttributeService attributeService )
     {
         this.attributeService = attributeService;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/GetTrackedEntityInstanceAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/GetTrackedEntityInstanceAction.java	2014-04-11 09:56:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/GetTrackedEntityInstanceAction.java	2014-04-12 12:12:30 +0000
@@ -31,7 +31,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -380,13 +379,6 @@
         for ( TrackedEntityAttributeValue attributeValue : attributeValues )
         {
             String value = attributeValue.getValue();
-
-            if ( attributeValue.getAttribute().getValueType().equals( TrackedEntityAttribute.TYPE_AGE ) )
-            {
-                Date date = format.parseDate( value );
-                value = TrackedEntityAttribute.getAgeFromDate( date ) + "";
-            }
-
             attributeValueMap.put( attributeValue.getAttribute().getId(), value );
         }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentAction.java	2014-04-06 15:57:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentAction.java	2014-04-12 12:12:30 +0000
@@ -31,13 +31,11 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 
-import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
@@ -67,8 +65,6 @@
 
     private OrganisationUnitSelectionManager selectionManager;
 
-    private I18nFormat format;
-
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -100,11 +96,6 @@
         this.selectionManager = selectionManager;
     }
 
-    public void setFormat( I18nFormat format )
-    {
-        this.format = format;
-    }
-
     public Collection<TrackedEntityAttribute> getNoGroupAttributes()
     {
         return noGroupAttributes;
@@ -200,15 +191,7 @@
 
             for ( TrackedEntityAttributeValue attributeValue : attributeValues )
             {
-                
-                    String value = attributeValue.getValue();
-                    if ( attributeValue.getAttribute().getValueType().equals( TrackedEntityAttribute.TYPE_AGE ) )
-                    {
-                        Date date = format.parseDate( value );
-                        value = TrackedEntityAttribute.getAgeFromDate( date ) + "";
-                    }
-
-                    attributeValueMap.put( attributeValue.getAttribute().getId(), value );
+                attributeValueMap.put( attributeValue.getAttribute().getId(), attributeValue.getValue() );
             }
         }
     }
@@ -216,7 +199,7 @@
     private boolean showDataEntry( OrganisationUnit orgunit, Program program, ProgramInstance programInstance )
     {
         Collection<OrganisationUnit> orgunits = new HashSet<OrganisationUnit>();
-        
+
         if ( program.getOrganisationUnitGroups().size() > 0 )
         {
             for ( OrganisationUnitGroup orgunitGroup : program.getOrganisationUnitGroups() )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SaveAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SaveAttributeAction.java	2014-04-06 15:48:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SaveAttributeAction.java	2014-04-12 12:12:30 +0000
@@ -34,7 +34,6 @@
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.struts2.ServletActionContext;
-import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
@@ -66,8 +65,6 @@
 
     private ProgramService programService;
 
-    private I18nFormat format;
-
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -126,12 +123,7 @@
     {
         return statusCode;
     }
-
-    public void setFormat( I18nFormat format )
-    {
-        this.format = format;
-    }
-
+    
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -173,11 +165,6 @@
 
                 if ( StringUtils.isNotBlank( value ) )
                 {
-                    if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_AGE ) )
-                    {
-                        value = format.formatDate( TrackedEntityAttribute.getDateFromAge( Integer.parseInt( value ) ) );
-                    }
-
                     if ( attributeValue == null )
                     {
                         attributeValue = new TrackedEntityAttributeValue();

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java	2014-04-11 10:32:07 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java	2014-04-12 12:12:30 +0000
@@ -31,7 +31,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -299,16 +298,8 @@
             {
                 if ( attributeValue.getAttribute().getInherit() )
                 {
-                    String value = attributeValue.getValue();
-
-                    if ( attributeValue.getAttribute().getValueType().equals( TrackedEntityAttribute.TYPE_AGE )
-                        && value != null )
-                    {
-                        Date date = format.parseDate( value );
-                        value = TrackedEntityAttribute.getAgeFromDate( date ) + "";
-                    }
-
-                    trackedEntityAttributeValueMap.put( attributeValue.getAttribute().getId(), value );
+                    trackedEntityAttributeValueMap.put( attributeValue.getAttribute().getId(),
+                        attributeValue.getValue() );
                 }
             }
         }
@@ -352,14 +343,15 @@
 
             if ( program == null )
             {
-                attributes = new ArrayList<TrackedEntityAttribute>( attributeService.getTrackedEntityAttributesDisplayInList( true ) );
+                attributes = new ArrayList<TrackedEntityAttribute>(
+                    attributeService.getTrackedEntityAttributesDisplayInList( true ) );
                 Collection<Program> programs = programService.getAllPrograms();
 
                 for ( Program p : programs )
                 {
                     attributes.removeAll( p.getAttributes() );
                 }
-                
+
                 for ( TrackedEntityAttribute attribute : attributes )
                 {
                     mandatoryMap.put( attribute.getId(), false );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java	2014-04-11 09:56:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java	2014-04-12 12:12:30 +0000
@@ -35,7 +35,6 @@
 import java.util.HashSet;
 import java.util.Map;
 
-import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramIndicatorService;
@@ -43,10 +42,10 @@
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.relationship.Relationship;
 import org.hisp.dhis.relationship.RelationshipService;
-import org.hisp.dhis.trackedentity.TrackedEntityInstance;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 import org.hisp.dhis.trackedentity.TrackedEntityAudit;
 import org.hisp.dhis.trackedentity.TrackedEntityAuditService;
+import org.hisp.dhis.trackedentity.TrackedEntityInstance;
 import org.hisp.dhis.trackedentity.TrackedEntityInstanceService;
 import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue;
 import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueService;
@@ -102,17 +101,10 @@
 
     private Map<String, String> programIndicatorsMap = new HashMap<String, String>();
 
-    private I18nFormat format;
-
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
-    public void setFormat( I18nFormat format )
-    {
-        this.format = format;
-    }
-
     public Map<String, String> getProgramIndicatorsMap()
     {
         return programIndicatorsMap;
@@ -225,18 +217,7 @@
 
         for ( TrackedEntityAttributeValue attributeValue : _attributeValues )
         {
-            String value = attributeValue.getValue();
-            if ( attributeValue.getAttribute().getValueType().equals( TrackedEntityAttribute.TYPE_AGE ) )
-            {
-                Date date = format.parseDate( value );
-                value = TrackedEntityAttribute.getAgeFromDate( date ) + "";
-            }
-            
-            TrackedEntityAttributeValue av = new TrackedEntityAttributeValue();
-            av.setEntityInstance( entityInstance );
-            av.setAttribute( attributeValue.getAttribute() );
-            av.setValue( value );
-            attributeValues.add( av );
+            attributeValues.add( attributeValue );
         }
 
         // ---------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/UpdateTrackedEntityInstanceAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/UpdateTrackedEntityInstanceAction.java	2014-04-11 09:56:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/UpdateTrackedEntityInstanceAction.java	2014-04-12 12:12:30 +0000
@@ -36,7 +36,6 @@
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.struts2.ServletActionContext;
-import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.trackedentity.TrackedEntity;
@@ -55,173 +54,172 @@
  * @author Abyot Asalefew Gizaw
  * @version $Id$
  */
-public class UpdateTrackedEntityInstanceAction implements Action {
-	// -------------------------------------------------------------------------
-	// Dependencies
-	// -------------------------------------------------------------------------
-
-	private TrackedEntityInstanceService entityInstanceService;
-
-	private TrackedEntityAttributeService attributeService;
-
-	private TrackedEntityAttributeValueService attributeValueService;
-
-	@Autowired
-	private TrackedEntityService trackedEntityService;
-
-	@Autowired
-	private ProgramService programService;
-
-	private I18nFormat format;
-
-	// -------------------------------------------------------------------------
-	// Input
-	// -------------------------------------------------------------------------
-
-	private Integer id;
-
-	private Integer representativeId;
-
-	private Integer relationshipTypeId;
-
-	private Integer trackedEntityId;
-
-	private String programId;
-
-	// -------------------------------------------------------------------------
-	// Output
-	// -------------------------------------------------------------------------
-
-	private TrackedEntityInstance entityInstance;
-
-	// -------------------------------------------------------------------------
-	// Action implementation
-	// -------------------------------------------------------------------------
-
-	public String execute() throws Exception {
-		TrackedEntityInstance entityInstance = entityInstanceService
-				.getTrackedEntityInstance(id);
-		TrackedEntity trackedEntity = null;
-
-		if ( programId != null && !programId.isEmpty() ) {
-			Program program = programService.getProgram(programId);
-			trackedEntity = program.getTrackedEntity();
-		} else {
-			trackedEntity = trackedEntityService
-					.getTrackedEntity(trackedEntityId);
-		}
-
-		entityInstance.setTrackedEntity(trackedEntity);
-
-		// ---------------------------------------------------------------------
-		// Save Tracked Entity Instance Attributes
-		// ---------------------------------------------------------------------
-
-		HttpServletRequest request = ServletActionContext.getRequest();
-
-		Collection<TrackedEntityAttribute> attributes = attributeService
-				.getAllTrackedEntityAttributes();
-
-		List<TrackedEntityAttributeValue> valuesForSave = new ArrayList<TrackedEntityAttributeValue>();
-		List<TrackedEntityAttributeValue> valuesForUpdate = new ArrayList<TrackedEntityAttributeValue>();
-		Collection<TrackedEntityAttributeValue> valuesForDelete = null;
-
-		TrackedEntityAttributeValue attributeValue = null;
-
-		if (attributes != null && attributes.size() > 0) {
-			valuesForDelete = attributeValueService
-					.getTrackedEntityAttributeValues(entityInstance);
-
-			for (TrackedEntityAttribute attribute : attributes) {
-				String value = request
-						.getParameter(AddTrackedEntityInstanceAction.PREFIX_ATTRIBUTE
-								+ attribute.getId());
-
-				if (StringUtils.isNotBlank(value)) {
-					if (attribute.getValueType().equals(
-							TrackedEntityAttribute.TYPE_AGE)) {
-						value = format.formatDate(TrackedEntityAttribute
-								.getDateFromAge(Integer.parseInt(value)));
-					}
-
-					attributeValue = attributeValueService
-							.getTrackedEntityAttributeValue(entityInstance,
-									attribute);
-
-					if (attributeValue == null) {
-						attributeValue = new TrackedEntityAttributeValue();
-						attributeValue.setEntityInstance(entityInstance);
-						attributeValue.setAttribute(attribute);
-						attributeValue.setValue(value.trim());
-
-						valuesForSave.add(attributeValue);
-					} else {
-						attributeValue.setValue(value.trim());
-
-						valuesForUpdate.add(attributeValue);
-						valuesForDelete.remove(attributeValue);
-					}
-				}
-			}
-		}
-
-		entityInstanceService.updateTrackedEntityInstance(entityInstance,
-				representativeId, relationshipTypeId, valuesForSave,
-				valuesForUpdate, valuesForDelete);
-
-		return SUCCESS;
-	}
-
-	// -------------------------------------------------------------------------
-	// Getter/Setter
-	// -------------------------------------------------------------------------
-
-	public void setFormat(I18nFormat format) {
-		this.format = format;
-	}
-
-	public void setTrackedEntityId(Integer trackedEntityId) {
-		this.trackedEntityId = trackedEntityId;
-	}
-
-	public void setTrackedEntityService(
-			TrackedEntityService trackedEntityService) {
-		this.trackedEntityService = trackedEntityService;
-	}
-
-	public void setentityInstanceService(
-			TrackedEntityInstanceService entityInstanceService) {
-		this.entityInstanceService = entityInstanceService;
-	}
-
-	public void setattributeService(
-			TrackedEntityAttributeService attributeService) {
-		this.attributeService = attributeService;
-	}
-
-	public void setattributeValueService(
-			TrackedEntityAttributeValueService attributeValueService) {
-		this.attributeValueService = attributeValueService;
-	}
-
-	public void setId(Integer id) {
-		this.id = id;
-	}
-
-	public TrackedEntityInstance getEntityInstance() {
-		return entityInstance;
-	}
-
-	public void setRepresentativeId(Integer representativeId) {
-		this.representativeId = representativeId;
-	}
-
-	public void setRelationshipTypeId(Integer relationshipTypeId) {
-		this.relationshipTypeId = relationshipTypeId;
-	}
-
-	public void setProgramId(String programId) {
-		this.programId = programId;
-	}
+public class UpdateTrackedEntityInstanceAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private TrackedEntityInstanceService entityInstanceService;
+
+    private TrackedEntityAttributeService attributeService;
+
+    private TrackedEntityAttributeValueService attributeValueService;
+
+    @Autowired
+    private TrackedEntityService trackedEntityService;
+
+    @Autowired
+    private ProgramService programService;
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    private Integer representativeId;
+
+    private Integer relationshipTypeId;
+
+    private Integer trackedEntityId;
+
+    private String programId;
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private TrackedEntityInstance entityInstance;
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        TrackedEntityInstance entityInstance = entityInstanceService.getTrackedEntityInstance( id );
+        TrackedEntity trackedEntity = null;
+
+        if ( programId != null && !programId.isEmpty() )
+        {
+            Program program = programService.getProgram( programId );
+            trackedEntity = program.getTrackedEntity();
+        }
+        else
+        {
+            trackedEntity = trackedEntityService.getTrackedEntity( trackedEntityId );
+        }
+
+        entityInstance.setTrackedEntity( trackedEntity );
+
+        // ---------------------------------------------------------------------
+        // Save Tracked Entity Instance Attributes
+        // ---------------------------------------------------------------------
+
+        HttpServletRequest request = ServletActionContext.getRequest();
+
+        Collection<TrackedEntityAttribute> attributes = attributeService.getAllTrackedEntityAttributes();
+
+        List<TrackedEntityAttributeValue> valuesForSave = new ArrayList<TrackedEntityAttributeValue>();
+        List<TrackedEntityAttributeValue> valuesForUpdate = new ArrayList<TrackedEntityAttributeValue>();
+        Collection<TrackedEntityAttributeValue> valuesForDelete = null;
+
+        TrackedEntityAttributeValue attributeValue = null;
+
+        if ( attributes != null && attributes.size() > 0 )
+        {
+            valuesForDelete = attributeValueService.getTrackedEntityAttributeValues( entityInstance );
+
+            for ( TrackedEntityAttribute attribute : attributes )
+            {
+                String value = request.getParameter( AddTrackedEntityInstanceAction.PREFIX_ATTRIBUTE
+                    + attribute.getId() );
+
+                if ( StringUtils.isNotBlank( value ) )
+                {
+                    attributeValue = attributeValueService.getTrackedEntityAttributeValue( entityInstance, attribute );
+
+                    if ( attributeValue == null )
+                    {
+                        attributeValue = new TrackedEntityAttributeValue();
+                        attributeValue.setEntityInstance( entityInstance );
+                        attributeValue.setAttribute( attribute );
+                        attributeValue.setValue( value.trim() );
+
+                        valuesForSave.add( attributeValue );
+                    }
+                    else
+                    {
+                        attributeValue.setValue( value.trim() );
+
+                        valuesForUpdate.add( attributeValue );
+                        valuesForDelete.remove( attributeValue );
+                    }
+                }
+            }
+        }
+
+        entityInstanceService.updateTrackedEntityInstance( entityInstance, representativeId, relationshipTypeId,
+            valuesForSave, valuesForUpdate, valuesForDelete );
+
+        return SUCCESS;
+    }
+
+    // -------------------------------------------------------------------------
+    // Getter/Setter
+    // -------------------------------------------------------------------------
+
+    public void setTrackedEntityId( Integer trackedEntityId )
+    {
+        this.trackedEntityId = trackedEntityId;
+    }
+
+    public void setTrackedEntityService( TrackedEntityService trackedEntityService )
+    {
+        this.trackedEntityService = trackedEntityService;
+    }
+
+    public void setentityInstanceService( TrackedEntityInstanceService entityInstanceService )
+    {
+        this.entityInstanceService = entityInstanceService;
+    }
+
+    public void setattributeService( TrackedEntityAttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    public void setattributeValueService( TrackedEntityAttributeValueService attributeValueService )
+    {
+        this.attributeValueService = attributeValueService;
+    }
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    public TrackedEntityInstance getEntityInstance()
+    {
+        return entityInstance;
+    }
+
+    public void setRepresentativeId( Integer representativeId )
+    {
+        this.representativeId = representativeId;
+    }
+
+    public void setRelationshipTypeId( Integer relationshipTypeId )
+    {
+        this.relationshipTypeId = relationshipTypeId;
+    }
+
+    public void setProgramId( String programId )
+    {
+        this.programId = programId;
+    }
 
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ValidateTrackedEntityInstanceAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ValidateTrackedEntityInstanceAction.java	2014-04-12 04:55:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ValidateTrackedEntityInstanceAction.java	2014-04-12 12:12:30 +0000
@@ -76,7 +76,7 @@
 
     @Autowired
     private TrackedEntityAttributeService patientAttributeService;
-    
+
     @Autowired
     private ValidationCriteriaService validationCriteriaService;
 
@@ -155,12 +155,6 @@
                     TrackedEntityAttributeValue attributeValue = new TrackedEntityAttributeValue();
                     attributeValue.setEntityInstance( entityInstance );
                     attributeValue.setAttribute( attribute );
-
-                    if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_AGE ) )
-                    {
-                        value = format.formatDate( TrackedEntityAttribute.getDateFromAge( Integer.parseInt( value ) ) );
-                    }
-
                     attributeValue.setValue( value );
                     attributeValues.add( attributeValue );
                 }
@@ -176,7 +170,7 @@
         String[] errorCode = entityInstanceService.validateTrackedEntityInstance( entityInstance, program, format )
             .split( "_" );
         int code = Integer.parseInt( errorCode[0] );
-        
+
         if ( code == TrackedEntityInstanceService.ERROR_DUPLICATE_IDENTIFIER )
         {
             message = i18n.getString( "duplicate_value_of" ) + " "

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramAttributes.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramAttributes.vm	2014-04-12 09:21:12 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramAttributes.vm	2014-04-12 12:12:30 +0000
@@ -1,3 +1,4 @@
+
 #set( $size = 0 )
 
 #if( $!attributes )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm	2014-04-04 17:58:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/report.vm	2014-04-12 12:12:30 +0000
@@ -24,9 +24,11 @@
                 <tr #alternate( $mark )>                
 					<td>
 						#set( $value="")
+						#set( $entityInstance = $programInstance.entityInstance )
 						#foreach( $programAttribute in $program.attributes)
 							#foreach( $attributeValue in $entityInstance.attributeValues)
-								#if($!attributeValue.attribute.id==$programAttribute.attribute.id)
+								#if($attributeValue.attribute.id==$programAttribute.attribute.id 
+									&& $programAttribute.displayInList=='true' )
 									#set( $value= $value + $attributeValue.value + '&#13;&#10;' )
 								#end
 							#end 

=== 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	2014-04-12 09:21:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm	2014-04-12 12:12:30 +0000
@@ -64,7 +64,6 @@
                 <option value="date">$i18n.getString( "date" )</option>
                 <option value="phoneNumber">$i18n.getString( "phone_number" )</option>
                 <option value="trackerAssociate">$i18n.getString( "tracker_associate" )</option>
-                <option value="age">$i18n.getString( "age" )</option>
                 <option value="users">$i18n.getString( "users" )</option>
                 <option value="combo">$i18n.getString( "attribute_combo_type" )</option>
 				<option value="localId">$i18n.getString( "local_identifier" )</option>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm	2014-04-12 09:21:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm	2014-04-12 12:12:30 +0000
@@ -60,7 +60,6 @@
 				<option value="date" #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="trackerAssociate" #if( $attribute.valueType == 'trackerAssociate' ) selected="selected" #end>$i18n.getString( "tracker_associate" )</option>
-				<option value="age" #if( $attribute.valueType == 'age' ) selected="selected" #end>$i18n.getString( "age" )</option>
 				<option value="users" #if( $attribute.valueType == 'users' ) selected="selected" #end>$i18n.getString( "users" )</option>
 				<option value="combo" #if( $attribute.valueType == 'combo' ) selected="selected" #end>$i18n.getString( "attribute_combo_type" )</option>
 				<option value="localId" #if( $attribute.valueType == 'localId' ) selected="selected" #end>$i18n.getString( "local_identifier" )</option>