dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33451
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17069: Data value set import, setting created and last updated to now if null
------------------------------------------------------------
revno: 17069
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-10-13 12:52:43 +0200
message:
Data value set import, setting created and last updated to now if null
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalue/DataValue.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.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-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalue/DataValue.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalue/DataValue.java 2014-10-09 12:09:47 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalue/DataValue.java 2014-10-13 10:52:43 +0000
@@ -77,6 +77,21 @@
{
}
+ //--------------------------------------------------------------------------
+ // Logic
+ //--------------------------------------------------------------------------
+
+ public boolean hasLastUpdated()
+ {
+ String updated = getLastUpdated();
+ return updated != null && !updated.isEmpty();
+ }
+
+ public boolean hasCreated()
+ {
+ String creat = getCreated();
+ return creat != null && !creat.isEmpty();
+ }
//--------------------------------------------------------------------------
// Getters and setters
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2014-10-06 22:28:17 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2014-10-13 10:52:43 +0000
@@ -575,6 +575,8 @@
// Data values
// ---------------------------------------------------------------------
+ Date now = new Date();
+
notifier.notify( id, "Importing data values" );
log.info( "importing data values" );
@@ -668,8 +670,8 @@
internalValue.setStoredBy( dataValue.getStoredBy() );
}
- internalValue.setCreated( parseDate( dataValue.getCreated() ) );
- internalValue.setLastUpdated( parseDate( dataValue.getLastUpdated() ) );
+ internalValue.setCreated( dataValue.hasCreated() ? parseDate( dataValue.getCreated() ) : now );
+ internalValue.setLastUpdated( dataValue.hasLastUpdated() ? parseDate( dataValue.getLastUpdated() ) : now );
internalValue.setComment( trimToNull( dataValue.getComment() ) );
internalValue.setFollowup( dataValue.getFollowup() );