← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21470: renamed TrackedEntityDataValue.timestamp => lastUpdated, also adds created. Exposes created/lastU...

 

------------------------------------------------------------
revno: 21470
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-12-16 13:46:52 +0100
message:
  renamed TrackedEntityDataValue.timestamp => lastUpdated, also adds created. Exposes created/lastUpdated in /api/events endpoint.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValue.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentitydatavalue/DefaultTrackedEntityDataValueService.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentitydatavalue/hibernate/TrackedEntityDataValue.hbm.xml
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/DataValue.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-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/PdfDataEntryFormImportUtil.java


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

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValue.java	2015-11-30 00:34:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValue.java	2015-12-16 12:46:52 +0000
@@ -52,7 +52,9 @@
 
     private ProgramStageInstance programStageInstance;
 
-    private Date timestamp;
+    private Date created = new Date();
+
+    private Date lastUpdated = new Date();
 
     private String value;
 
@@ -66,22 +68,26 @@
 
     public TrackedEntityDataValue()
     {
+
     }
 
     public TrackedEntityDataValue( ProgramStageInstance programStageInstance, DataElement dataElement, String value )
     {
         this.dataElement = dataElement;
         this.programStageInstance = programStageInstance;
-        this.timestamp = new Date();
         this.value = value;
     }
 
-    public TrackedEntityDataValue( ProgramStageInstance programStageInstance, DataElement dataElement, Date timeStamp, String value )
+    public void setAutoFields()
     {
-        this.programStageInstance = programStageInstance;
-        this.dataElement = dataElement;
-        this.timestamp = timeStamp;
-        this.value = value;
+        Date date = new Date();
+
+        if ( created == null )
+        {
+            created = date;
+        }
+
+        setLastUpdated( date );
     }
 
     // -------------------------------------------------------------------------
@@ -149,7 +155,7 @@
     public String toString()
     {
         return "TrackedEntityDataValue{" + "dataElement=" + dataElement + ", programStageInstance=" + programStageInstance
-            + ", timestamp=" + timestamp + ", value='" + value + '\'' + ", providedElsewhere=" + providedElsewhere
+            + ", lastUpdated=" + lastUpdated + ", value='" + value + '\'' + ", providedElsewhere=" + providedElsewhere
             + ", storedBy='" + storedBy + '\'' + '}';
     }
 
@@ -187,14 +193,24 @@
         return dataElement;
     }
 
-    public Date getTimestamp()
-    {
-        return timestamp;
-    }
-
-    public void setTimestamp( Date timestamp )
-    {
-        this.timestamp = timestamp;
+    public Date getCreated()
+    {
+        return created;
+    }
+
+    public void setCreated( Date created )
+    {
+        this.created = created;
+    }
+
+    public Date getLastUpdated()
+    {
+        return lastUpdated;
+    }
+
+    public void setLastUpdated( Date lastUpdated )
+    {
+        this.lastUpdated = lastUpdated;
     }
 
     public void setValue( String value )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java	2015-12-02 12:30:23 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/InitTableAlteror.java	2015-12-16 12:46:52 +0000
@@ -86,7 +86,7 @@
         updateValidationRuleEnums();
         updateProgramStatus();
         reEncryptConfigurationPasswords();
-        updateAuditTimestamps();
+        updateTimestamps();
 
         executeSql( "ALTER TABLE program ALTER COLUMN \"type\" TYPE varchar(255);" );
         executeSql( "update program set \"type\"='WITH_REGISTRATION' where type='1' or type='2'" );
@@ -113,7 +113,7 @@
                 executeSql( "UPDATE configuration SET smtppassword = '" + newPBEStringEncryptor.encrypt( oldPBEStringEncryptor.decrypt( smtpPassword ) ) + "'" );
                 executeSql( "ALTER TABLE configuration DROP COLUMN smptpassword" );
             }
-            
+
             if ( StringUtils.isNotBlank( remoteServerPassword ) )
             {
                 executeSql( "UPDATE configuration SET remotepassword = '" + newPBEStringEncryptor.encrypt( oldPBEStringEncryptor.decrypt( remoteServerPassword ) ) + "'" );
@@ -126,10 +126,15 @@
         }
     }
 
-    private void updateAuditTimestamps()
+    private void updateTimestamps()
     {
         executeSql( "alter table datavalueaudit rename column timestamp to created" );
         executeSql( "alter table trackedentitydatavalueaudit rename column timestamp to created" );
+
+        executeSql( "update trackedentitydatavalue set created=timestamp where created is null" );
+        executeSql( "update trackedentitydatavalue set lastupdated=timestamp where lastupdated is null" );
+        executeSql( "alter table trackedentitydatavalue drop column timestamp" );
+
         executeSql( "alter table trackedentityattributevalueaudit rename column timestamp to created" );
     }
 
@@ -162,8 +167,7 @@
     private void updateFeatureTypes()
     {
         executeSql( "update organisationunit set featuretype='NONE' where featuretype='None'" );
-        executeSql(
-            "update organisationunit set featuretype='MULTI_POLYGON' where featuretype='MultiPolygon'" );
+        executeSql( "update organisationunit set featuretype='MULTI_POLYGON' where featuretype='MultiPolygon'" );
         executeSql( "update organisationunit set featuretype='POLYGON' where featuretype='Polygon'" );
         executeSql( "update organisationunit set featuretype='POINT' where featuretype='Point'" );
         executeSql( "update organisationunit set featuretype='SYMBOL' where featuretype='Symbol'" );
@@ -176,10 +180,8 @@
 
         executeSql( "update dataelement set aggregationtype='SUM' where aggregationtype='sum'" );
         executeSql( "update dataelement set aggregationtype='AVERAGE' where aggregationtype='avg'" );
-        executeSql(
-            "update dataelement set aggregationtype='AVERAGE_SUM_ORG_UNIT' where aggregationtype='avg_sum_org_unit'" );
-        executeSql(
-            "update dataelement set aggregationtype='AVERAGE_SUM_ORG_UNIT' where aggregationtype='average'" );
+        executeSql( "update dataelement set aggregationtype='AVERAGE_SUM_ORG_UNIT' where aggregationtype='avg_sum_org_unit'" );
+        executeSql( "update dataelement set aggregationtype='AVERAGE_SUM_ORG_UNIT' where aggregationtype='average'" );
         executeSql( "update dataelement set aggregationtype='COUNT' where aggregationtype='count'" );
         executeSql( "update dataelement set aggregationtype='STDDEV' where aggregationtype='stddev'" );
         executeSql( "update dataelement set aggregationtype='VARIANCE' where aggregationtype='variance'" );
@@ -207,7 +209,7 @@
         executeSql( "update dataelement set valuetype='UNIT_INTERVAL' where valuetype='int' and numbertype='unitInterval'" );
         executeSql( "update dataelement set valuetype='NUMBER' where valuetype='int' and numbertype is null" );
         executeSql( "alter table dataelement drop column numbertype" );
-        
+
         executeSql( "update dataelement set valuetype='TEXT' where valuetype='string' and texttype='text'" );
         executeSql( "update dataelement set valuetype='LONG_TEXT' where valuetype='string' and texttype='longText'" );
         executeSql( "update dataelement set valuetype='TEXT' where valuetype='string' and texttype is null" );
@@ -257,8 +259,8 @@
 
             String insertSql =
                 "insert into programstagedataelement(programstagedataelementid,programstageid,dataelementid,compulsory,allowprovidedelsewhere," +
-                "sort_order,displayinreports,programstagesectionid,allowfuturedate,section_sort_order) " + "select " + autoIncr + 
-                ",programstageid,dataelementid,compulsory,allowprovidedelsewhere,sort_order,displayinreports,programstagesectionid,allowfuturedate,section_sort_order from programstage_dataelements";
+                    "sort_order,displayinreports,programstagesectionid,allowfuturedate,section_sort_order) " + "select " + autoIncr +
+                    ",programstageid,dataelementid,compulsory,allowprovidedelsewhere,sort_order,displayinreports,programstagesectionid,allowfuturedate,section_sort_order from programstage_dataelements";
 
             executeSql( insertSql );
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentitydatavalue/DefaultTrackedEntityDataValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentitydatavalue/DefaultTrackedEntityDataValueService.java	2015-11-30 02:50:28 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentitydatavalue/DefaultTrackedEntityDataValueService.java	2015-12-16 12:46:52 +0000
@@ -66,37 +66,41 @@
     // -------------------------------------------------------------------------
 
     @Override
-    public void saveTrackedEntityDataValue( TrackedEntityDataValue dataValue )
+    public void saveTrackedEntityDataValue( TrackedEntityDataValue trackedEntityDataValue )
     {
-        if ( !StringUtils.isEmpty( dataValue.getValue() ) )
+        trackedEntityDataValue.setAutoFields();
+
+        if ( !StringUtils.isEmpty( trackedEntityDataValue.getValue() ) )
         {
-            if ( StringUtils.isEmpty( dataValue.getStoredBy() ) )
+            if ( StringUtils.isEmpty( trackedEntityDataValue.getStoredBy() ) )
             {
-                dataValue.setStoredBy( currentUserService.getCurrentUsername() );
+                trackedEntityDataValue.setStoredBy( currentUserService.getCurrentUsername() );
             }
 
-            dataValueStore.saveVoid( dataValue );
+            dataValueStore.saveVoid( trackedEntityDataValue );
         }
     }
 
     @Override
-    public void updateTrackedEntityDataValue( TrackedEntityDataValue dataValue )
+    public void updateTrackedEntityDataValue( TrackedEntityDataValue trackedEntityDataValue )
     {
-        if ( StringUtils.isEmpty( dataValue.getValue() ) )
+        trackedEntityDataValue.setAutoFields();
+
+        if ( StringUtils.isEmpty( trackedEntityDataValue.getValue() ) )
         {
-            dataValueStore.delete( dataValue );
+            dataValueStore.delete( trackedEntityDataValue );
         }
         else
         {
-            if ( StringUtils.isEmpty( dataValue.getStoredBy() ) )
+            if ( StringUtils.isEmpty( trackedEntityDataValue.getStoredBy() ) )
             {
-                dataValue.setStoredBy( currentUserService.getCurrentUsername() );
+                trackedEntityDataValue.setStoredBy( currentUserService.getCurrentUsername() );
             }
 
-            TrackedEntityDataValueAudit dataValueAudit = new TrackedEntityDataValueAudit( dataValue, dataValue.getValue(), dataValue.getStoredBy(), AuditType.UPDATE );
+            TrackedEntityDataValueAudit dataValueAudit = new TrackedEntityDataValueAudit( trackedEntityDataValue, trackedEntityDataValue.getValue(), trackedEntityDataValue.getStoredBy(), AuditType.UPDATE );
 
             dataValueAuditService.addTrackedEntityDataValueAudit( dataValueAudit );
-            dataValueStore.update( dataValue );
+            dataValueStore.update( trackedEntityDataValue );
         }
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentitydatavalue/hibernate/TrackedEntityDataValue.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentitydatavalue/hibernate/TrackedEntityDataValue.hbm.xml	2015-11-10 04:52:21 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentitydatavalue/hibernate/TrackedEntityDataValue.hbm.xml	2015-12-16 12:46:52 +0000
@@ -12,14 +12,16 @@
       <key-many-to-one name="dataElement" class="org.hisp.dhis.dataelement.DataElement" column="dataelementid"
         foreign-key="fk_entityinstancedatavalue_dataelementid" />
     </composite-id>
-    
+
     <property name="value" length="50000" />
 
-    <property name="timestamp" type="timestamp" />
-    
+    <property name="created" type="timestamp" />
+
+    <property name="lastUpdated" type="timestamp" />
+
     <property name="providedElsewhere" />
-	
+
     <property name="storedBy" column="storedby" />
-    
+
   </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java	2015-12-16 08:59:10 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java	2015-12-16 12:46:52 +0000
@@ -963,6 +963,8 @@
         for ( TrackedEntityDataValue dataValue : dataValues )
         {
             DataValue value = new DataValue();
+            value.setCreated( DateUtils.getLongGmtDateString( dataValue.getCreated() ) );
+            value.setLastUpdated( DateUtils.getLongGmtDateString( dataValue.getLastUpdated() ) );
             value.setDataElement( dataValue.getDataElement().getUid() );
             value.setValue( dataValue.getValue() );
             value.setProvidedElsewhere( dataValue.getProvidedElsewhere() );
@@ -1061,7 +1063,7 @@
         {
             if ( dataValue == null )
             {
-                dataValue = new TrackedEntityDataValue( programStageInstance, dataElement, new Date(), value );
+                dataValue = new TrackedEntityDataValue( programStageInstance, dataElement, value );
                 dataValue.setStoredBy( storedBy );
                 dataValue.setProvidedElsewhere( providedElsewhere );
 
@@ -1075,7 +1077,6 @@
             else
             {
                 dataValue.setValue( value );
-                dataValue.setTimestamp( new Date() );
                 dataValue.setStoredBy( storedBy );
                 dataValue.setProvidedElsewhere( providedElsewhere );
 

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/DataValue.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/DataValue.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/DataValue.java	2015-12-16 12:46:52 +0000
@@ -39,6 +39,10 @@
 @JacksonXmlRootElement( localName = "dataValue", namespace = DxfNamespaces.DXF_2_0 )
 public class DataValue
 {
+    private String created;
+
+    private String lastUpdated;
+
     private String value;
 
     private String dataElement;
@@ -59,6 +63,30 @@
 
     @JsonProperty
     @JacksonXmlProperty( isAttribute = true )
+    public String getCreated()
+    {
+        return created;
+    }
+
+    public void setCreated( String created )
+    {
+        this.created = created;
+    }
+
+    @JsonProperty
+    @JacksonXmlProperty( isAttribute = true )
+    public String getLastUpdated()
+    {
+        return lastUpdated;
+    }
+
+    public void setLastUpdated( String lastUpdated )
+    {
+        this.lastUpdated = lastUpdated;
+    }
+
+    @JsonProperty
+    @JacksonXmlProperty( isAttribute = true )
     public String getValue()
     {
         return value;

=== 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-12-04 05:41:43 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java	2015-12-16 12:46:52 +0000
@@ -165,6 +165,8 @@
             if ( rowSet.getString( "pdv_value" ) != null && rowSet.getString( "de_uid" ) != null )
             {
                 DataValue dataValue = new DataValue();
+                dataValue.setCreated( DateUtils.getLongGmtDateString( rowSet.getDate( "pdv_created" ) ) );
+                dataValue.setLastUpdated( DateUtils.getLongGmtDateString( rowSet.getDate( "pdv_lastupdated" ) ) );
                 dataValue.setValue( rowSet.getString( "pdv_value" ) );
                 dataValue.setProvidedElsewhere( rowSet.getBoolean( "pdv_providedelsewhere" ) );
                 dataValue.setDataElement( IdSchemes.getValue( rowSet.getString( "de_uid" ), rowSet.getString( "de_code" ), idSchemes.getDataElementIdScheme() ) );
@@ -260,6 +262,8 @@
             if ( rowSet.getString( "pdv_value" ) != null && rowSet.getString( "de_uid" ) != null )
             {
                 DataValue dataValue = new DataValue();
+                dataValue.setCreated( DateUtils.getLongGmtDateString( rowSet.getDate( "pdv_created" ) ) );
+                dataValue.setLastUpdated( DateUtils.getLongGmtDateString( rowSet.getDate( "pdv_lastupdated" ) ) );
                 dataValue.setValue( rowSet.getString( "pdv_value" ) );
                 dataValue.setProvidedElsewhere( rowSet.getBoolean( "pdv_providedelsewhere" ) );
                 dataValue.setDataElement( IdSchemes.getValue( rowSet.getString( "de_uid" ),
@@ -470,7 +474,7 @@
     private String getDataValueQuery()
     {
         String sql =
-            "select pdv.programstageinstanceid as pdv_id, pdv.value as pdv_value, pdv.storedby as pdv_storedby, pdv.providedelsewhere as pdv_providedelsewhere, " +
+            "select pdv.programstageinstanceid as pdv_id, pdv.created as pdv_created, pdv.lastupdated as pdv_lastupdated, pdv.value as pdv_value, pdv.storedby as pdv_storedby, pdv.providedelsewhere as pdv_providedelsewhere, " +
                 "de.uid as de_uid, de.code as de_code " +
                 "from trackedentitydatavalue pdv " +
                 "inner join dataelement de on pdv.dataelementid=de.dataelementid ";

=== 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-12-04 08:18:34 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2015-12-16 12:46:52 +0000
@@ -516,7 +516,7 @@
 
                 patientDataValue.setValue( value );
                 patientDataValue.setProgramStageInstance( programStageInstance );
-                patientDataValue.setTimestamp( new Date() );
+                patientDataValue.setLastUpdated( new Date() );
                 dataValueService.saveTrackedEntityDataValue( patientDataValue );
 
             }
@@ -558,14 +558,13 @@
 
                     if ( previousPatientDataValue == null )
                     {
-                        TrackedEntityDataValue patientDataValue = new TrackedEntityDataValue( programStageInstance,
-                            dataElement, new Date(), value );
+                        TrackedEntityDataValue patientDataValue = new TrackedEntityDataValue( programStageInstance, dataElement, value );
                         dataValueService.saveTrackedEntityDataValue( patientDataValue );
                     }
                     else
                     {
                         previousPatientDataValue.setValue( value );
-                        previousPatientDataValue.setTimestamp( new Date() );
+                        previousPatientDataValue.setLastUpdated( new Date() );
                         previousPatientDataValue.setProvidedElsewhere( false );
                         dataValueService.updateTrackedEntityDataValue( previousPatientDataValue );
                     }
@@ -793,7 +792,7 @@
             {
                 org.hisp.dhis.api.mobile.model.PatientAttribute patientAttribute = new org.hisp.dhis.api.mobile.model.PatientAttribute(
                     value.getAttribute().getName(), value.getValue(), null, false, value.getAttribute()
-                        .getDisplayInListNoProgram(), new OptionSet() );
+                    .getDisplayInListNoProgram(), new OptionSet() );
                 patientAttribute.setType( value.getAttribute().getValueType() );
 
                 patientAtts.add( patientAttribute );
@@ -1352,7 +1351,7 @@
                         programStageInstanceService.updateProgramStageInstance( programStageInstance );
                     }
 
-                    dataValue = new TrackedEntityDataValue( programStageInstance, dataElement, new Date(), value );
+                    dataValue = new TrackedEntityDataValue( programStageInstance, dataElement, value );
 
                     dataValueService.saveTrackedEntityDataValue( dataValue );
                 }
@@ -1366,7 +1365,7 @@
                 }
 
                 dataValue.setValue( value );
-                dataValue.setTimestamp( new Date() );
+                dataValue.setLastUpdated( new Date() );
 
                 dataValueService.updateTrackedEntityDataValue( dataValue );
             }
@@ -1499,7 +1498,7 @@
                 {
                     errorMsg = "Duplicate value of "
                         + attributeService.getTrackedEntityAttribute( Integer.parseInt( errorCode[1] ) )
-                            .getDisplayName();
+                        .getDisplayName();
                 }
                 else
                 {
@@ -2047,7 +2046,7 @@
 
                 trackedEntityDataValue.setProvidedElsewhere( false );
 
-                trackedEntityDataValue.setTimestamp( new Date() );
+                trackedEntityDataValue.setLastUpdated( new Date() );
 
                 dataValueService.saveTrackedEntityDataValue( trackedEntityDataValue );
             }
@@ -2548,7 +2547,7 @@
                 {
                     errorMsg = "Duplicate value of "
                         + attributeService.getTrackedEntityAttribute( Integer.parseInt( errorCode[1] ) )
-                            .getDisplayName();
+                        .getDisplayName();
                 }
                 else
                 {

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/PdfDataEntryFormImportUtil.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/PdfDataEntryFormImportUtil.java	2015-09-25 09:54:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/PdfDataEntryFormImportUtil.java	2015-12-16 12:46:52 +0000
@@ -30,7 +30,6 @@
 
 import com.lowagie.text.pdf.AcroFields;
 import com.lowagie.text.pdf.PdfReader;
-
 import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
@@ -226,7 +225,7 @@
         {
             // LOG.debug( "Adding TrackedEntityDataValue, value added" );
 
-            dataValue = new TrackedEntityDataValue( programStageInstance, dataElement, new Date(), value );
+            dataValue = new TrackedEntityDataValue( programStageInstance, dataElement, value );
             dataValue.setStoredBy( storedBy );
             // dataValue.setProvidedElsewhere( providedElsewhere );
 
@@ -240,7 +239,7 @@
         else if ( dataValue != null )
         {
             dataValue.setValue( value );
-            dataValue.setTimestamp( new Date() );
+            dataValue.setLastUpdated( new Date() );
             dataValue.setStoredBy( storedBy );
 
             dataValueService.updateTrackedEntityDataValue( dataValue );