dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33310
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16995: minor fix, longDateString for eventDate/dueDate in csv
------------------------------------------------------------
revno: 16995
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-10-08 13:21:01 +0700
message:
minor fix, longDateString for eventDate/dueDate in csv
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/csv/DefaultCsvEventService.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/events/event/csv/DefaultCsvEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/csv/DefaultCsvEventService.java 2014-10-08 06:16:03 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/csv/DefaultCsvEventService.java 2014-10-08 06:21:01 +0000
@@ -34,11 +34,15 @@
import com.fasterxml.jackson.dataformat.csv.CsvMapper;
import com.fasterxml.jackson.dataformat.csv.CsvParser;
import com.fasterxml.jackson.dataformat.csv.CsvSchema;
+import org.hisp.dhis.common.IdentifiableObjectManager;
import org.hisp.dhis.dxf2.events.event.Coordinate;
import org.hisp.dhis.dxf2.events.event.DataValue;
import org.hisp.dhis.dxf2.events.event.Event;
import org.hisp.dhis.dxf2.events.event.Events;
import org.hisp.dhis.event.EventStatus;
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.system.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import java.io.IOException;
@@ -61,6 +65,9 @@
csvMapper.enable( CsvParser.Feature.WRAP_AS_ARRAY );
}
+ @Autowired
+ private IdentifiableObjectManager manager;
+
@Override
public void writeEvents( OutputStream outputStream, Events events, boolean withHeader ) throws IOException
{
@@ -70,6 +77,8 @@
for ( Event event : events.getEvents() )
{
+ ProgramStageInstance psi = manager.get( ProgramStageInstance.class, event.getEvent() );
+
CsvEventDataValue templateDataValue = new CsvEventDataValue();
templateDataValue.setEvent( event.getEvent() );
templateDataValue.setStatus( event.getStatus() != null ? event.getStatus().name() : null );
@@ -77,8 +86,8 @@
templateDataValue.setProgramStage( event.getProgramStage() );
templateDataValue.setEnrollment( event.getEnrollment() );
templateDataValue.setOrgUnit( event.getOrgUnit() );
- templateDataValue.setEventDate( event.getEventDate() );
- templateDataValue.setDueDate( event.getDueDate() );
+ templateDataValue.setEventDate( DateUtils.getLongDateString( psi.getExecutionDate() ) );
+ templateDataValue.setDueDate( DateUtils.getLongDateString( psi.getDueDate() ) );
templateDataValue.setStoredBy( event.getStoredBy() );
if ( event.getCoordinate() != null )